Initial commit to allow configuring running costs as a fraction (1/1 default thru 1/4) independently for both vehicles stopped in depots (doesn't work for planes, I'm not smart enuff), or vehicles that are stationary.

This commit is contained in:
reldred
2021-11-18 12:47:23 +10:30
parent 782fba3064
commit 904ff346c2
8 changed files with 63 additions and 0 deletions

View File

@@ -2131,6 +2131,12 @@ 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;
return GetPrice(e->u.road.running_cost_class, cost_factor, e->GetGRF());
}