News: Portal
Our Simutrans site. You can find everything about Simutrans from here.

One-way road is reversed in some case

Started by Phystam, June 18, 2022, 09:42:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


How to reproduce:
1. Construct piers and a slope like this picture:

2. Pressing Ctrl key, build one-way road from non-pier tile via the slope to the piers. Then the ribi-arrows are reversed.

3. This issue does not happen without pressing Ctrl key.


It has nothing to do with piers. I've seen it happen recently on flat ground, too, when building motorways.



I think I know what may be going on.  When holding the control key when constructing a way, the path finder using the "calc_straight_route" function which constructs the route from start to finish by first going straight along a cardinal direction, then diagonal along an ordinal direction.  In the event that that fails (such as when there is an obstacle), a second attempt is made swapping the start and finish coordinates.  I suspect what is happening is that functions for applying the one-way road flags are not taking into account the reversal of start and finish.


Yes. THleaderH, who brought this feature to extended, clearly knows the existence of this bug. Because he fixed it with his fork. But he didn't fix it with extended. (´・ω・`)

However, the related part of the code is slightly different between the standard and extended code.
I'm not familiar with the code in this part so I'm not sure if it's easy.

I may have fixed only the issue of one way reversing on flat land.
However, it seems that we have to distinguish between the case of flatness and the case of height difference. This can be a hassle so I wouldn't do it.

The following fixes may be relevant