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

Change: Gradually slow down aircraft speed on breakdown #6932

Merged

Conversation

@SamuXarick
Copy link
Contributor

SamuXarick commented Oct 6, 2018

Gradually slows down aircraft speed on breakdown, towards the reduced speed, instead of instantly transitioning to that speed.

https://www.tt-forums.net/viewtopic.php?p=1193351

Gradually slows down aircraft speed on breakdown, towards the reduced speed, instead of instantly transitioning to that speed.
@@ -635,6 +635,12 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
* and take-off speeds being too low. */
speed_limit *= _settings_game.vehicle.plane_speed;

/* adjust speed for broken vehicles */
if (v->vehstatus & VS_AIRCRAFT_BROKEN) {
speed_limit = min(speed_limit, SPEED_LIMIT_BROKEN);

This comment has been minimized.

Copy link
@frosch123

frosch123 Oct 7, 2018

Member

This needs a similar condition as "(v->vcache.cached_max_speed < speed_limit)" in the case below.
hard_limit should only be set to false, if the new speed limit is the actual speed limit.
If the speed limit was already smaller than SPEED_LIMIT_BROKEN, then it continues to be a hard limit.

…tual speed limit
@LordAro LordAro dismissed frosch123’s stale review Oct 12, 2018

Updated, new review required

@@ -635,6 +635,12 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
* and take-off speeds being too low. */
speed_limit *= _settings_game.vehicle.plane_speed;

/* adjust speed for broken vehicles */
if (v->vehstatus & VS_AIRCRAFT_BROKEN) {
if (speed_limit > SPEED_LIMIT_BROKEN) hard_limit = false;

This comment has been minimized.

Copy link
@frosch123

frosch123 Oct 13, 2018

Member

Can you please reverse the condition:
if (SPEED_LIMIT_BROKEN < speed_limit) hard_limit = false;

That way the code is symmetric to the code below ("new limit < old limit"), which makes the code is easier to read.

@frosch123 frosch123 merged commit 264e605 into OpenTTD:master Oct 31, 2018
6 checks passed
6 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
openttd/commit-checker The commit looks good
Details
openttd/linux-amd64-clang-3.8 The commit looks good
Details
openttd/linux-amd64-gcc-6 The commit looks good
Details
openttd/linux-i386-gcc-6 The commit looks good
Details
openttd/osx-10.9 The commit looks good
Details
@SamuXarick SamuXarick deleted the SamuXarick:smooth-aircraft-speed-on-breakdown branch Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.