From 8117dc357fbc8633f45e77e329be265e6b8ed83a Mon Sep 17 00:00:00 2001 From: Pcornat Date: Fri, 14 Jan 2022 23:15:23 +0100 Subject: [PATCH] Deserializer. --- include/character_sheet.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/character_sheet.hpp b/include/character_sheet.hpp index f5fbe72..afc8042 100644 --- a/include/character_sheet.hpp +++ b/include/character_sheet.hpp @@ -55,6 +55,19 @@ namespace character { [[nodiscard]] std::uint32_t get_glory() const { return glory; } [[nodiscard]] std::uint32_t get_money() const { return money; } + + friend void from_json(const json &j, CharacterSheet &billy) { + j.at("caracters").get_to(billy.caractere); + j.at("adresse").get_to(billy.adresse); + j.at("endurance").get_to(billy.endurance); + j.at("chance").get_to(billy.chance); + j.at("habilete").get_to(billy.habilete); + j.at("health_point").get_to(billy.health_point); + j.at("armor").get_to(billy.armor); + j.at("damage").get_to(billy.damage); + j.at("glory").get_to(billy.glory); + j.at("money").get_to(billy.money); + } }; void to_json(json &j, const CharacterSheet &billy) {