summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-27 21:14:19 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-27 21:14:19 +0000
commit45e7e61aa969764dc71ab1bbc574655e07a346a4 (patch)
treecd41f901ff9432fe8e37e87a0dfb34aadfb8f6d3 /train_cmd.c
parent2f0bdeefb9a3a5cfe8f3e78f64c94b8a25936e58 (diff)
downloadopenttd-45e7e61aa969764dc71ab1bbc574655e07a346a4.tar.xz
(svn r7268) -Codechange: change rail vehicle cached weight from 16 to 32 bit values to avoid possible overflows.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 1179c2958..a38c9d02e 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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)) {