Add: Setting to disable warning for old vehicles (#12714)

This commit is contained in:
merni-ns 2024-06-16 02:44:29 +05:30 committed by GitHub
parent 45d1f9aa80
commit 0409577277
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 0 deletions

View File

@ -1488,6 +1488,9 @@ STR_CONFIG_SETTING_WARN_INCOME_LESS :Warn if a vehic
STR_CONFIG_SETTING_WARN_INCOME_LESS_HELPTEXT :When enabled, a news message gets sent when a vehicle has not made any profit within a year
STR_CONFIG_SETTING_WARN_INCOME_LESS_HELPTEXT_PERIOD :When enabled, a news message gets sent when a vehicle has not made any profit within a period
STR_CONFIG_SETTING_WARN_OLD_VEHICLE :Warn if a vehicle is getting old: {STRING2}
STR_CONFIG_SETTING_WARN_OLD_VEHICLE_HELPTEXT :When enabled, a news message gets sent when a vehicle is getting old
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :Vehicles never expire: {STRING2}
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :When enabled, all vehicle models remain available forever after their introduction

View File

@ -2074,6 +2074,7 @@ static SettingsContainer &GetSettingsTree()
advisors->Add(new SettingEntry("gui.order_review_system"));
advisors->Add(new SettingEntry("gui.vehicle_income_warn"));
advisors->Add(new SettingEntry("gui.lost_vehicle_warn"));
advisors->Add(new SettingEntry("gui.old_vehicle_warn"));
advisors->Add(new SettingEntry("gui.show_finances"));
advisors->Add(new SettingEntry("news_display.economy"));
advisors->Add(new SettingEntry("news_display.subsidies"));

View File

@ -132,6 +132,7 @@ struct GUISettings {
bool lost_vehicle_warn; ///< if a vehicle can't find its destination, show a warning
uint8_t order_review_system; ///< perform order reviews on vehicles
bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning
bool old_vehicle_warn; ///< if a vehicle is getting old, show a warning
bool show_finances; ///< show finances at end of year
bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames
bool new_nonstop; ///< ttdpatch compatible nonstop handling

View File

@ -591,6 +591,13 @@ def = true
str = STR_CONFIG_SETTING_WARN_LOST_VEHICLE
strhelp = STR_CONFIG_SETTING_WARN_LOST_VEHICLE_HELPTEXT
[SDTC_BOOL]
var = gui.old_vehicle_warn
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = true
str = STR_CONFIG_SETTING_WARN_OLD_VEHICLE
strhelp = STR_CONFIG_SETTING_WARN_OLD_VEHICLE_HELPTEXT
[SDTC_BOOL]
var = gui.new_nonstop
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC

View File

@ -1454,6 +1454,9 @@ void AgeVehicle(Vehicle *v)
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
/* Don't warn if warnings are disabled */
if (!_settings_client.gui.old_vehicle_warn) return;
/* Don't warn about vehicles which are non-primary (e.g., part of an articulated vehicle), don't belong to us, are crashed, or are stopped */
if (v->Previous() != nullptr || v->owner != _local_company || (v->vehstatus & VS_CRASHED) != 0 || (v->vehstatus & VS_STOPPED) != 0) return;