summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2018-10-31 11:45:23 +0000
committerfrosch <github@elsenhans.name>2018-10-31 12:45:23 +0100
commit264e60529fb632ffbdd5d19a91d9b2dd03e97428 (patch)
tree2c6e5befc7641cf958e418c6ec64eb818c806559 /src
parentbb7353c02afd7ff04c4a71cc2b114ed8a6136994 (diff)
downloadopenttd-264e60529fb632ffbdd5d19a91d9b2dd03e97428.tar.xz
Change: Gradually slow down aircraft speed on breakdown (#6932)
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 069351a51..fe8cf927d 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -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_BROKEN < speed_limit) hard_limit = false;
+ speed_limit = min(speed_limit, SPEED_LIMIT_BROKEN);
+ }
+
if (v->vcache.cached_max_speed < speed_limit) {
if (v->cur_speed < speed_limit) hard_limit = false;
speed_limit = v->vcache.cached_max_speed;
@@ -654,9 +660,6 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
- /* adjust speed for broken vehicles */
- if (v->vehstatus & VS_AIRCRAFT_BROKEN) spd = min(spd, SPEED_LIMIT_BROKEN);
-
/* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) {
v->cur_speed = spd;