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

Fix: Aircraft crash counter was too low to reach ground. #12425

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Apr 4, 2024

Motivation / Problem

Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

image

Description

Increase to an arbitrary higher value. When the aircraft reaches the ground the counter already skips ahead, so this does not increase the time it tasks to disappear after reaching the ground.

The counter is now reset while falling, and when the ground is reached it skips ahead to continue the normal counter processing.

image

Limitations

This could affect savegames slightly where an aircraft is up to half-way through the original crash counter limit, as it can then continue falling to the ground and will restart the final cleanup timer.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@PeterN PeterN added the backport requested This PR should be backport to current release (RC / stable) label Apr 4, 2024
@rubidium42
Copy link
Contributor

By the looks of it, the effects on saves are more widespread.

  • if it's in the waiting to get cleared stage, it will have to wait 4500 extra. After all, it it were at 9999 and this change comes in it has to wait using 14500 instead of 1000.
  • if the counter was between 500 and 650 the crash animation will get replayed.

The first one seems the most annoying, the crash animation being played a second time might not be that troublesome.

Though... the point of this change/fix is that it removes the limitation on falling down. Why not reset the counter to 0 when v->z_pos > z and set it to 500 when v->z_pos <= z (and do v->z_pos = z + 1 so it's always above ground)? That way the issue should be solved without any of the drawbacks or an arbitrary limitation. Or am I missing something?

@rubidium42
Copy link
Contributor

My mentioning that checking of v->z_pos == z needed to be amended was for this specific reason:
Aurillac Transport, 2035-02-24
The plane crashed, and I built a mountain at that location, so it would never reach v->z_pos == z (without looping). Now the plane is still crashing below the bottom of the map.
POC.zip

src/aircraft_cmd.cpp Outdated Show resolved Hide resolved
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
@PeterN PeterN merged commit 83da886 into OpenTTD:master Apr 5, 2024
15 checks passed
@PeterN PeterN deleted the fix-aircraft-falling branch April 5, 2024 18:16
glx22 pushed a commit to glx22/OpenTTD that referenced this pull request Apr 9, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
glx22 pushed a commit to glx22/OpenTTD that referenced this pull request Apr 9, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
rubidium42 pushed a commit to rubidium42/OpenTTD that referenced this pull request Apr 9, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
rubidium42 pushed a commit to rubidium42/OpenTTD that referenced this pull request Apr 9, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
glx22 pushed a commit that referenced this pull request Apr 9, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
@glx22 glx22 added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Apr 9, 2024
ladysadie pushed a commit to ladysadie/OpenTTD_WIP that referenced this pull request Apr 10, 2024
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants