mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-30 18:09:09 +00:00
(svn r7268) -Codechange: change rail vehicle cached weight from 16 to 32 bit values to avoid possible overflows.
This commit is contained in:
@@ -48,11 +48,11 @@ static const byte _state_dir_table[4] = { 0x20, 8, 0x10, 4 };
|
||||
static void TrainCargoChanged(Vehicle* v)
|
||||
{
|
||||
Vehicle *u;
|
||||
uint16 weight = 0;
|
||||
uint32 weight = 0;
|
||||
|
||||
for (u = v; u != NULL; u = u->next) {
|
||||
const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
|
||||
uint16 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16;
|
||||
uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16;
|
||||
|
||||
// Vehicle weight is not added for articulated parts.
|
||||
if (!IsArticulatedPart(u)) {
|
||||
|
Reference in New Issue
Block a user