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

0 Members and 1 Guest are viewing this topic.

#### Freahk

• Devotee
• Posts: 1357
• 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.
« Last Edit: January 20, 2020, 09:50:37 PM by Freahk »

• Devotee
• Posts: 3500
• 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.

#### Freahk

• Devotee
• Posts: 1357
• 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.

#### Leartin

• Heir-Benevolent-Dictator-Apparent
• Devotee
• Posts: 1473
• 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?

#### Freahk

• Devotee
• Posts: 1357
• 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.

• Devotee
• Posts: 3500
• 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

#### Freahk

• Devotee
• Posts: 1357
• 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.

#### jamespetts

• Simutrans-Extended project coordinator
• Posts: 20346
• Cake baker
• Languages: EN
##### Re: signal spacing overflow for spacings >= 128
« Reply #7 on: January 19, 2020, 12:20:36 AM »
Thank you for the report. I believe that I have now managed to fix this; I should be grateful if you could re-test.

#### Freahk

• Devotee
• Posts: 1357
• Languages: DE, EN
##### Re: signal spacing overflow for spacings >= 128
« Reply #8 on: January 19, 2020, 01:03:53 AM »
I can not confirm nor revoke this without any changes to the code as 128 (16000m) currently is simply the set maximum possible in the UI

#### jamespetts

• Simutrans-Extended project coordinator
• Posts: 20346
• Cake baker
• Languages: EN
##### Re: signal spacing overflow for spacings >= 128
« Reply #9 on: January 19, 2020, 01:26:52 AM »
That is odd - how was the bug originally reproduced, in that case - or was this restriction added as a fix after the report?

#### Freahk

• Devotee
• Posts: 1357
• Languages: DE, EN
##### Re: signal spacing overflow for spacings >= 128
« Reply #10 on: January 19, 2020, 01:35:32 AM »
That was added after the report.
I guess it was added when we switched from #tiles spacing to distance in meters spacing.