Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game crash on removing track under bridge #40

Closed
DorpsGek opened this issue Jan 18, 2006 · 2 comments
Closed

Game crash on removing track under bridge #40

DorpsGek opened this issue Jan 18, 2006 · 2 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

Darkvater opened the ticket and wrote:

The problem is obvious, game crashes.
To reproduce: "bridge_crash.sav": any time any part of the train is under the bridge.
To reproduce: "bridge_crash2.sav" (with patch): only at that exact moment.

The original problem (been there for ages, in 0.4.0.1 as well) is that EnsureNoVehicleProcZ() is called and the tile is released as free-to-demolish when the v->z_pos and ti->z don't match. This is incomplete, as a train on a slope will have z values ranging from the bottom to the top. Eg from 8 to 16 if it goes from level 1 to 2. The patch fixes that.
The second problem (bridge_crash2.sav) still occurs however. This is because at the exact moment the train enters the tile, it's 'Z'-value is still 8; no change made. Currently there is no way to fix this without an overhaul of UP/DOWN detection (which is XXX-d and is crap), as there is not a single variable that tells us if the train is going up/down. These variables are cleared just a few lines before in AfterSetTrainPos:2603 in train_cmd.c.

A note: bridge_crash2.sav, while it does happen, does this VERY sporadically. To reproduce it faithfully I had to breakpoint the game at the exact moment the train enters the tile and pause it programmatically. Nevertheless it can happen.

Any thoughts on the patch? I think it is sufficient for the time (using > instead of >= will break deleting tracks under bridges); any better fixes need a lot more work. Also noted that the hash is totally braindead and doesn't really work as required.

Please test and give thoughs.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/40
@DorpsGek
Copy link
Member Author

peter1138 wrote:

Well, I tested it briefly, and it seems to do the trick for the first one.

I did discover another (probably already known) bridge bug though...


This comment was imported from FlySpray: https://bugs.openttd.org/task/40#comment86

@DorpsGek
Copy link
Member Author

Darkvater closed the ticket.

Reason for closing: Fixed


This comment was imported from FlySpray: https://bugs.openttd.org/task/40

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant