diff options
author | peter1138 <peter1138@openttd.org> | 2006-12-10 19:00:06 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-12-10 19:00:06 +0000 |
commit | 8e26cfb157420959fe3cde0c511d81089335fb74 (patch) | |
tree | 28e500a71ec9ff4ad854a8205f70f73fe5b95f60 /train_cmd.c | |
parent | ea518f8d9663b757bdc444aa6255a1c35c22ff0e (diff) | |
download | openttd-8e26cfb157420959fe3cde0c511d81089335fb74.tar.xz |
(svn r7473) -Fix (r7269): Pass a cargo type to determine the freight weight
multiplier instead of a vehicle. Fixes incorrect display of total
train capacity.
Diffstat (limited to 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/train_cmd.c b/train_cmd.c index 0632532d7..11bf9ae10 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -42,14 +42,13 @@ static const byte _state_dir_table[4] = { 0x20, 8, 0x10, 4 }; /** Return the cargo weight multiplier to use for a rail vehicle - * @param v Vehicle (wagon) to get multiplier for + * @param cargo Cargo type to get multiplier for * @return Cargo weight multiplier */ -byte FreightWagonMult(const Vehicle *v) +byte FreightWagonMult(CargoID cargo) { - assert(v->type == VEH_Train); // XXX NewCargos introduces a specific "is freight" flag for this test. - if (v->cargo_type == CT_PASSENGERS || v->cargo_type == CT_MAIL) return 1; + if (cargo == CT_PASSENGERS || cargo == CT_MAIL) return 1; return _patches.freight_trains; } @@ -66,7 +65,7 @@ static void TrainCargoChanged(Vehicle* v) for (u = v; u != NULL; u = u->next) { const RailVehicleInfo *rvi = RailVehInfo(u->engine_type); - uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u)) / 16; + uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16; // Vehicle weight is not added for articulated parts. if (!IsArticulatedPart(u)) { |