(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:
frosch
2009-11-24 13:12:34 +00:00
parent bc48c70c46
commit fe65c7f833
8 changed files with 76 additions and 37 deletions

View File

@@ -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()