Author Topic: [Tutorial] Get direction of the signals  (Read 841 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

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



Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: [Tutorial] Get direction of the signals
« Reply #1 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).

Offline Yona-TYT

Re: [Tutorial] Get direction of the signals
« Reply #2 on: January 02, 2017, 03:20:43 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.

Offline Yona-TYT

[Tutorial] Problems when dragging signal placement tool
« Reply #3 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?
« Last Edit: January 04, 2017, 09:40:04 AM by Dwachs »

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: [Tutorial] Get direction of the signals
« Reply #4 on: January 03, 2017, 01:48:57 AM »
It's probably a bug, let's wait for Dwachs to confirm.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4224
  • Total likes: 168
  • Helpful: 148
  • Languages: EN, DE, AT
Re: [Tutorial] Problems when dragging signal placement tool
« Reply #5 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.
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: [Tutorial] Problems when dragging signal placement tool
« Reply #6 on: January 04, 2017, 11:08:23 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.

« Last Edit: January 04, 2017, 11:55:42 AM by Yona-TYT »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4224
  • Total likes: 168
  • Helpful: 148
  • Languages: EN, DE, AT
Re: [Tutorial] Get direction of the signals
« Reply #7 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.
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: [Tutorial] Get direction of the signals
« Reply #8 on: January 07, 2017, 10:28:45 PM »
It works fine now, thank you.  ;)