Store the gui.zoom_max setting under a different name in the config file

So that it isn't overwritten by vanilla.
Otherwise use the vanilla setting value if present and outside the
vanilla range.
pull/461/head
Jonathan G Rennison 1 year ago
parent b9e322ec7a
commit d776b302fa

@ -109,6 +109,8 @@ std::string _secrets_file; ///< Secrets configuration file of OpenTTD.
typedef std::list<ErrorMessageData> ErrorList;
static ErrorList _settings_error_list; ///< Errors while loading minimal settings.
static bool _fallback_gui_zoom_max = false;
/**
* List of all the generic setting tables.
@ -1851,6 +1853,24 @@ static bool AllowRoadStopsUnderBridgesSettingGUI(SettingOnGuiCtrlData &data)
}
}
static bool ZoomMaxCfgName(SettingOnGuiCtrlData &data)
{
switch (data.type) {
case SOGCT_CFG_NAME:
data.str = "gui.zoom_max_extra";
_fallback_gui_zoom_max = false;
return true;
case SOGCT_CFG_FALLBACK_NAME:
data.str = "zoom_max";
_fallback_gui_zoom_max = true;
return true;
default:
return false;
}
}
/* End - GUI callbacks */
/**
@ -2299,6 +2319,9 @@ void LoadFromConfig(bool startup)
if (FindWindowById(WC_ERRMSG, 0) == nullptr) ShowFirstError();
} else {
PostTransparencyOptionLoad();
if (_fallback_gui_zoom_max && _settings_client.gui.zoom_max <= ZOOM_LVL_OUT_32X) {
_settings_client.gui.zoom_max = ZOOM_LVL_MAX;
}
}
}

@ -86,6 +86,7 @@ static int64 LinkGraphDistModeXrefChillPP(int64 val);
static bool LinkGraphDistributionSettingGUI(SettingOnGuiCtrlData &data);
static bool OrderTownGrowthRate(SettingOnGuiCtrlData &data);
static bool AllowRoadStopsUnderBridgesSettingGUI(SettingOnGuiCtrlData &data);
static bool ZoomMaxCfgName(SettingOnGuiCtrlData &data);
/* End - GUI callbacks */
@ -4536,6 +4537,7 @@ str = STR_CONFIG_SETTING_ZOOM_MAX
strhelp = STR_CONFIG_SETTING_ZOOM_MAX_HELPTEXT
strval = STR_CONFIG_SETTING_ZOOM_LVL_OUT_2X
post_cb = ZoomMinMaxChanged
guiproc = ZoomMaxCfgName
startup = true
[SDTC_VAR]

Loading…
Cancel
Save