News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

signal spacing overflow for spacings >= 128

Started by Mariculous, November 06, 2019, 01:47:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mariculous

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.

Vladki

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.

Mariculous

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

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?

Mariculous

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.

Vladki

in extended, you can also destroy the signalbox controlling the line in question, and it will destroy all its associated signals as well

Mariculous

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

Thank you for the report. I believe that I have now managed to fix this; I should be grateful if you could re-test.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Mariculous

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

That is odd - how was the bug originally reproduced, in that case - or was this restriction added as a fix after the report?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Mariculous

That was added after the report.
I guess it was added when we switched from #tiles spacing to distance in meters spacing.