Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release-linux.yml # .github/workflows/release-macos.yml # .github/workflows/release-source.yml # .github/workflows/release.yml # CMakeLists.txt # COMPILING.md # src/ai/ai_core.cpp # src/ai/ai_gui.cpp # src/bridge_gui.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/core/CMakeLists.txt # src/core/smallmap_type.hpp # src/disaster_vehicle.h # src/effectvehicle_base.h # src/fontcache.cpp # src/game/game_core.cpp # src/game/game_gui.cpp # src/gamelog.cpp # src/gamelog_internal.h # src/group_gui.cpp # src/linkgraph/linkgraph.h # src/misc.cpp # src/network/core/config.h # src/network/core/udp.cpp # src/network/network_chat_gui.cpp # src/network/network_content_gui.cpp # src/network/network_gui.cpp # src/newgrf.cpp # src/newgrf_gui.cpp # src/newgrf_profiling.cpp # src/newgrf_profiling.h # src/object_gui.cpp # src/openttd.cpp # src/openttd.h # src/order_gui.cpp # src/os/windows/font_win32.cpp # src/rail_gui.cpp # src/road.cpp # src/road_gui.cpp # src/saveload/afterload.cpp # src/saveload/saveload.h # src/script/api/script_controller.cpp # src/script/api/script_roadtypelist.cpp # src/script/script_config.cpp # src/script/script_config.hpp # src/script/script_instance.cpp # src/script/script_scanner.cpp # src/script/squirrel.cpp # src/script/squirrel_helper.hpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_type.h # src/table/settings/network_private_settings.ini # src/timetable_gui.cpp # src/vehicle.cpp # src/vehicle_base.h # src/window_gui.h
This commit is contained in:
@@ -126,6 +126,19 @@ static const SettingTable _generic_setting_tables[] = {
|
||||
_network_settings,
|
||||
};
|
||||
|
||||
void IterateSettingsTables(std::function<void(const SettingTable &, void *)> handler)
|
||||
{
|
||||
handler(_misc_settings, nullptr);
|
||||
#if defined(_WIN32) && !defined(DEDICATED)
|
||||
handler(_win32_settings, nullptr);
|
||||
#endif
|
||||
for (auto &table : _generic_setting_tables) {
|
||||
handler(table, &_settings_game);
|
||||
}
|
||||
handler(_currency_settings, &_custom_currency);
|
||||
handler(_company_settings, &_settings_client.company);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of all the private setting tables.
|
||||
*/
|
||||
@@ -1974,7 +1987,7 @@ static void AILoadConfig(IniFile &ini, const char *grpname)
|
||||
|
||||
/* Clean any configured AI */
|
||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
||||
AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME)->Change(nullptr);
|
||||
AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME)->Change(std::nullopt);
|
||||
}
|
||||
|
||||
/* If no group exists, return */
|
||||
@@ -1984,7 +1997,7 @@ static void AILoadConfig(IniFile &ini, const char *grpname)
|
||||
for (item = group->item; c < MAX_COMPANIES && item != nullptr; c++, item = item->next) {
|
||||
AIConfig *config = AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME);
|
||||
|
||||
config->Change(item->name.c_str());
|
||||
config->Change(item->name);
|
||||
if (!config->HasScript()) {
|
||||
if (item->name != "none") {
|
||||
DEBUG(script, 0, "The AI by the name '%s' was no longer found, and removed from the list.", item->name.c_str());
|
||||
@@ -2001,7 +2014,7 @@ static void GameLoadConfig(IniFile &ini, const char *grpname)
|
||||
IniItem *item;
|
||||
|
||||
/* Clean any configured GameScript */
|
||||
GameConfig::GetConfig(GameConfig::SSS_FORCE_NEWGAME)->Change(nullptr);
|
||||
GameConfig::GetConfig(GameConfig::SSS_FORCE_NEWGAME)->Change(std::nullopt);
|
||||
|
||||
/* If no group exists, return */
|
||||
if (group == nullptr) return;
|
||||
@@ -2011,7 +2024,7 @@ static void GameLoadConfig(IniFile &ini, const char *grpname)
|
||||
|
||||
GameConfig *config = GameConfig::GetConfig(AIConfig::SSS_FORCE_NEWGAME);
|
||||
|
||||
config->Change(item->name.c_str());
|
||||
config->Change(item->name);
|
||||
if (!config->HasScript()) {
|
||||
if (item->name != "none") {
|
||||
DEBUG(script, 0, "The GameScript by the name '%s' was no longer found, and removed from the list.", item->name.c_str());
|
||||
@@ -2185,7 +2198,7 @@ static void AISaveConfig(IniFile &ini, const char *grpname)
|
||||
|
||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
||||
AIConfig *config = AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME);
|
||||
const char *name;
|
||||
std::string name;
|
||||
std::string value = config->SettingsToString();
|
||||
|
||||
if (config->HasScript()) {
|
||||
@@ -2207,7 +2220,7 @@ static void GameSaveConfig(IniFile &ini, const char *grpname)
|
||||
group->Clear();
|
||||
|
||||
GameConfig *config = GameConfig::GetConfig(AIConfig::SSS_FORCE_NEWGAME);
|
||||
const char *name;
|
||||
std::string name;
|
||||
std::string value = config->SettingsToString();
|
||||
|
||||
if (config->HasScript()) {
|
||||
|
Reference in New Issue
Block a user