diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-05-09 16:51:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 16:51:15 +0200 |
commit | e6634ed26c50e99f6ccd285235fe477cb4168b06 (patch) | |
tree | b533a69db545835a886bcd8c5b05609b4c830d11 /src/Entities | |
parent | Upgrade to C++17 [CI] (#4716) (diff) | |
download | cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.gz cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.bz2 cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.lz cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.xz cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.zst cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.zip |
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; |