Adjust stopped/depot detection for running costs division
Fix v/this use in Train::GetRunningCost
This commit is contained in:
@@ -2131,11 +2131,15 @@ Money RoadVehicle::GetRunningCost() const
|
||||
uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, e->u.road.running_cost);
|
||||
if (cost_factor == 0) return 0;
|
||||
|
||||
/* running costs if in depot */
|
||||
if (IsRoadDepotTile(this->tile)) cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot;
|
||||
|
||||
/* running costs if stopped */
|
||||
if ((this->cur_speed == 0) && !(IsRoadDepotTile(this->tile))) cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped;
|
||||
if (this->cur_speed == 0) {
|
||||
if (this->IsInDepot()) {
|
||||
/* running costs if in depot */
|
||||
cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot;
|
||||
} else {
|
||||
/* running costs if stopped */
|
||||
cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped;
|
||||
}
|
||||
}
|
||||
|
||||
return GetPrice(e->u.road.running_cost_class, cost_factor, e->GetGRF());
|
||||
}
|
||||
|
Reference in New Issue
Block a user