From 45a2388cf0f959c0db991bc3a9b1d34776f1fb12 Mon Sep 17 00:00:00 2001 From: trioct Date: Tue, 6 Oct 2020 02:43:43 -0500 Subject: [PATCH] fix errors --- src/character.h | 2 ++ src/savegame_json.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/character.h b/src/character.h index 4979831484a21..2951d58e2238b 100644 --- a/src/character.h +++ b/src/character.h @@ -322,6 +322,8 @@ struct weariness_tracker { int tick_counter = 0; void clear(); + void serialize( JsonOut &json ) const; + void deserialize( JsonIn &jsin ); }; inline social_modifiers operator+( social_modifiers lhs, const social_modifiers &rhs ) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 1cb66aeb8e073..0bb561534835f 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -454,6 +454,25 @@ void consumption_event::deserialize( JsonIn &jsin ) jo.read( "component_hash", component_hash ); } +void weariness_tracker::serialize( JsonOut &json ) const +{ + json.start_object(); + json.member( "tracker", tracker ); + json.member( "intake", intake ); + json.member( "low_activity_ticks", low_activity_ticks ); + json.member( "tick_counter", tick_counter ); + json.end_object(); +} + +void weariness_tracker::deserialize( JsonIn &jsin ) +{ + JsonObject jo = jsin.get_object(); + jo.read( "tracker", tracker ); + jo.read( "intake", intake ); + jo.read( "low_activity_ticks", low_activity_ticks ); + jo.read( "tick_counter", tick_counter ); +} + /** * Gather variables for saving. These variables are common to both the avatar and NPCs. */