Add setting for whether to show vehicle running costs per calendar year

See #660
This commit is contained in:
Jonathan G Rennison
2024-02-26 20:50:20 +00:00
parent a429bddbac
commit 5d7c87f5e4
10 changed files with 31 additions and 9 deletions

View File

@@ -4353,6 +4353,17 @@ void Vehicle::SetNext(Vehicle *next)
}
}
/**
* Gets the running cost of a vehicle that can be sent into SetDParam for string processing.
* @return the vehicle's running cost
*/
Money Vehicle::GetDisplayRunningCost() const
{
Money cost = this->GetRunningCost() >> 8;
if (_settings_client.gui.show_running_costs_calendar_year) cost *= DayLengthFactor();
return cost;
}
/**
* Adds this vehicle to a shared vehicle chain.
* @param shared_chain a vehicle of the chain with shared vehicles.