Optimized deserialization
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user