summaryrefslogtreecommitdiff
path: root/src/ship_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-11-24 13:12:34 +0000
committerfrosch <frosch@openttd.org>2009-11-24 13:12:34 +0000
commit912bce0b8cdeca9849dd257ca95566b009719d53 (patch)
treea2abd63725a9c6baffb22a8b3c39dc6b2f535dfb /src/ship_cmd.cpp
parentb6b551533532d64f47e883d770b9633027ca7628 (diff)
downloadopenttd-912bce0b8cdeca9849dd257ca95566b009719d53.tar.xz
(svn r18266) -Codechange: Add a function to compute prices from price base and cost factor and use it consistently for vehicle purchase, running cost, and refit cost.
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r--src/ship_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index c482539ab..fc579fc48 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -159,7 +159,9 @@ static void CheckIfShipNeedsService(Vehicle *v)
Money Ship::GetRunningCost() const
{
- return GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, ShipVehInfo(this->engine_type)->running_cost) * _price[PR_RUNNING_SHIP];
+ const Engine *e = Engine::Get(this->engine_type);
+ uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
+ return GetPrice(PR_RUNNING_SHIP, cost_factor);
}
void Ship::OnNewDay()