diff options
| author | louist103 <35883445+louist103@users.noreply.github.com> | 2022-12-05 23:19:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-05 23:19:25 -0500 |
| commit | a80f36ca0f003a3901fc781505f707ca2ef4c63a (patch) | |
| tree | 2b9cec4c873c194ada5449f276a18bf0090483be /ZAPD/GameConfig.cpp | |
| parent | 645444f209bfeca025b3862548a59d31ef9bca08 (diff) | |
Read from an external file for entrance lists (#271)
* Read from entrance list file
* Remove switch.
* Add check for special entrances.
* Ignore warning for GCC in specific spot.
* u
Diffstat (limited to 'ZAPD/GameConfig.cpp')
| -rw-r--r-- | ZAPD/GameConfig.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp index ae29ba2..777cf9d 100644 --- a/ZAPD/GameConfig.cpp +++ b/ZAPD/GameConfig.cpp @@ -94,6 +94,26 @@ void GameConfig::ConfigFunc_ObjectList(const tinyxml2::XMLElement& element) objectList.emplace_back(std::move(line)); } +void GameConfig::ConfigFunc_EntranceList(const tinyxml2::XMLElement& element) +{ + std::string fileName = element.Attribute("File"); + std::vector<std::string> lines = + File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); + + for (auto& line : lines) + entranceList.emplace_back(std::move(line)); +} + +void GameConfig::ConfigFunc_specialEntranceList(const tinyxml2::XMLElement& element) +{ + std::string fileName = element.Attribute("File"); + std::vector<std::string> lines = + File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); + + for (auto& line : lines) + specialEntranceList.emplace_back(std::move(line)); +} + void GameConfig::ConfigFunc_TexturePool(const tinyxml2::XMLElement& element) { std::string fileName = element.Attribute("File"); @@ -145,10 +165,12 @@ void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element) void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath) { - static const std::map<std::string, ConfigFunc> ConfigFuncDictionary = { + static const std::unordered_map<std::string, ConfigFunc> ConfigFuncDictionary = { {"SymbolMap", &GameConfig::ConfigFunc_SymbolMap}, {"ActorList", &GameConfig::ConfigFunc_ActorList}, {"ObjectList", &GameConfig::ConfigFunc_ObjectList}, + {"EntranceList", &GameConfig::ConfigFunc_EntranceList}, + {"SpecialEntranceList", &GameConfig::ConfigFunc_specialEntranceList}, {"TexturePool", &GameConfig::ConfigFunc_TexturePool}, {"BGConfig", &GameConfig::ConfigFunc_BGConfig}, {"ExternalXMLFolder", &GameConfig::ConfigFunc_ExternalXMLFolder}, |
