@@ -940,8 +940,8 @@ static uint32 VehicleGetVariable(Vehicle
if (totalsets == 0) return nullptr;
uint set = (v->cargo.StoredCount() * totalsets) / max((uint16)1, v->cargo_cap);
set = min(set, totalsets - 1);
uint set = (v->cargo.StoredCount() * totalsets) / std::max<uint16>(1u, v->cargo_cap);
set = std::min(set, totalsets - 1);
return in_motion ? group->loaded[set] : group->loading[set];
}