Conversion to JSON.
This commit is contained in:
parent
a693da20bf
commit
2c3d736d5f
4 changed files with 179 additions and 12 deletions
|
@ -30,17 +30,17 @@ namespace character {
|
|||
};
|
||||
|
||||
enum class equipments : std::uint8_t {
|
||||
Chainmail = 0,
|
||||
CookingPot = 1,
|
||||
PamphletTourist = 2,
|
||||
MedicKit = 3,
|
||||
Chainmail = 4,
|
||||
CookingPot = 5,
|
||||
PamphletTourist = 6,
|
||||
MedicKit = 7
|
||||
};
|
||||
|
||||
enum class tools : std::uint8_t {
|
||||
Fourche = 0,
|
||||
Dagger = 1,
|
||||
RockClimbingKit = 2,
|
||||
SackOfGrain = 3
|
||||
Fourche = 8,
|
||||
Dagger = 9,
|
||||
RockClimbingKit = 10,
|
||||
SackOfGrain = 11
|
||||
};
|
||||
|
||||
class BillyObjects final {
|
||||
|
@ -49,6 +49,8 @@ namespace character {
|
|||
using billyObject = std::variant<weapons, equipments, tools>;
|
||||
using container = ankerl::svector<billyObject, max_num_obj>;
|
||||
|
||||
static constexpr std::string_view json_key{ "billy_objects" };
|
||||
|
||||
static constexpr std::string_view sword{ "Sword" };
|
||||
static constexpr std::string_view lance{ "Lance" };
|
||||
static constexpr std::string_view morgenstern{ "Morgenstern" };
|
||||
|
@ -66,6 +68,14 @@ namespace character {
|
|||
|
||||
static std::string_view billy_object_to_string(const billyObject &object) noexcept;
|
||||
|
||||
static void to_json(json &j, const BillyObjects::container &billy);
|
||||
|
||||
static void from_json(const json &j, BillyObjects::container &billy);
|
||||
|
||||
BillyObjects() noexcept = default;
|
||||
|
||||
~BillyObjects() noexcept = default;
|
||||
|
||||
void push_object(const billyObject &object, CharacterSheet &sheet) noexcept;
|
||||
|
||||
void pop_object(CharacterSheet &sheet) noexcept;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue