MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GameLoadConfig

Function GameLoadConfig

src/settings.cpp:980–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978}
979
980static void GameLoadConfig(const IniFile &ini, std::string_view grpname)
981{
982 const IniGroup *group = ini.GetGroup(grpname);
983
984 /* Clean any configured GameScript */
985 GameConfig::GetConfig(GameConfig::SSS_FORCE_NEWGAME)->Change(std::nullopt);
986
987 /* If no group exists, return */
988 if (group == nullptr || group->items.empty()) return;
989
990 const IniItem &item = group->items.front();
991
992 GameConfig *config = GameConfig::GetConfig(AIConfig::SSS_FORCE_NEWGAME);
993
994 config->Change(item.name);
995 if (!config->HasScript()) {
996 if (item.name != "none") {
997 Debug(script, 0, "The GameScript by the name '{}' was no longer found, and removed from the list.", item.name);
998 return;
999 }
1000 }
1001 if (item.value.has_value()) config->StringToSettings(*item.value);
1002}
1003
1004/**
1005 * Load BaseGraphics set selection and configuration.

Callers 1

LoadFromConfigFunction · 0.85

Calls 6

GetConfigFunction · 0.85
GetGroupMethod · 0.80
StringToSettingsMethod · 0.80
ChangeMethod · 0.45
emptyMethod · 0.45
HasScriptMethod · 0.45

Tested by

no test coverage detected