diff --git a/src/lang/english.txt b/src/lang/english.txt --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1309,7 +1309,9 @@ STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :Set how much is paid for subsidised connections STR_CONFIG_SETTING_SUBSIDY_DURATION :Subsidy duration: {STRING2} -STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT :Set the number of {TKM years periods} for which a subsidy is awarded +###length 2 +STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT :Set the number of years for which a subsidy is awarded +STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT_PERIODS :Set the number of periods for which a subsidy is awarded STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE :{UNITS_YEARS_OR_PERIODS} ###setting-zero-is-special @@ -1407,8 +1409,13 @@ STR_CONFIG_SETTING_SIGNALSIDE_LEFT STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE :On the driving side STR_CONFIG_SETTING_SIGNALSIDE_RIGHT :On the right -STR_CONFIG_SETTING_SHOWFINANCES :Show finances window at the end of the {TKM year period}: {STRING2} -STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :If enabled, the finances window pops up at the end of each {TKM year period} to allow easy inspection of the financial status of the company +###length 2 +STR_CONFIG_SETTING_SHOWFINANCES :Show finances window at the end of the year: {STRING2} +STR_CONFIG_SETTING_SHOWFINANCES_PERIOD :Show finances window at the end of the period: {STRING2} + +###length 2 +STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :If enabled, the finances window pops up at the end of each year to allow easy inspection of the financial status of the company +STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT_PERIOD :If enabled, the finances window pops up at the end of each period to allow easy inspection of the financial status of the company STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :New orders are 'non-stop' by default: {STRING2} STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :Normally, a vehicle will stop at every station it passes. By enabling this setting, it will drive through all station on the way to its final destination without stopping. Note, that this setting only defines a default value for new orders. Individual orders can be set explicitly to either behaviour nevertheless @@ -1429,10 +1436,14 @@ STR_CONFIG_SETTING_AUTOSCROLL_MAIN_VIEWP STR_CONFIG_SETTING_AUTOSCROLL_EVERY_VIEWPORT :Every viewport STR_CONFIG_SETTING_BRIBE :Allow bribing of the local authority: {STRING2} -STR_CONFIG_SETTING_BRIBE_HELPTEXT :Allow companies to try bribing the local town authority. If the bribe is noticed by an inspector, the company will not be able to act in the town for six {TKM months minutes} +###length 2 +STR_CONFIG_SETTING_BRIBE_HELPTEXT :Allow companies to try bribing the local town authority. If the bribe is noticed by an inspector, the company will not be able to act in the town for six months +STR_CONFIG_SETTING_BRIBE_HELPTEXT_MINUTES :Allow companies to try bribing the local town authority. If the bribe is noticed by an inspector, the company will not be able to act in the town for six minutes STR_CONFIG_SETTING_ALLOW_EXCLUSIVE :Allow buying exclusive transport rights: {STRING2} -STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT :If a company buys exclusive transport rights for a town, opponents' stations (passenger and cargo) won't receive any cargo for twelve {TKM months minutes} +###length 2 +STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT :If a company buys exclusive transport rights for a town, opponents' stations (passenger and cargo) won't receive any cargo for twelve months +STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT_MINUTES :If a company buys exclusive transport rights for a town, opponents' stations (passenger and cargo) won't receive any cargo for twelve minutes STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS :Allow funding buildings: {STRING2} STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT :Allow companies to give money to towns for funding new houses @@ -1489,7 +1500,9 @@ STR_CONFIG_SETTING_ORDER_REVIEW_EXDEPOT STR_CONFIG_SETTING_ORDER_REVIEW_ON :Of all vehicles STR_CONFIG_SETTING_WARN_INCOME_LESS :Warn if a vehicle's income is negative: {STRING2} -STR_CONFIG_SETTING_WARN_INCOME_LESS_HELPTEXT :When enabled, a news message gets sent when a vehicle has not made any profit within a {TKM year period} +###length 2 +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_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 @@ -1759,8 +1772,13 @@ STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT STR_CONFIG_SETTING_SOUND_NEWS :Newspaper: {STRING2} STR_CONFIG_SETTING_SOUND_NEWS_HELPTEXT :Play sound upon display of newspapers -STR_CONFIG_SETTING_SOUND_NEW_YEAR :End of {TKM year period}: {STRING2} -STR_CONFIG_SETTING_SOUND_NEW_YEAR_HELPTEXT :Play sound at the end of a {TKM year period} summarising the company's performance during the {TKM year period} compared to the previous {TKM year period} +###length 2 +STR_CONFIG_SETTING_SOUND_NEW_YEAR :End of year: {STRING2} +STR_CONFIG_SETTING_SOUND_NEW_PERIOD :End of period: {STRING2} + +###length 2 +STR_CONFIG_SETTING_SOUND_NEW_YEAR_HELPTEXT :Play sound at the end of a year summarising the company's performance during the year compared to the previous year +STR_CONFIG_SETTING_SOUND_NEW_PERIOD_HELPTEXT :Play sound at the end of a period summarising the company's performance during the period compared to the previous period STR_CONFIG_SETTING_SOUND_CONFIRM :Construction: {STRING2} STR_CONFIG_SETTING_SOUND_CONFIRM_HELPTEXT :Play sound on successful constructions or other actions @@ -2058,11 +2076,11 @@ STR_CONFIG_SETTING_SHORT_PATH_SATURATION STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Speed units (land): {STRING2} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Speed units (nautical): {STRING2} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Whenever a speed is shown in the user interface, show it in the selected units -###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperial (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metric (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Game units ({TKM "tiles/day" "tiles/sec"}) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_DAYS :Game units (tiles/day) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_SECS :Game units (tiles/sec) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Knots STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Vehicle power units: {STRING2} diff --git a/src/settings_table.cpp b/src/settings_table.cpp --- a/src/settings_table.cpp +++ b/src/settings_table.cpp @@ -81,6 +81,33 @@ SettingTable _win32_settings{ _win32_set /* Begin - Callback Functions for the various settings. */ +/** Switch setting title depending on wallclock setting */ +static StringID SettingTitleWallclock(const IntSettingDesc &sd) +{ + return TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? sd.str + 1 : sd.str; +} + +/** Switch setting help depending on wallclock setting */ +static StringID SettingHelpWallclock(const IntSettingDesc &sd) +{ + return TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? sd.str_help + 1 : sd.str_help; +} + +/** Setting values for velocity unit localisation */ +static void SettingsValueVelocityUnit(const IntSettingDesc &, uint first_param, int32_t value) +{ + StringID val; + switch (value) { + case 0: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL; break; + case 1: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC; break; + case 2: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI; break; + case 3: val = TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU) ? STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_SECS : STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_DAYS; break; + case 4: val = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS; break; + default: NOT_REACHED(); + } + SetDParam(first_param, val); +} + /** Reposition the main toolbar as the setting changed. */ static void v_PositionMainToolbar(int32_t) { diff --git a/src/table/settings.h.preamble b/src/table/settings.h.preamble --- a/src/table/settings.h.preamble +++ b/src/table/settings.h.preamble @@ -10,6 +10,8 @@ /* Callback function used in _settings[] as well as _company_settings[] */ static size_t ConvertLandscape(const char *value); +static StringID SettingTitleWallclock(const IntSettingDesc &sd); +static StringID SettingHelpWallclock(const IntSettingDesc &sd); /**************************** * OTTD specific INI stuff diff --git a/src/table/settings/difficulty_settings.ini b/src/table/settings/difficulty_settings.ini --- a/src/table/settings/difficulty_settings.ini +++ b/src/table/settings/difficulty_settings.ini @@ -207,6 +207,7 @@ max = 5000 interval = 1 str = STR_CONFIG_SETTING_SUBSIDY_DURATION strhelp = STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT +help_cb = SettingHelpWallclock strval = STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE [SDT_VAR] diff --git a/src/table/settings/economy_settings.ini b/src/table/settings/economy_settings.ini --- a/src/table/settings/economy_settings.ini +++ b/src/table/settings/economy_settings.ini @@ -128,6 +128,7 @@ var = economy.bribe def = true str = STR_CONFIG_SETTING_BRIBE strhelp = STR_CONFIG_SETTING_BRIBE_HELPTEXT +help_cb = SettingHelpWallclock post_cb = [](auto) { InvalidateWindowClassesData(WC_TOWN_AUTHORITY); } cat = SC_BASIC @@ -137,6 +138,7 @@ from = SLV_79 def = true str = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE strhelp = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT +help_cb = SettingHelpWallclock post_cb = [](auto) { InvalidateWindowClassesData(WC_TOWN_AUTHORITY); } cat = SC_BASIC diff --git a/src/table/settings/gui_settings.ini b/src/table/settings/gui_settings.ini --- a/src/table/settings/gui_settings.ini +++ b/src/table/settings/gui_settings.ini @@ -82,7 +82,9 @@ var = gui.show_finances flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC def = true str = STR_CONFIG_SETTING_SHOWFINANCES +str_cb = SettingTitleWallclock strhelp = STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT +help_cb = SettingHelpWallclock cat = SC_BASIC [SDTC_VAR] @@ -566,6 +568,7 @@ flags = SF_NOT_IN_SAVE | SF_NO_NETWOR def = true str = STR_CONFIG_SETTING_WARN_INCOME_LESS strhelp = STR_CONFIG_SETTING_WARN_INCOME_LESS_HELPTEXT +help_cb = SettingHelpWallclock cat = SC_BASIC [SDTC_VAR] diff --git a/src/table/settings/locale_settings.ini b/src/table/settings/locale_settings.ini --- a/src/table/settings/locale_settings.ini +++ b/src/table/settings/locale_settings.ini @@ -8,6 +8,8 @@ ; in the savegame PATS chunk. These settings are not sync'd over the network. [pre-amble] +static void SettingsValueVelocityUnit(const IntSettingDesc &sd, uint first_param, int32_t value); + uint8_t _old_units; ///< Old units from old savegames static constexpr std::initializer_list _locale_currencies{"GBP", "USD", "EUR", "JPY", "ATS", "BEF", "CHF", "CZK", "DEM", "DKK", "ESP", "FIM", "FRF", "GRD", "HUF", "ISK", "ITL", "NLG", "NOK", "PLN", "RON", "RUR", "SIT", "SEK", "TRY", "SKK", "BRL", "EEK", "LTL", "KRW", "ZAR", "custom", "GEL", "IRR", "RUB", "MXN", "NTD", "CNY", "HKD", "INR", "IDR", "MYR", "LVL"}; @@ -82,7 +84,7 @@ post_cb = [](auto) { MarkWholeScreenDir cat = SC_BASIC str = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY strhelp = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT -strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL +val_cb = SettingsValueVelocityUnit [SDT_OMANY] var = locale.units_velocity_nautical @@ -96,7 +98,7 @@ post_cb = [](auto) { MarkWholeScreenDir cat = SC_BASIC str = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL strhelp = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT -strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL +val_cb = SettingsValueVelocityUnit [SDT_OMANY] var = locale.units_power diff --git a/src/table/settings/multimedia_settings.ini b/src/table/settings/multimedia_settings.ini --- a/src/table/settings/multimedia_settings.ini +++ b/src/table/settings/multimedia_settings.ini @@ -57,7 +57,9 @@ var = sound.new_year flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC def = true str = STR_CONFIG_SETTING_SOUND_NEW_YEAR +str_cb = SettingTitleWallclock strhelp = STR_CONFIG_SETTING_SOUND_NEW_YEAR_HELPTEXT +help_cb = SettingHelpWallclock [SDTC_BOOL] var = sound.confirm