summaryrefslogtreecommitdiff
path: root/ZAPD/ZFile.cpp
diff options
context:
space:
mode:
authorEllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>2021-10-11 21:05:36 +0100
committerGitHub <noreply@github.com>2021-10-11 16:05:36 -0400
commit3e9ed72e202b1165152d42f7d160695f9f2f233a (patch)
tree6bee7b0772be9c591f076815850e7f52fc255b4b /ZAPD/ZFile.cpp
parent1c687a69c1f6b84a3fea1bcab8e141f8a26e16dc (diff)
Divide ReadConfigFile into separate functions and move them and the rest of GameConfig to their own file (#168)
* Working as a separate file * Actually use classes * Remove init, use invoke * Change configFilePath to a member of GameConfig * Remove commented stuff, format * Fix invoke, maybe? And lighten up the includes * string_view * Remove unnecessary std::string initialisations * Rest of Leo's review * Format * Merge remote-tracking branch 'upstream/master' into config * Fix merge breakages
Diffstat (limited to 'ZAPD/ZFile.cpp')
-rw-r--r--ZAPD/ZFile.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp
index 6e02ea4..2245168 100644
--- a/ZAPD/ZFile.cpp
+++ b/ZAPD/ZFile.cpp
@@ -2,6 +2,7 @@
#include <algorithm>
#include <cassert>
+#include <string_view>
#include <unordered_set>
#include <Utils/BinaryWriter.h>
@@ -89,11 +90,11 @@ void ZFile::ParseXML(ZFileMode mode, tinyxml2::XMLElement* reader, const std::st
const char* gameStr = reader->Attribute("Game");
if (reader->Attribute("Game") != nullptr)
{
- if (std::string(gameStr) == "MM")
+ if (std::string_view(gameStr) == "MM")
Globals::Instance->game = ZGame::MM_RETAIL;
- else if (std::string(gameStr) == "SW97" || std::string(gameStr) == "OOTSW97")
+ else if (std::string_view(gameStr) == "SW97" || std::string_view(gameStr) == "OOTSW97")
Globals::Instance->game = ZGame::OOT_SW97;
- else if (std::string(gameStr) == "OOT")
+ else if (std::string_view(gameStr) == "OOT")
Globals::Instance->game = ZGame::OOT_RETAIL;
else
throw std::runtime_error(
@@ -213,7 +214,7 @@ void ZFile::ParseXML(ZFileMode mode, tinyxml2::XMLElement* reader, const std::st
rawDataIndex += nRes->GetRawDataSize();
}
- else if (std::string(child->Name()) == "File")
+ else if (std::string_view(child->Name()) == "File")
{
throw std::runtime_error(StringHelper::Sprintf(
"ZFile::ParseXML: Error in '%s'.\n\t Can't declare a File inside a File.\n",