Add setting for whether to show vehicle running costs per calendar year
See #660
This commit is contained in:
@@ -790,7 +790,7 @@ static StringID GetRunningCostString()
|
|||||||
{
|
{
|
||||||
if (EconTime::UsingWallclockUnits()) {
|
if (EconTime::UsingWallclockUnits()) {
|
||||||
return STR_PURCHASE_INFO_RUNNINGCOST_PERIOD;
|
return STR_PURCHASE_INFO_RUNNINGCOST_PERIOD;
|
||||||
} else if (DayLengthFactor() > 1) {
|
} else if (DayLengthFactor() > 1 && !_settings_client.gui.show_running_costs_calendar_year) {
|
||||||
return STR_PURCHASE_INFO_RUNNINGCOST_ORIG_YEAR;
|
return STR_PURCHASE_INFO_RUNNINGCOST_ORIG_YEAR;
|
||||||
} else {
|
} else {
|
||||||
return STR_PURCHASE_INFO_RUNNINGCOST_YEAR;
|
return STR_PURCHASE_INFO_RUNNINGCOST_YEAR;
|
||||||
|
@@ -319,7 +319,9 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity) const
|
|||||||
*/
|
*/
|
||||||
Money Engine::GetDisplayRunningCost() const
|
Money Engine::GetDisplayRunningCost() const
|
||||||
{
|
{
|
||||||
return this->GetRunningCost() * DayLengthFactor();
|
Money cost = this->GetRunningCost();
|
||||||
|
if (_settings_client.gui.show_running_costs_calendar_year) cost *= DayLengthFactor();
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -206,7 +206,7 @@ static StringID GetRunningCostString()
|
|||||||
{
|
{
|
||||||
if (EconTime::UsingWallclockUnits()) {
|
if (EconTime::UsingWallclockUnits()) {
|
||||||
return STR_ENGINE_PREVIEW_RUNCOST_PERIOD;
|
return STR_ENGINE_PREVIEW_RUNCOST_PERIOD;
|
||||||
} else if (DayLengthFactor() > 1) {
|
} else if (DayLengthFactor() > 1 && !_settings_client.gui.show_running_costs_calendar_year) {
|
||||||
return STR_ENGINE_PREVIEW_RUNCOST_ORIG_YEAR;
|
return STR_ENGINE_PREVIEW_RUNCOST_ORIG_YEAR;
|
||||||
} else {
|
} else {
|
||||||
return STR_ENGINE_PREVIEW_RUNCOST_YEAR;
|
return STR_ENGINE_PREVIEW_RUNCOST_YEAR;
|
||||||
|
@@ -323,6 +323,9 @@ STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT :When enabled, h
|
|||||||
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL :Show rail polyline tool: {STRING2}
|
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL :Show rail polyline tool: {STRING2}
|
||||||
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT :When enabled, the rail construction toolbar includes a button to build using the polyline mode.
|
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT :When enabled, the rail construction toolbar includes a button to build using the polyline mode.
|
||||||
|
|
||||||
|
STR_CONFIG_SHOW_VEHICLE_RUNNING_COSTS_CALENDAR_YEAR :Show vehicle running costs per calendar year: {STRING2}
|
||||||
|
STR_CONFIG_SHOW_VEHICLE_RUNNING_COSTS_CALENDAR_YEAR_HELPTEXT :When using a day length factor greater than one, show vehicle running costs per calendar year instead of per original year.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2}
|
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2}
|
||||||
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode.
|
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode.
|
||||||
|
|
||||||
|
@@ -2282,6 +2282,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
vehicle_windows->Add(new SettingEntry("gui.enable_single_veh_shared_order_gui"));
|
vehicle_windows->Add(new SettingEntry("gui.enable_single_veh_shared_order_gui"));
|
||||||
vehicle_windows->Add(new SettingEntry("gui.show_order_number_vehicle_view"));
|
vehicle_windows->Add(new SettingEntry("gui.show_order_number_vehicle_view"));
|
||||||
vehicle_windows->Add(new SettingEntry("gui.hide_default_stop_location"));
|
vehicle_windows->Add(new SettingEntry("gui.hide_default_stop_location"));
|
||||||
|
vehicle_windows->Add(new ConditionallyHiddenSettingEntry("gui.show_running_costs_calendar_year", []() -> bool { return GetGameSettings().economy.timekeeping_units != TKU_CALENDAR; }));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *departureboards = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS));
|
SettingsPage *departureboards = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS));
|
||||||
|
@@ -316,6 +316,7 @@ struct GUISettings : public TimeSettings {
|
|||||||
bool show_order_number_vehicle_view; ///< Show order number in vehicle view window
|
bool show_order_number_vehicle_view; ///< Show order number in vehicle view window
|
||||||
bool hide_default_stop_location; ///< Hide default stop location for orders
|
bool hide_default_stop_location; ///< Hide default stop location for orders
|
||||||
bool show_rail_polyline_tool; ///< Show rail polyline tool
|
bool show_rail_polyline_tool; ///< Show rail polyline tool
|
||||||
|
bool show_running_costs_calendar_year; ///< Show vehicle running costs in calendar years
|
||||||
|
|
||||||
uint16_t console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
|
uint16_t console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
|
||||||
uint16_t console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.
|
uint16_t console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.
|
||||||
|
@@ -1619,6 +1619,14 @@ str = STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL
|
|||||||
strhelp = STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT
|
strhelp = STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT
|
||||||
post_cb = [](auto) { InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); }
|
post_cb = [](auto) { InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); }
|
||||||
|
|
||||||
|
[SDTC_BOOL]
|
||||||
|
var = gui.show_running_costs_calendar_year
|
||||||
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
|
||||||
|
def = false
|
||||||
|
str = STR_CONFIG_SHOW_VEHICLE_RUNNING_COSTS_CALENDAR_YEAR
|
||||||
|
strhelp = STR_CONFIG_SHOW_VEHICLE_RUNNING_COSTS_CALENDAR_YEAR_HELPTEXT
|
||||||
|
post_cb = [](auto) { MarkWholeScreenDirty(); }
|
||||||
|
|
||||||
; For the dedicated build we'll enable dates in logs by default.
|
; For the dedicated build we'll enable dates in logs by default.
|
||||||
[SDTC_BOOL]
|
[SDTC_BOOL]
|
||||||
ifdef = DEDICATED
|
ifdef = DEDICATED
|
||||||
|
@@ -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.
|
* Adds this vehicle to a shared vehicle chain.
|
||||||
* @param shared_chain a vehicle of the chain with shared vehicles.
|
* @param shared_chain a vehicle of the chain with shared vehicles.
|
||||||
|
@@ -727,11 +727,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual Trackdir GetVehicleTrackdir() const { return INVALID_TRACKDIR; }
|
virtual Trackdir GetVehicleTrackdir() const { return INVALID_TRACKDIR; }
|
||||||
|
|
||||||
/**
|
Money GetDisplayRunningCost() const;
|
||||||
* Gets the running cost of a vehicle that can be sent into SetDParam for string processing.
|
|
||||||
* @return the vehicle's running cost
|
|
||||||
*/
|
|
||||||
Money GetDisplayRunningCost() const { return this->GetRunningCost() >> 8; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the profit vehicle had this year. It can be sent into SetDParam for string processing.
|
* Gets the profit vehicle had this year. It can be sent into SetDParam for string processing.
|
||||||
|
@@ -3106,7 +3106,7 @@ struct VehicleDetailsWindow : Window {
|
|||||||
{
|
{
|
||||||
if (EconTime::UsingWallclockUnits()) {
|
if (EconTime::UsingWallclockUnits()) {
|
||||||
return STR_VEHICLE_INFO_AGE_RUNNING_COST_PERIOD;
|
return STR_VEHICLE_INFO_AGE_RUNNING_COST_PERIOD;
|
||||||
} else if (DayLengthFactor() > 1) {
|
} else if (DayLengthFactor() > 1 && !_settings_client.gui.show_running_costs_calendar_year) {
|
||||||
return STR_VEHICLE_INFO_AGE_RUNNING_COST_ORIG_YR;
|
return STR_VEHICLE_INFO_AGE_RUNNING_COST_ORIG_YR;
|
||||||
} else {
|
} else {
|
||||||
return STR_VEHICLE_INFO_AGE_RUNNING_COST_YR;
|
return STR_VEHICLE_INFO_AGE_RUNNING_COST_YR;
|
||||||
|
Reference in New Issue
Block a user