(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.
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user