The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Yona-TYT on January 02, 2017, 12:59:39 AM

Title: [Tutorial] Get direction of the signals
Post by: Yona-TYT on January 02, 2017, 12:59:39 AM
I need something like "get_dirs ()" to get the direction to where a signal is pointing.

(https://www.mediafire.com/convkey/430b/wx6be8tp3vwzw3v6g.jpg)
Title: Re: [Tutorial] Get direction of the signals
Post by: An_dz on January 02, 2017, 02:39:10 AM
get_dirs_masked() returns the ribi after applying any mask, like signals. So while the way ribi is 10 (N-S) with a one-way sign it can be 8 (N) or 2 (S).
Title: Re: [Tutorial] Get direction of the signals
Post by: Yona-TYT on January 02, 2017, 03:20:43 AM
Quote from: An_dz on January 02, 2017, 02:39:10 AM
get_dirs_masked() returns the ribi after applying any mask, like signals. So while the way ribi is 10 (N-S) with a one-way sign it can be 8 (N) or 2 (S).
This does not work, regardless of the position of the signal, the ribi is always 10 or 5.
Title: [Tutorial] Problems when dragging signal placement tool
Post by: Yona-TYT on January 03, 2017, 01:44:47 AM
Sorry for reviving this issue, but I'm having the same problem with the drag when I try to place passing signs.

Is it possible to fix this too?
(https://www.mediafire.com/convkey/430b/wx6be8tp3vwzw3v6g.jpg)
Title: Re: [Tutorial] Get direction of the signals
Post by: An_dz on January 03, 2017, 01:48:57 AM
It's probably a bug, let's wait for Dwachs to confirm.
Title: Re: [Tutorial] Problems when dragging signal placement tool
Post by: Dwachs on January 04, 2017, 09:41:15 AM
What exactly is the problem?

Do you want to restrict signal placement? And this does not work well with dragging?

Edit: you can use the forbid_way_tool* routines to restrict signal building.
Title: Re: [Tutorial] Problems when dragging signal placement tool
Post by: Yona-TYT on January 04, 2017, 11:08:23 AM
Quote from: Dwachs on January 04, 2017, 09:41:15 AM
What exactly is the problem?

Do you want to restrict signal placement? And this does not work well with dragging?

Edit: you can use the forbid_way_tool* routines to restrict signal building.

Because "get_dirs_masked ()" is not working... http://forum.simutrans.com/index.php?topic=16545.msg157727#msg157727 (http://forum.simutrans.com/index.php?topic=16545.msg157727#msg157727)
I am trying to determine the position of the signal, and for that I must count the number of times it is clicked.



By the way, my intention with this is to use the tutorial to explain a bit as is the placement of signals in Simutrans.

Title: Re: [Tutorial] Get direction of the signals
Post by: Dwachs on January 05, 2017, 11:36:10 AM
There was indeed a bug. Should be fixed with r7988.

There are also the functions tile_x::get_way_dirs (_masked) which might be more efficient to use.
Title: Re: [Tutorial] Get direction of the signals
Post by: Yona-TYT on January 07, 2017, 10:28:45 PM
It works fine now, thank you.  ;)