The International Simutrans Forum

 

Author Topic: signal spacing overflow for spacings >= 128  (Read 321 times)

0 Members and 1 Guest are viewing this topic.

Offline Freahk

  • *
  • Posts: 228
  • Languages: DE, EN
signal spacing overflow for spacings >= 128
« on: November 06, 2019, 01:47:13 PM »
Hey there,
I expect some overflow to happen but did not have a look at the code yet.

Any signal spacing will behave as spacing:=spacing%128
Additionally, there seem to be 2 special cases:
For spacing==2^(n+7), which is equal to 0, signals will be placed at a spacing of 1.
For spacing==2^(n+7)-1, which is equal to 127, no signals will be placed at all (including the starting point) but removal of intermediate signals will work.

I just tested it with extended and expect it to be also related to standard. If it isn't, feel free to move the report to extended.
How to reproduce:
check both checkboxes in the signal spacing window (don't know if required)
Select a signal spacing of 128 and drag signals along tracks. These will be placed at a spacing of 1.
Select a signal spacing of 127 and drag signals along tracks. This won't place any signals at all.

Offline Vladki cz

  • Devotee
  • *
  • Posts: 2735
    • My addons, mostly roadsigns
  • Languages: EN, CS
Re: signal spacing overflow for spacings >= 128
« Reply #1 on: November 06, 2019, 09:10:14 PM »
Just out of curiosity, what size of map are you playing that you even tried such high spacing. In extended scale 8 tiles/km this means 16 km between signals. Real railways (CZ) use spacing approx. 1 km (equal to braking distance). And in the game I also find it useful to have them at 1-2 km intervals.

Offline Freahk

  • *
  • Posts: 228
  • Languages: DE, EN
Re: signal spacing overflow for spacings >= 128
« Reply #2 on: November 06, 2019, 09:37:47 PM »
It's a pretty small 1280x1280 map.
I sometimes want to remove all signals of a track e.g. when changing from one signalling system to another on lines that don't have a fixed signal spacing but rely on manually placing signals at stations an in front of junctions.
Well, when I was about to remove all of the old signals, I setup the tool, strg clicked at the start, klicked at the end and... ended up with a signal at very single tile of track.

When signalling long tracks without junctions in between I usually use signal spacings somewhere in between 8 and 16.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1281
  • PAK-DEV P192C
  • Languages: DE, EN
Re: signal spacing overflow for spacings >= 128
« Reply #3 on: November 07, 2019, 08:11:38 AM »
In Standard, signal spacing is limited to 50 tiles, so this problem cannot occur.

However, the idea of being able to delete signals like that is interesting, and it seems like you only need to allow "-1" as a value to achieve it?

Offline Freahk

  • *
  • Posts: 228
  • Languages: DE, EN
Re: signal spacing overflow for spacings >= 128
« Reply #4 on: November 07, 2019, 12:22:38 PM »
At least in extended this should work.
However, I would prefer locating and understanding this behavior in the code to make sure there are no side effects in border cases and using 0 for this as a spacing of 0 doesn't make any sense.

Offline Vladki cz

  • Devotee
  • *
  • Posts: 2735
    • My addons, mostly roadsigns
  • Languages: EN, CS
Re: signal spacing overflow for spacings >= 128
« Reply #5 on: November 07, 2019, 04:30:17 PM »
in extended, you can also destroy the signalbox controlling the line in question, and it will destroy all its associated signals as well

Offline Freahk

  • *
  • Posts: 228
  • Languages: DE, EN
Re: signal spacing overflow for spacings >= 128
« Reply #6 on: November 07, 2019, 05:11:25 PM »
Yep, that's also useful in some cases. However, often one wants to replace signals on a per track base instead of a per signalbox base and in that case such a signal replacer tool would be very useful.
Another example would be missplaced signals in stations that are very hard to find and remove using the "normal" destruction tool. I usually locate and remove these by using the signal placement tool.