Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release-linux.yml # src/aircraft_cmd.cpp # src/airport_gui.cpp # src/articulated_vehicles.cpp # src/build_vehicle_gui.cpp # src/company_gui.cpp # src/genworld_gui.cpp # src/gfx_layout.cpp # src/misc_gui.cpp # src/newgrf.cpp # src/newgrf_config.h # src/newgrf_engine.cpp # src/news_gui.cpp # src/order_gui.cpp # src/roadveh_cmd.cpp # src/saveload/saveload.h # src/saveload/vehicle_sl.cpp # src/ship_cmd.cpp # src/statusbar_gui.cpp # src/table/settings/network_private_settings.ini # src/table/settings/network_settings.ini # src/toolbar_gui.cpp # src/train_cmd.cpp # src/vehicle_gui.cpp
This commit is contained in:
@@ -175,10 +175,11 @@ public:
|
||||
* location. These versions assist with situations like that.
|
||||
*/
|
||||
enum IniFileVersion : uint32 {
|
||||
IFV_0, ///< 0 All versions prior to introduction.
|
||||
IFV_PRIVATE_SECRETS, ///< 1 PR#9298 Moving of settings from openttd.cfg to private.cfg / secrets.cfg.
|
||||
IFV_GAME_TYPE, ///< 2 PR#9515 Convert server_advertise to server_game_type.
|
||||
IFV_LINKGRAPH_SECONDS, ///< 3 PR#10610 Store linkgraph update intervals in seconds instead of days.
|
||||
IFV_0, ///< 0 All versions prior to introduction.
|
||||
IFV_PRIVATE_SECRETS, ///< 1 PR#9298 Moving of settings from openttd.cfg to private.cfg / secrets.cfg.
|
||||
IFV_GAME_TYPE, ///< 2 PR#9515 Convert server_advertise to server_game_type.
|
||||
IFV_LINKGRAPH_SECONDS, ///< 3 PR#10610 Store linkgraph update intervals in seconds instead of days.
|
||||
IFV_NETWORK_PRIVATE_SETTINGS, ///< 4 PR#10762 Move no_http_content_downloads / use_relay_service to private settings.
|
||||
|
||||
IFV_MAX_VERSION, ///< Highest possible ini-file version.
|
||||
};
|
||||
@@ -2227,7 +2228,7 @@ static void GRFSaveConfig(IniFile &ini, const char *grpname, const GRFConfig *li
|
||||
|
||||
char *pos = key + seprintf(key, lastof(key), "%08X|", BSWAP32(c->ident.grfid));
|
||||
pos = md5sumToString(pos, lastof(key), c->ident.md5sum);
|
||||
seprintf(pos, lastof(key), "|%s", c->filename);
|
||||
seprintf(pos, lastof(key), "|%s", c->filename.c_str());
|
||||
group->GetItem(key, true)->SetValue(params);
|
||||
}
|
||||
}
|
||||
@@ -2329,6 +2330,31 @@ void LoadFromConfig(bool startup)
|
||||
_settings_newgame.linkgraph.recalc_time *= SECONDS_PER_DAY;
|
||||
}
|
||||
|
||||
if (generic_version < IFV_NETWORK_PRIVATE_SETTINGS) {
|
||||
IniGroup *network = generic_ini.GetGroup("network", false);
|
||||
if (network != nullptr) {
|
||||
IniItem *no_http_content_downloads = network->GetItem("no_http_content_downloads", false);
|
||||
if (no_http_content_downloads != nullptr) {
|
||||
if (no_http_content_downloads->value == "true") {
|
||||
_settings_client.network.no_http_content_downloads = true;
|
||||
} else if (no_http_content_downloads->value == "false") {
|
||||
_settings_client.network.no_http_content_downloads = false;
|
||||
}
|
||||
}
|
||||
|
||||
IniItem *use_relay_service = network->GetItem("use_relay_service", false);
|
||||
if (use_relay_service != nullptr) {
|
||||
if (use_relay_service->value == "never") {
|
||||
_settings_client.network.use_relay_service = UseRelayService::URS_NEVER;
|
||||
} else if (use_relay_service->value == "ask") {
|
||||
_settings_client.network.use_relay_service = UseRelayService::URS_ASK;
|
||||
} else if (use_relay_service->value == "allow") {
|
||||
_settings_client.network.use_relay_service = UseRelayService::URS_ALLOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_grfconfig_newgame = GRFLoadConfig(generic_ini, "newgrf", false);
|
||||
_grfconfig_static = GRFLoadConfig(generic_ini, "newgrf-static", true);
|
||||
AILoadConfig(generic_ini, "ai_players");
|
||||
@@ -2399,6 +2425,13 @@ void SaveToConfig()
|
||||
network->RemoveItem("server_advertise");
|
||||
}
|
||||
}
|
||||
if (generic_version < IFV_NETWORK_PRIVATE_SETTINGS) {
|
||||
IniGroup *network = generic_ini.GetGroup("network", false);
|
||||
if (network != nullptr) {
|
||||
network->RemoveItem("no_http_content_downloads");
|
||||
network->RemoveItem("use_relay_service");
|
||||
}
|
||||
}
|
||||
|
||||
HandleSettingDescs(generic_ini, private_ini, secrets_ini, IniSaveSettings, IniSaveSettingList);
|
||||
GRFSaveConfig(generic_ini, "newgrf", _grfconfig_newgame);
|
||||
|
Reference in New Issue
Block a user