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 from out-of-bounds helicopter, infinite circling with superfast aircraft #7619
Comments
I don't think this scenario is likely to occur in a game... |
This should really be separate issues, but whatever First issue is crashing the game due to trying to render the error message ("aircraft cannot be stopped") at an invalid tile:
Note the y value of 16777296 for ShowErrorMessage. This is due to the vehicle's tile being invalid and outside of the range of the map, caused by the intercontinental airport's holding pattern being as wide as it is. I don't think it's distinct to helicopters, but I've been unable to reproduce with standard aircraft. Something to do with the circling pattern, perhaps? Not sure whether the best course of action to fix that would be - it's not enough just to add some clamps to ShowErrorMessage, as the vehicle's position is invalid - it will just cause other issues later on (e.g. when saving). Could perhaps adjust the intercontinental airport's holding pattern? The other issue is similarly niche. It only seems to happen when the aircraft approaches from certain directions - from the north east doesn't seem to trigger it, but from the south west (and presumably north west as per original report) does. Adding some print statements in indicates that the aircraft is stuck in movement data index "19" (for city airport) and just never leaves it. Presumably it's just going fast enough to go "past" the end of the pattern and being forced to begin it again? This requires further debugging though |
This fixes part A of OpenTTD#7619, but not part B. Vehicle::x_pos and Vehicle::y_pos are not required to be within the map bounds. See also: GetTileHeightBelowAircraft()
This fixes part A of #7619, but not part B. Vehicle::x_pos and Vehicle::y_pos are not required to be within the map bounds. See also: GetTileHeightBelowAircraft()
This fixes part A of OpenTTD#7619, but not part B. Vehicle::x_pos and Vehicle::y_pos are not required to be within the map bounds. See also: GetTileHeightBelowAircraft()
Edit: nevermind, took me a bit of trying, but I got it. It looks AMAZING :D |
2021-01-08.20-37-27.mp4I am very tempted to leave in this bug. It just looks so perfect. This is not speed up and fast-forward is NOT on. |
I got the same behavior with a similar setup. |
It seems the airport in question has no holding pattern. Not a NewGRF expert, so I cannot confirm really, but I can see that with the savegame and that airport, the plane never reaches a hold state :) |
Okay, so basically: plane is going to a magic tile that is the entry of the airport. But it is going so quickly, it overshoots it COMPLETELY, turns around to correct for it, and by the magic of the circling being an exact multiplication of the airplane speed, it keeps overshooting it with the same amount, making the same circle, etc etc etc. Basically: plane too fast :D We should be able to solve this ... |
For non-NewGRF planes, "count" is never above 1. So planes can smoothly be guided to their destination. For NewGRF planes, they can go as quick as "count" values of 20. This easily overshoots the target. So, calculate if the plane will overshoot, and start nudging him to the destination earlier. You won't notice this either way, as it all happens within a single tick.
For non-NewGRF planes, "count" is never above 1. So planes can smoothly be guided to their destination. For NewGRF planes, they can go as quick as "count" values of 20. This easily overshoots the target. So, calculate if the plane will overshoot, and start nudging him to the destination earlier. You won't notice this either way, as it all happens within a single tick.
Version of OpenTTD
20190525-master-gef74af6766
Expected result
Game does not crash and both aircraft land properly.
Actual result
A. When you repeatedly start/stop any helicopter under certain conditions (such as below), the game can crash with
Assertion failed at line 100 of d:\a\1\s\src\tile_map.h: tile < MapSize()
due to an out-of-bounds position for that aircraft. This may be related to #272.Crash files have been attached. Fixed by #7833.
B. When a regular aircraft (such as the Arwing) that is going very fast (>4000 km/h) tries to land in an airport, it circles around the destination airport infinitely. This has the following effects:
Savegame attached for clarification.
Steps to reproduce
Assertion failed at line 100 of d:\a\1\s\src\tile_map.h: tile < MapSize()
because it accesses an out-of-bounds/invalid tile from the map array.The text was updated successfully, but these errors were encountered: