diff options
-rw-r--r-- | src/aircraft_cmd.cpp | 9 |
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; |