@@ -937,14 +937,14 @@ static uint32 VehicleGetVariable(Vehicle
bool in_motion = !v->First()->current_order.IsType(OT_LOADING);
uint totalsets = in_motion ? group->num_loaded : group->num_loading;
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];
}
GrfSpecFeature VehicleResolverObject::GetFeature() const
{