News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[Tutorial] Get direction of the signals

Started by Yona-TYT, January 02, 2017, 12:59:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

I need something like "get_dirs ()" to get the direction to where a signal is pointing.



An_dz

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).

Yona-TYT

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.

Yona-TYT

#3
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?

An_dz

It's probably a bug, let's wait for Dwachs to confirm.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

#6
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
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.


Dwachs

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.
Parsley, sage, rosemary, and maggikraut.