Optimized deserialization

This commit is contained in:
Antoine Pilote
2023-08-03 18:56:30 -04:00
parent df24ab3259
commit a5ee88cb8e
52 changed files with 82 additions and 127 deletions

View File

@@ -103,10 +103,8 @@ namespace Nuake
END_SERIALIZE();
}
bool Project::Deserialize(const std::string& str)
bool Project::Deserialize(const json& j)
{
BEGIN_DESERIALIZE();
if (!j.contains("Name") || !j.contains("Description"))
return false;
@@ -118,7 +116,7 @@ namespace Nuake
std::string path = j["EntityDefinition"];
EntityDefinitionsFile = CreateRef<FGDFile>(path);
std::string content = FileSystem::ReadFile(path, false);
EntityDefinitionsFile->Deserialize(content);
EntityDefinitionsFile->Deserialize(nlohmann::json::parse(content));
}
if (j.contains("TrenchbroomPath"))
@@ -140,7 +138,7 @@ namespace Nuake
return true;
std::string sceneContent = FileSystem::ReadFile(scenePath, false);
if (!DefaultScene->Deserialize(sceneContent))
if (!DefaultScene->Deserialize(nlohmann::json::parse(sceneContent)))
{
Logger::Log("Error loading scene: " + scenePath, "project", CRITICAL);
}