From 85b20f8448aa7a6ff4d87100ce4fe3c5e78aff88 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Wed, 18 Mar 2026 14:13:53 +0100 Subject: [PATCH 1/2] Changing materiel to a signed field. It can become negative. --- include/characteristic.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/characteristic.hpp b/include/characteristic.hpp index f4d886d..ad8f167 100644 --- a/include/characteristic.hpp +++ b/include/characteristic.hpp @@ -12,7 +12,6 @@ namespace character { } namespace character::characteristic { - /*! * \brief Different characteristic type */ @@ -41,7 +40,7 @@ namespace character::characteristic { std::uint32_t carac{ 0 }; //! Value changed from a billyObjects (billyEnums) possessed - std::uint32_t materiel{ 0 }; + std::int32_t materiel{ 0 }; //! Additional value when creating the character std::uint32_t additional{ 0 }; @@ -70,7 +69,7 @@ namespace character::characteristic { constexpr Characteristic(const characType inType, const std::uint32_t carac, - const std::uint32_t materiel, + const std::int32_t materiel, const std::uint32_t additional) : base(get_base(inType)), carac(carac), @@ -98,11 +97,11 @@ namespace character::characteristic { [[nodiscard]] std::uint32_t get_carac() const { return carac; } - [[nodiscard]] std::uint32_t get_materiel() const { return materiel; } + [[nodiscard]] std::int32_t get_materiel() const { return materiel; } [[nodiscard]] std::uint32_t get_additional() const { return additional; } - [[nodiscard]] std::size_t get_total() const noexcept { + [[nodiscard]] std::int32_t get_total() const noexcept { if (total == defaultValue::max()) { total = static_cast(base + carac + materiel + additional); total = std::max(total, 0); @@ -114,7 +113,7 @@ namespace character::characteristic { const_cast(charac.base) = j.at("base").get(); const_cast(charac.type) = static_cast(j.at("type").get()); charac.carac = j.at("carac").get(); - charac.materiel = j.at("materiel").get(); + charac.materiel = j.at("materiel").get(); charac.additional = j.at("additional").get(); charac.total = j.at("total").get(); } From 698aed88604203b1dc554d191509655c5d74ae2c Mon Sep 17 00:00:00 2001 From: Pcornat Date: Wed, 18 Mar 2026 14:14:10 +0100 Subject: [PATCH 2/2] Difference in letter for different stages --- Unit testing/billy_objects_tests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Unit testing/billy_objects_tests.cpp b/Unit testing/billy_objects_tests.cpp index d762848..caad15d 100644 --- a/Unit testing/billy_objects_tests.cpp +++ b/Unit testing/billy_objects_tests.cpp @@ -112,7 +112,7 @@ TEST_CASE("[D] Deserialize full BillyObjects", "[deserialize][1]") { REQUIRE(std::get(dummy_object.objects.at(equipments::MedicKit)->get_type()) == equipments::MedicKit); } -TEST_CASE("[D] Pushing popping BillyObjects", "[pushpop][0]") { +TEST_CASE("[E] Pushing popping BillyObjects", "[pushpop][0]") { constexpr std::array all_objects{ weapons::Sword, weapons::Lance, @@ -153,7 +153,7 @@ TEST_CASE("[D] Pushing popping BillyObjects", "[pushpop][0]") { } } -TEST_CASE("[D] Double erase no throw", "[pushpop][1]") { +TEST_CASE("[E] Double erase no throw", "[pushpop][1]") { BillyObjects gestionnaire{}; CharacterSheet sheet; REQUIRE(sheet.get_objects().empty()); @@ -165,7 +165,7 @@ TEST_CASE("[D] Double erase no throw", "[pushpop][1]") { REQUIRE_FALSE(gestionnaire.erase_object(sheet, weapons::Bow)); } -TEST_CASE("[D] Insert no more than 3", "[pushpop][2]") { +TEST_CASE("[E] Insert no more than 3", "[pushpop][2]") { BillyObjects gestionnaire{}; CharacterSheet sheet; REQUIRE(sheet.get_objects().empty()); @@ -178,7 +178,7 @@ TEST_CASE("[D] Insert no more than 3", "[pushpop][2]") { REQUIRE(sheet.get_objects().size() == 3); } -TEST_CASE("[D] Printing Billy's objects", "[printing]") { +TEST_CASE("[F] Printing Billy's objects", "[printing]") { for (const auto &object: BillyObjects::all_objects) { const std::unique_ptr obj = test::get_obj(object); REQUIRE_NOTHROW(BillyObjects::billy_object_to_string(obj));