Deserializer.

This commit is contained in:
Pcornat 2022-01-14 23:15:23 +01:00
parent 4f1075dc28
commit 8117dc357f
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0

View File

@ -55,6 +55,19 @@ namespace character {
[[nodiscard]] std::uint32_t get_glory() const { return glory; } [[nodiscard]] std::uint32_t get_glory() const { return glory; }
[[nodiscard]] std::uint32_t get_money() const { return money; } [[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) { void to_json(json &j, const CharacterSheet &billy) {