News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

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.

Phystam

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.

zook2

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

Ranran(Hibernating)

(´・ω・`)シミュトランスのアップデート履歴(日本語) (※更新停止中)
bit.ly/3AuKHHP

PJMack

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.

Ranran(Hibernating)

#4
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.

EDIT:
I may have fixed only the issue of one way reversing on flat land.
https://github.com/Ranran-the-JuicyPork/simutrans-extended/commit/ffdad8e9039c6bf4130794f1d54b8522a7a3f360
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
https://github.com/teamhimeh/simutrans/commit/f1a436cfc4d322a0ef50866dd92df85c41fbb8e4
https://github.com/teamhimeh/simutrans/commit/203640fc649f5714d5c4bfdd130c81738fdad945
(´・ω・`)シミュトランスのアップデート履歴(日本語) (※更新停止中)
bit.ly/3AuKHHP

jamespetts

I have incorporated Ranran's fix - thank you for that.
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.

Ranran(Hibernating)

I think I have only partially fixed this bug.
Only fixed if all roads to be laid are flat.
THleaderH seems to have fixed it in his own fork, but from reading past posts 4 month ago, I gave up on fixing it because I didn't succeed in merging his fix.
(´・ω・`)シミュトランスのアップデート履歴(日本語) (※更新停止中)
bit.ly/3AuKHHP

jamespetts

Quote from: Ranran on November 05, 2022, 04:12:58 PMI think I have only partially fixed this bug.
Only fixed if all roads to be laid are flat.
THleaderH seems to have fixed it in his own fork, but from reading past posts 4 month ago, I gave up on fixing it because I didn't succeed in merging his fix.
Thank you - a partial fix is better than no fix, I think.
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.