From 7d0813ce8c1be14bc1b9b706644bd4aa797244ee Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Wed, 12 Aug 2020 09:54:36 +0100 Subject: Add Statistics and Achievements for newer Network standards --- src/WorldStorage/StatSerializer.h | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'src/WorldStorage/StatSerializer.h') diff --git a/src/WorldStorage/StatSerializer.h b/src/WorldStorage/StatSerializer.h index 8e8e4ffdb..e6a5bd325 100644 --- a/src/WorldStorage/StatSerializer.h +++ b/src/WorldStorage/StatSerializer.h @@ -9,14 +9,14 @@ #pragma once -#include "json/json.h" - // fwd: class cStatManager; +namespace Json { class Value; } + @@ -25,32 +25,21 @@ class cStatSerializer { public: - cStatSerializer(const AString & a_WorldName, const AString & a_PlayerName, const AString & a_FileName, cStatManager * a_Manager); + cStatSerializer(cStatManager & a_Manager, const AString & a_WorldName, const AString & a_FileName); - /* Try to load the player statistics. Returns whether the operation was successful or not. */ - bool Load(void); + /* Try to load the player statistics. */ + void Load(void); - /* Try to save the player statistics. Returns whether the operation was successful or not. */ - bool Save(void); + /* Try to save the player statistics. */ + void Save(void); - -protected: +private: void SaveStatToJSON(Json::Value & a_Out); - bool LoadStatFromJSON(const Json::Value & a_In); - - -private: + void LoadCustomStatFromJSON(const Json::Value & a_In); - cStatManager * m_Manager; + cStatManager & m_Manager; - AString m_LegacyPath; // The old .json path to try to read from if the uuid path doesn't exist on load AString m_Path; - - } ; - - - - -- cgit v1.2.3