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/Player.cpp | |
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/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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; |