summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-28 12:08:03 +0000
committerfrosch <frosch@openttd.org>2012-01-28 12:08:03 +0000
commit90c53046c77101c3b6d7ad8e77f79c3cf5ee8da0 (patch)
tree360248efa1d561d9df0b76d04f2a5f14d4ec61d8 /src/engine.cpp
parenta60f19ae14935e4f68667e67b650219380f5a86f (diff)
downloadopenttd-90c53046c77101c3b6d7ad8e77f79c3cf5ee8da0.tar.xz
(svn r23860) -Feature: [NewGRF] Add cargo property 1D to set the capacity multipliers when refitting vehicles, which do not use callback 15.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 2f0b31b98..1e3c0f387 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -258,18 +258,9 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16 *mail_capacity) const
/* Apply multipliers depending on cargo- and vehicletype.
* Note: This might change to become more consistent/flexible. */
if (this->type != VEH_SHIP && default_cargo != cargo_type) {
- switch (default_cargo) {
- case CT_PASSENGERS: break;
- case CT_MAIL:
- case CT_GOODS: capacity *= 2; break;
- default: capacity *= 4; break;
- }
- switch (cargo_type) {
- case CT_PASSENGERS: break;
- case CT_MAIL:
- case CT_GOODS: capacity /= 2; break;
- default: capacity /= 4; break;
- }
+ uint16 default_multiplier = CargoSpec::Get(default_cargo)->multiplier;
+ uint16 cargo_multiplier = CargoSpec::Get(cargo_type)->multiplier;
+ capacity = (capacity * cargo_multiplier + default_multiplier / 2) / default_multiplier;
}
return capacity;