Merge branch 'running-costs-exploration' into jgrpp

This commit is contained in:
Jonathan G Rennison
2021-11-19 23:18:17 +00:00
8 changed files with 83 additions and 3 deletions

View File

@@ -6481,6 +6481,16 @@ Money Train::GetRunningCost() const
cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF());
} while ((v = v->GetNextVehicle()) != nullptr);
if (this->cur_speed == 0) {
if (this->IsInDepot()) {
/* running costs if in depot */
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_in_depot);
} else {
/* running costs if stopped */
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_when_stopped);
}
}
return cost;
}