From fbfb752b1c145aab22a58f01addf9add9d613199 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 13 Aug 2024 01:17:04 +0100 Subject: [PATCH] Simplify texts and GUI behaviour for cargo scaling mode settings --- src/economy_type.h | 2 +- src/lang/extra/english.txt | 18 ++++------- src/lang/extra/galician.txt | 11 ------- src/lang/extra/korean.txt | 11 ------- src/lang/extra/russian.txt | 11 ------- src/saveload/afterload.cpp | 4 +-- src/script/api/script_gamesettings.cpp | 2 +- src/settings.cpp | 43 +++---------------------- src/table/settings/economy_settings.ini | 12 +++---- 9 files changed, 18 insertions(+), 96 deletions(-) diff --git a/src/economy_type.h b/src/economy_type.h index abced898bcc..6444429be25 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -258,7 +258,7 @@ enum TickRateMode : uint8_t { enum CargoScalingMode : uint8_t { CSM_BEGIN = 0, ///< Used for iterations and limit testing - CSM_MONTHLY = 0, ///< Traditional cargo scaling + CSM_NORMAL = 0, ///< Normal cargo scaling CSM_DAYLENGTH, ///< Also scale by day length CSM_END, ///< Used for iterations and limit testing }; diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index f89585912de..9c188e3c14c 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -590,21 +590,15 @@ STR_CONFIG_SETTING_ALLOW_TOWN_BRIDGES_HELPTEXT :Enabling this s STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT_EXTRA :{STRING}{}This excludes tree-cutting industries.{}This is not guaranteed to be fully compatible with all industry NewGRFs. -STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE :Time interval for town cargo production scaling: {STRING2} -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE :Time interval for industry cargo production scaling: {STRING2} +STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE :Town cargo production scaling mode: {STRING2} +STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE :Industry cargo production scaling mode: {STRING2} -STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT :Monthly/per production interval: The cargo production per month or production interval is scaled.{}{}Game-time: The cargo production per unit of game time is scaled, (the cargo production per month or production interval is also scaled by the economy speed reduction factor). Very high scaling factors may not be achievable. -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE_HELPTEXT_EXTRA :{STRING}{}Game-time mode is not guaranteed to be fully compatible with all industry NewGRFs. +STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT :The scaling factor for cargo production per month/production interval may optionally be multiplied by the economy speed reduction factor. -STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY :Monthly -STR_CONFIG_SETTING_CARGO_SCALE_MODE_GAME_TIME :Game-time +STR_CONFIG_SETTING_CARGO_SCALE_MODE_NORMAL :Normal +STR_CONFIG_SETTING_CARGO_SCALE_MODE_ECON_SPEED_REDUCTION_MULT :Multiply by economy speed reduction factor -STR_CONFIG_SETTING_CARGO_SCALE_MODE_PER_PRODUCTION_INTERVAL :Per production interval - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY :{NUM}% (monthly) -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME :{NUM}% (game-time) - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL :{NUM}% (per production interval) +STR_CONFIG_SETTING_CARGO_SCALE_VALUE_ECON_SPEED_REDUCTION_MULT :{NUM}% x economy speed reduction factor STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT :No towns above height level: {STRING2} STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT :No towns above the specified height level are built during map creation. diff --git a/src/lang/extra/galician.txt b/src/lang/extra/galician.txt index 813222aedff..cea3bee4995 100644 --- a/src/lang/extra/galician.txt +++ b/src/lang/extra/galician.txt @@ -547,17 +547,6 @@ STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE :Intervalo de te STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE :Intervalo de tempo para o escalado da produción de carga da industria: {STRING} STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT :Mensual: A produción de carga por mes é escalada.{}{}Tempo de xogo: A produción de carga por unidade de tempo de xogo é escalada (a produción de carga por mes tamén é escalada polo factor de lonxitude do día). Pode non ser posible alcanzar factores de escalado moi altos. -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE_HELPTEXT_EXTRA :{STRING}{}O modo de tempo de xogo non se garante que sexa totalmente compatible con todos os NewGRFs de industria. - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY :Mensualmente -STR_CONFIG_SETTING_CARGO_SCALE_MODE_GAME_TIME :Tempo de xogo - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_PER_PRODUCTION_INTERVAL :Por intervalo de produción - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY :{NUM}% (mensualmente) -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME :{NUM}% (tempo de xogo) - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL :{NUM}% (por intervalo de produción) STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT :Sen vilas por enriba da altitude: {STRING} STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT :Non se constrúen vilas por enriba da altitude especificada durante a creación do mapa. diff --git a/src/lang/extra/korean.txt b/src/lang/extra/korean.txt index d01299f18c2..faa1dc16b89 100644 --- a/src/lang/extra/korean.txt +++ b/src/lang/extra/korean.txt @@ -547,17 +547,6 @@ STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE :도시 화물 STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE :산업시설 화물 생성 조정에 적용할 시간 간격: {STRING} STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT :월별: 1개월당 화물 생산량이 조정됩니다.{}{}게임 시간: 게임 시간의 단위 당 화물 생산량이 조정됩니다. (또한 1개월당 화물 생산량은 1일의 길이 조절 설정에 의해 조정되기도 합니다.) 매우 높은 값은 적용되지 않을 수도 있습니다. -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE_HELPTEXT_EXTRA :{STRING}{}게임 시간 모드는 모든 산업시설 관련 NewGRF에 적용되지 않을 수도 있습니다. - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY :월별 -STR_CONFIG_SETTING_CARGO_SCALE_MODE_GAME_TIME :게임 시간 - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_PER_PRODUCTION_INTERVAL :생산기간 당 - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY :{NUM}% (월별) -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME :{NUM}% (게임 시간) - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL :{NUM}% (생산기간당) STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT :이 고도 위에는 도시를 생성하지 않음: {STRING} STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT :지도를 생성할 때 특정 고도 위에는 도시를 만들지 않도록 만듭니다. diff --git a/src/lang/extra/russian.txt b/src/lang/extra/russian.txt index d121cb93c4d..20bf79b6a6b 100644 --- a/src/lang/extra/russian.txt +++ b/src/lang/extra/russian.txt @@ -547,17 +547,6 @@ STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE :Временн STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE :Временной интервал для умножения производства грузов предприятиями: {STRING} STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT :Ежемесячно/каждый производственный интервал: производство груза за месяц или производственный интервал изменяется.{}{}Игровое время: производство груза за единицу игрового времени изменяется, (производство груза за месяц или производственный интервал также изменяется коэффициентом уменьшения скорости экономики). Очень высокие коэффициенты умножения могут быть недостижимы. -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE_HELPTEXT_EXTRA :{STRING}{}Не гарантируется, что режим игрового времени будет полностью совместим со всеми NewGRF предприятиями. - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY :Ежемесячно -STR_CONFIG_SETTING_CARGO_SCALE_MODE_GAME_TIME :Игровое время - -STR_CONFIG_SETTING_CARGO_SCALE_MODE_PER_PRODUCTION_INTERVAL :Каждый производственный интервал - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY :{NUM}% (ежемесячно) -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME :{NUM}% (игровое время) - -STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL :{NUM}% (каждый производственный интервал) STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT :Никаких городов выше уровня: {STRING} STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT :Во время создания карты не строятся города выше указанного уровня высоты. diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index e849ce2693d..9f309fbacda 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -4063,7 +4063,7 @@ bool AfterLoadGame() _settings_game.economy.town_cargo_scale = ScaleQuantity(100, _settings_game.old_economy.town_cargo_scale_factor); } if (!SlXvIsFeaturePresent(XSLFI_TOWN_CARGO_ADJ, 3)) { - _settings_game.economy.town_cargo_scale_mode = CSM_MONTHLY; + _settings_game.economy.town_cargo_scale_mode = CSM_NORMAL; } if (SlXvIsFeatureMissing(XSLFI_INDUSTRY_CARGO_ADJ)) { @@ -4072,7 +4072,7 @@ bool AfterLoadGame() _settings_game.economy.industry_cargo_scale = ScaleQuantity(100, _settings_game.old_economy.industry_cargo_scale_factor); } if (!SlXvIsFeaturePresent(XSLFI_INDUSTRY_CARGO_ADJ, 2)) { - _settings_game.economy.industry_cargo_scale_mode = CSM_MONTHLY; + _settings_game.economy.industry_cargo_scale_mode = CSM_NORMAL; } } diff --git a/src/script/api/script_gamesettings.cpp b/src/script/api/script_gamesettings.cpp index cd275e5966b..2b8a87e60d9 100644 --- a/src/script/api/script_gamesettings.cpp +++ b/src/script/api/script_gamesettings.cpp @@ -40,7 +40,7 @@ struct CargoScalingProxy { CargoScalingMode mode = this->is_industry ? _settings_game.economy.industry_cargo_scale_mode : _settings_game.economy.town_cargo_scale_mode; if (mode == CSM_DAYLENGTH) { /* Asynchronous free command, don't bother halting the script or saving the result */ - ::DoCommandPScript(0, 0, (uint32_t)CSM_MONTHLY, 0, CMD_CHANGE_SETTING, nullptr, + ::DoCommandPScript(0, 0, (uint32_t)CSM_NORMAL, 0, CMD_CHANGE_SETTING, nullptr, this->is_industry ? "economy.industry_cargo_scale_mode" : "economy.town_cargo_scale_mode", false, false, true, nullptr); } diff --git a/src/settings.cpp b/src/settings.cpp index 9d1a2957b74..543a2699b26 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2340,12 +2340,8 @@ static bool TownCargoScaleGUI(SettingOnGuiCtrlData &data) { switch (data.type) { case SOGCT_VALUE_DPARAMS: - if (GetGameSettings().economy.day_length_factor > 1) { - if (GetGameSettings().economy.town_cargo_scale_mode == CSM_DAYLENGTH) { - SetDParam(data.offset, STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME); - } else { - SetDParam(data.offset, EconTime::UsingWallclockUnits(_game_mode == GM_MENU) ? STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL : STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY); - } + if (GetGameSettings().economy.day_length_factor > 1 && GetGameSettings().economy.town_cargo_scale_mode == CSM_DAYLENGTH) { + SetDParam(data.offset, STR_CONFIG_SETTING_CARGO_SCALE_VALUE_ECON_SPEED_REDUCTION_MULT); } return true; @@ -2363,12 +2359,8 @@ static bool IndustryCargoScaleGUI(SettingOnGuiCtrlData &data) return true; case SOGCT_VALUE_DPARAMS: - if (GetGameSettings().economy.day_length_factor > 1) { - if (GetGameSettings().economy.industry_cargo_scale_mode == CSM_DAYLENGTH) { - SetDParam(data.offset, STR_CONFIG_SETTING_CARGO_SCALE_VALUE_REAL_TIME); - } else { - SetDParam(data.offset, EconTime::UsingWallclockUnits(_game_mode == GM_MENU) ? STR_CONFIG_SETTING_CARGO_SCALE_VALUE_PER_PRODUCTION_INTERVAL : STR_CONFIG_SETTING_CARGO_SCALE_VALUE_MONTHLY); - } + if (GetGameSettings().economy.day_length_factor > 1 && GetGameSettings().economy.industry_cargo_scale_mode == CSM_DAYLENGTH) { + SetDParam(data.offset, STR_CONFIG_SETTING_CARGO_SCALE_VALUE_ECON_SPEED_REDUCTION_MULT); } return true; @@ -2377,33 +2369,6 @@ static bool IndustryCargoScaleGUI(SettingOnGuiCtrlData &data) } } -static bool TownCargoScaleModeGUI(SettingOnGuiCtrlData &data) -{ - switch (data.type) { - case SOGCT_VALUE_DPARAMS: - if (data.text == STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY && EconTime::UsingWallclockUnits(_game_mode == GM_MENU)) { - data.text = STR_CONFIG_SETTING_CARGO_SCALE_MODE_PER_PRODUCTION_INTERVAL; - } - return true; - - default: - return false; - } -} - -static bool IndustryCargoScaleModeGUI(SettingOnGuiCtrlData &data) -{ - switch (data.type) { - case SOGCT_DESCRIPTION_TEXT: - SetDParam(0, data.text); - data.text = STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE_HELPTEXT_EXTRA; - return true; - - default: - return TownCargoScaleModeGUI(data); - } -} - static bool CalendarModeDisabledGUI(SettingOnGuiCtrlData &data) { switch (data.type) { diff --git a/src/table/settings/economy_settings.ini b/src/table/settings/economy_settings.ini index 59497540187..f6cd5649071 100644 --- a/src/table/settings/economy_settings.ini +++ b/src/table/settings/economy_settings.ini @@ -25,8 +25,6 @@ static void TownZoneCustomValueChanged(int32_t new_value); static bool OrderTownGrowthRate(SettingOnGuiCtrlData &data); static bool TownCargoScaleGUI(SettingOnGuiCtrlData &data); static bool IndustryCargoScaleGUI(SettingOnGuiCtrlData &data); -static bool TownCargoScaleModeGUI(SettingOnGuiCtrlData &data); -static bool IndustryCargoScaleModeGUI(SettingOnGuiCtrlData &data); static bool CalendarModeDisabledGUI(SettingOnGuiCtrlData &data); static bool WallclockModeDisabledGUI(SettingOnGuiCtrlData &data); @@ -794,31 +792,29 @@ guiproc = IndustryCargoScaleGUI var = economy.town_cargo_scale_mode type = SLE_UINT8 flags = SF_GUI_DROPDOWN | SF_PATCH -def = CSM_MONTHLY +def = CSM_NORMAL min = CSM_BEGIN max = CSM_END - 1 interval = 1 str = STR_CONFIG_SETTING_TOWN_CARGO_SCALE_MODE strhelp = STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT -strval = STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY +strval = STR_CONFIG_SETTING_CARGO_SCALE_MODE_NORMAL cat = SC_BASIC post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); UpdateCargoScalers(); } -guiproc = TownCargoScaleModeGUI [SDT_VAR] var = economy.industry_cargo_scale_mode type = SLE_UINT8 flags = SF_GUI_DROPDOWN | SF_PATCH -def = CSM_MONTHLY +def = CSM_NORMAL min = CSM_BEGIN max = CSM_END - 1 interval = 1 str = STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_MODE strhelp = STR_CONFIG_SETTING_CARGO_SCALE_MODE_HELPTEXT -strval = STR_CONFIG_SETTING_CARGO_SCALE_MODE_MONTHLY +strval = STR_CONFIG_SETTING_CARGO_SCALE_MODE_NORMAL cat = SC_BASIC post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); UpdateCargoScalers(); } -guiproc = IndustryCargoScaleModeGUI [SDT_VAR] var = economy.random_road_reconstruction