diff options
author | frosch <frosch@openttd.org> | 2009-11-08 13:02:05 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-11-08 13:02:05 +0000 |
commit | 6ca8f6e38025c9a7b484ffee669f27fad7ceb32d (patch) | |
tree | 9d745e0add388c8a8e058ec5399d66a4dc9d3d00 /src/engine.cpp | |
parent | cc320dc4d0253fc349cffc2719f6d20bb7ced99d (diff) | |
download | openttd-6ca8f6e38025c9a7b484ffee669f27fad7ceb32d.tar.xz |
(svn r18011) -Feature(ette): [NewGRF] CB 36 for roadvehicle property 09 'running cost factor'.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 1f49f2bce..04f483bb8 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -205,11 +205,15 @@ uint Engine::GetDisplayDefaultCapacity(uint16 *mail_capacity) const Money Engine::GetRunningCost() const { switch (this->type) { - case VEH_ROAD: - return this->u.road.running_cost * GetPriceByIndex(this->u.road.running_cost_class) >> 8; + case VEH_ROAD: { + if (this->u.road.running_cost_class == INVALID_PRICE) return 0; + return GetEngineProperty(this->index, PROP_ROADVEH_RUNNING_COST_FACTOR, this->u.road.running_cost) * GetPriceByIndex(this->u.road.running_cost_class) >> 8; + } - case VEH_TRAIN: + case VEH_TRAIN: { + if (this->u.rail.running_cost_class == INVALID_PRICE) return 0; return GetEngineProperty(this->index, PROP_TRAIN_RUNNING_COST_FACTOR, this->u.rail.running_cost) * GetPriceByIndex(this->u.rail.running_cost_class) >> 8; + } case VEH_SHIP: return GetEngineProperty(this->index, PROP_SHIP_RUNNING_COST_FACTOR, this->u.ship.running_cost) * _price[PR_RUNNING_SHIP] >> 8; @@ -233,6 +237,7 @@ Money Engine::GetCost() const } else { return GetEngineProperty(this->index, PROP_TRAIN_COST_FACTOR, this->u.rail.cost_factor) * (_price[PR_BUILD_VEHICLE_TRAIN] >> 3) >> 5; } + case VEH_SHIP: return GetEngineProperty(this->index, PROP_SHIP_COST_FACTOR, this->u.ship.cost_factor) * (_price[PR_BUILD_VEHICLE_SHIP] >> 3) >> 5; |