diff options
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt index 4c1190800..1a6e78af5 100644 --- a/src/Entities/CMakeLists.txt +++ b/src/Entities/CMakeLists.txt @@ -59,5 +59,5 @@ SET (HDRS if(NOT MSVC) add_library(Entities ${SRCS} ${HDRS}) - target_link_libraries(Entities fmt::fmt WorldStorage) + target_link_libraries(Entities fmt::fmt WorldStorage SQLiteCpp) endif() diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index f82b23e6b..b38e987bd 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -28,6 +28,7 @@ #include "../Blocks/ChunkInterface.h" #include "../IniFile.h" +#include "../JsonUtils.h" #include "json/json.h" // 6000 ticks or 5 minutes @@ -2196,10 +2197,13 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) // Parse the JSON format: Json::Value root; - Json::Reader reader; - if (!reader.parse(buffer, root, false)) + AString ParseError; + if (!JsonUtils::ParseString(buffer, root, &ParseError)) { - LOGWARNING("Cannot parse player data in file \"%s\"", a_FileName.c_str()); + FLOGWARNING( + "Cannot parse player data in file \"{0}\":\n {1}", + a_FileName, ParseError + ); return false; } @@ -2369,9 +2373,7 @@ bool cPlayer::SaveToDisk() root["gamemode"] = static_cast<int>(eGameMode_NotSet); } - Json::StyledWriter writer; - std::string JsonData = writer.write(root); - + auto JsonData = JsonUtils::WriteStyledString(root); AString SourceFile = GetUUIDFileName(m_UUID); cFile f; |