Changing materiel to a signed field.
It can become negative.
This commit is contained in:
parent
62f283be0b
commit
85b20f8448
1 changed files with 5 additions and 6 deletions
|
|
@ -12,7 +12,6 @@ namespace character {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace character::characteristic {
|
namespace character::characteristic {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Different characteristic type
|
* \brief Different characteristic type
|
||||||
*/
|
*/
|
||||||
|
|
@ -41,7 +40,7 @@ namespace character::characteristic {
|
||||||
std::uint32_t carac{ 0 };
|
std::uint32_t carac{ 0 };
|
||||||
|
|
||||||
//! Value changed from a billyObjects (billyEnums) possessed
|
//! Value changed from a billyObjects (billyEnums) possessed
|
||||||
std::uint32_t materiel{ 0 };
|
std::int32_t materiel{ 0 };
|
||||||
|
|
||||||
//! Additional value when creating the character
|
//! Additional value when creating the character
|
||||||
std::uint32_t additional{ 0 };
|
std::uint32_t additional{ 0 };
|
||||||
|
|
@ -70,7 +69,7 @@ namespace character::characteristic {
|
||||||
|
|
||||||
constexpr Characteristic(const characType inType,
|
constexpr Characteristic(const characType inType,
|
||||||
const std::uint32_t carac,
|
const std::uint32_t carac,
|
||||||
const std::uint32_t materiel,
|
const std::int32_t materiel,
|
||||||
const std::uint32_t additional) :
|
const std::uint32_t additional) :
|
||||||
base(get_base(inType)),
|
base(get_base(inType)),
|
||||||
carac(carac),
|
carac(carac),
|
||||||
|
|
@ -98,11 +97,11 @@ namespace character::characteristic {
|
||||||
|
|
||||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
[[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::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()) {
|
if (total == defaultValue::max()) {
|
||||||
total = static_cast<std::int32_t>(base + carac + materiel + additional);
|
total = static_cast<std::int32_t>(base + carac + materiel + additional);
|
||||||
total = std::max(total, 0);
|
total = std::max(total, 0);
|
||||||
|
|
@ -114,7 +113,7 @@ namespace character::characteristic {
|
||||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||||
const_cast<characType &>(charac.type) = static_cast<characType>(j.at("type").get<std::uint8_t>());
|
const_cast<characType &>(charac.type) = static_cast<characType>(j.at("type").get<std::uint8_t>());
|
||||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||||
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
charac.materiel = j.at("materiel").get<std::int32_t>();
|
||||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||||
charac.total = j.at("total").get<std::int32_t>();
|
charac.total = j.at("total").get<std::int32_t>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue