|
@@ -652,7 +652,7 @@ static int UpdateAircraftSpeed(Aircraft
|
|
|
/* 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);
|
|
|
speed_limit = std::min<uint>(speed_limit, SPEED_LIMIT_BROKEN);
|
|
|
}
|
|
|
|
|
|
if (v->vcache.cached_max_speed < speed_limit) {
|
|
@@ -669,10 +669,10 @@ static int UpdateAircraftSpeed(Aircraft
|
|
|
* speeds to that aircraft do not get to taxi speed straight after
|
|
|
* touchdown. */
|
|
|
if (!hard_limit && v->cur_speed > speed_limit) {
|
|
|
speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed);
|
|
|
speed_limit = v->cur_speed - std::max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed);
|
|
|
}
|
|
|
|
|
|
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
|
|
|
spd = std::min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
|
|
|
|
|
|
/* updates statusbar only if speed have changed to save CPU time */
|
|
|
if (spd != v->cur_speed) {
|
|
@@ -737,7 +737,7 @@ void GetAircraftFlightLevelBounds(const
|
|
|
}
|
|
|
|
|
|
/* Make faster planes fly higher so that they can overtake slower ones */
|
|
|
base_altitude += min(20 * (v->vcache.cached_max_speed / 200) - 90, 0);
|
|
|
base_altitude += std::min(20 * (v->vcache.cached_max_speed / 200) - 90, 0);
|
|
|
|
|
|
if (min_level != nullptr) *min_level = base_altitude + AIRCRAFT_MIN_FLYING_ALTITUDE;
|
|
|
if (max_level != nullptr) *max_level = base_altitude + AIRCRAFT_MAX_FLYING_ALTITUDE;
|
|
@@ -929,7 +929,7 @@ static bool AircraftController(Aircraft
|
|
|
v->cur_speed = 0;
|
|
|
return true;
|
|
|
}
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z_dest));
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, std::min(v->z_pos + count, z_dest));
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
@@ -975,9 +975,9 @@ static bool AircraftController(Aircraft
|
|
|
count = UpdateAircraftSpeed(v);
|
|
|
if (count > 0) {
|
|
|
if (v->z_pos > z) {
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z));
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, std::max(v->z_pos - count, z));
|
|
|
} else {
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z));
|
|
|
SetAircraftPosition(v, v->x_pos, v->y_pos, std::min(v->z_pos + count, z));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1125,7 +1125,7 @@ static bool AircraftController(Aircraft
|
|
|
|
|
|
/* We're not flying below our destination, right? */
|
|
|
assert(airport_z <= z);
|
|
|
int t = max(1U, dist - 4);
|
|
|
int t = std::max(1U, dist - 4);
|
|
|
int delta = z - airport_z;
|
|
|
|
|
|
/* Only start lowering when we're sufficiently close for a 1:1 glide */
|