Divide cost instead of cost_factor in running costs division
This is to prevent 0 running costs for cheap vehicles when cost_factor would be < 1
This commit is contained in:
@@ -6456,19 +6456,19 @@ Money Train::GetRunningCost() const
|
||||
/* Halve running cost for multiheaded parts */
|
||||
if (v->IsMultiheaded()) cost_factor /= 2;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user