Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>

This commit is contained in:
Rubidium
2023-04-29 09:25:51 +02:00
committed by rubidium42
parent 969a3dc0f3
commit 19ec4e8beb
10 changed files with 67 additions and 98 deletions

View File

@@ -175,10 +175,10 @@ int GroundVehicle<T, Type>::GetAcceleration() const
* down hill will never slow down enough, and a vehicle that came up
* a hill will never speed up enough to (eventually) get back to the
* same (maximum) speed. */
int accel = ClampToI32((force - resistance) / (mass * 4));
int accel = ClampTo<int32_t>((force - resistance) / (mass * 4));
return force < resistance ? std::min(-1, accel) : std::max(1, accel);
} else {
return ClampToI32(std::min<int64>(-force - resistance, -10000) / mass);
return ClampTo<int32_t>(std::min<int64>(-force - resistance, -10000) / mass);
}
}