Adding the max number of objects allowed

This commit is contained in:
Pcornat 2026-02-06 13:34:27 +01:00
commit f245f84601
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
2 changed files with 3 additions and 1 deletions

View file

@ -45,6 +45,8 @@ namespace character {
static constexpr std::string_view json_key{ "billy_objects" }; static constexpr std::string_view json_key{ "billy_objects" };
static constexpr std::uint32_t max_obj{ 3 };
static std::string_view billy_object_to_string(const billyObjects &object) noexcept; static std::string_view billy_object_to_string(const billyObjects &object) noexcept;
static void to_json(json &j, const container &billy); static void to_json(json &j, const container &billy);

View file

@ -17,7 +17,7 @@ namespace character {
bool BillyObjects::insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept { bool BillyObjects::insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept {
if (sheet.objects.size() < 3) { if (sheet.objects.size() < max_obj) {
sheet.objects.emplace(objType, sheet.objects.emplace(objType,
std::visit(overloaded{ std::visit(overloaded{
[](const weapons &arg) { [](const weapons &arg) {