Add client setting for whether to sync locale settings with server in multiplayer

pull/363/head
Jonathan G Rennison 2 years ago
parent 82dec9a78a
commit 26fb0940c6

@ -2370,6 +2370,9 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_IMPERIAL :Imperial (ft)
STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_METRIC :Metric (m)
STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_SI :SI (m)
STR_CONFIG_SETTING_SYNC_LOCALE_SETTINGS_NETWORK_SERVER :Sync localisation settings with server in multiplayer: {STRING2}
STR_CONFIG_SETTING_SYNC_LOCALE_SETTINGS_NETWORK_SERVER_HELPTEXT :When joining a multiplayer game as a network client, change the localisation settings to match the server
STR_CONFIG_SETTING_LOCALISATION :{ORANGE}Localisation
STR_CONFIG_SETTING_GRAPHICS :{ORANGE}Graphics
STR_CONFIG_SETTING_SOUND :{ORANGE}Sound

@ -4069,6 +4069,10 @@ bool AfterLoadGame()
if (_networking && !_network_server) {
SlProcessVENC();
if (!_settings_client.client_locale.sync_locale_network_server) {
_settings_game.locale = _settings_newgame.locale;
}
}
/* Show this message last to avoid covering up an error message if we bail out part way */

@ -1750,6 +1750,7 @@ static SettingsContainer &GetSettingsTree()
localisation->Add(new SettingEntry("locale.units_force"));
localisation->Add(new SettingEntry("locale.units_height"));
localisation->Add(new SettingEntry("gui.date_format_in_default_names"));
localisation->Add(new SettingEntry("client_locale.sync_locale_network_server"));
}
SettingsPage *graphics = main->Add(new SettingsPage(STR_CONFIG_SETTING_GRAPHICS));

@ -762,6 +762,11 @@ struct ScenarioSettings {
bool house_ignore_grf; ///< allow manually adding houses regardless of GRF restrictions
};
/** Settings related to currency/unit systems. */
struct ClientLocaleSettings {
bool sync_locale_network_server; ///< sync locale settings with network server
};
/** All settings together for the game. */
struct GameSettings {
DifficultySettings difficulty; ///< settings related to the difficulty
@ -785,6 +790,7 @@ struct GameSettings {
/** All settings that are only important for the local client. */
struct ClientSettings {
GUISettings gui; ///< settings related to the GUI
ClientLocaleSettings client_locale; ///< settings related to used currency/unit system in the client
NetworkSettings network; ///< settings related to the network
CompanySettings company; ///< default values for per-company settings
SoundSettings sound; ///< sound effect settings

@ -4101,6 +4101,14 @@ def = nullptr
post_cb = [](auto) { MarkWholeScreenDirty(); }
cat = SC_BASIC
[SDTC_BOOL]
var = client_locale.sync_locale_network_server
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = false
str = STR_CONFIG_SETTING_SYNC_LOCALE_SETTINGS_NETWORK_SERVER
strhelp = STR_CONFIG_SETTING_SYNC_LOCALE_SETTINGS_NETWORK_SERVER_HELPTEXT
cat = SC_BASIC
[SDT_BOOL]
var = vehicle.adjacent_crossings
def = true

Loading…
Cancel
Save