diff --git a/src/ground_vehicle.cpp b/src/ground_vehicle.cpp --- a/src/ground_vehicle.cpp +++ b/src/ground_vehicle.cpp @@ -38,7 +38,7 @@ void GroundVehicle::PowerChange /* Get minimum max speed for this track. */ uint16 track_speed = u->GetMaxTrackSpeed(); - if (track_speed > 0) max_track_speed = min(max_track_speed, track_speed); + if (track_speed > 0) max_track_speed = std::min(max_track_speed, track_speed); } byte air_drag; @@ -48,7 +48,7 @@ void GroundVehicle::PowerChange if (air_drag_value == 0) { uint16 max_speed = v->GetDisplayMaxSpeed(); /* Simplification of the method used in TTDPatch. It uses <= 10 to change more steadily from 128 to 196. */ - air_drag = (max_speed <= 10) ? 192 : max(2048 / max_speed, 1); + air_drag = (max_speed <= 10) ? 192 : std::max(2048 / max_speed, 1); } else { /* According to the specs, a value of 0x01 in the air drag property means "no air drag". */ air_drag = (air_drag_value == 1) ? 0 : air_drag_value; @@ -89,7 +89,7 @@ void GroundVehicle::CargoChange } /* Store consist weight in cache. */ - this->gcache.cached_weight = max(1, weight); + this->gcache.cached_weight = std::max(1u, weight); /* Friction in bearings and other mechanical parts is 0.1% of the weight (result in N). */ this->gcache.cached_axle_resistance = 10 * weight; @@ -162,8 +162,8 @@ int GroundVehicle::GetAccelerat } } else { /* "Kickoff" acceleration. */ - force = (mode == AS_ACCEL && !maglev) ? min(max_te, power) : power; - force = max(force, (mass * 8) + resistance); + force = (mode == AS_ACCEL && !maglev) ? std::min(max_te, power) : power; + force = std::max(force, (mass * 8) + resistance); } if (mode == AS_ACCEL) { @@ -176,9 +176,9 @@ int GroundVehicle::GetAccelerat * a hill will never speed up enough to (eventually) get back to the * same (maximum) speed. */ int accel = ClampToI32((force - resistance) / (mass * 4)); - return force < resistance ? min(-1, accel) : max(1, accel); + return force < resistance ? std::min(-1, accel) : std::max(1, accel); } else { - return ClampToI32(min(-force - resistance, -10000) / mass); + return ClampToI32(std::min(-force - resistance, -10000) / mass); } }