1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-15 08:22:34 +01:00

Codefix: potential integer overflow before widening integer

This commit is contained in:
Rubidium
2025-03-12 20:42:17 +01:00
committed by rubidium42
parent 02f1bc0880
commit 35ef197be4

View File

@@ -110,7 +110,7 @@ int GroundVehicle<T, Type>::GetAcceleration() const
int64_t speed = v->GetCurrentSpeed(); // [km/h-ish]
/* Weight is stored in tonnes. */
int32_t mass = this->gcache.cached_weight;
int64_t mass = this->gcache.cached_weight;
/* Power is stored in HP, we need it in watts.
* Each vehicle can have U16 power, 128 vehicles, HP -> watt