diff options
author | frosch <frosch@openttd.org> | 2009-11-24 13:12:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-11-24 13:12:34 +0000 |
commit | 912bce0b8cdeca9849dd257ca95566b009719d53 (patch) | |
tree | a2abd63725a9c6baffb22a8b3c39dc6b2f535dfb /src/roadveh_cmd.cpp | |
parent | b6b551533532d64f47e883d770b9633027ca7628 (diff) | |
download | openttd-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/roadveh_cmd.cpp')
-rw-r--r-- | src/roadveh_cmd.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index bbe258e84..bc69349c3 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1827,13 +1827,13 @@ static bool RoadVehController(RoadVehicle *v) Money RoadVehicle::GetRunningCost() const { - const RoadVehicleInfo *rvi = RoadVehInfo(this->engine_type); - if (rvi->running_cost_class == INVALID_PRICE) return 0; + const Engine *e = Engine::Get(this->engine_type); + if (e->u.road.running_cost_class == INVALID_PRICE) return 0; - uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, rvi->running_cost); + uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, e->u.road.running_cost); if (cost_factor == 0) return 0; - return cost_factor * GetPriceByIndex(rvi->running_cost_class); + return GetPrice(e->u.road.running_cost_class, cost_factor); } bool RoadVehicle::Tick() |