1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 10:29:10 +00:00

Change: Gradually slow down aircraft speed on breakdown (#6932)

This commit is contained in:
SamuXarick
2018-10-31 11:45:23 +00:00
committed by frosch
parent bb7353c02a
commit 264e60529f

View File

@@ -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;