Correctly adding (pushing_back) objects.

This commit is contained in:
Pcornat 2024-02-26 23:51:09 +01:00
parent 1d609f12d5
commit fd230e87e9
Signed by: Pcornat
GPG Key ID: E0326CC678A00BDD
2 changed files with 8 additions and 7 deletions

View File

@ -64,7 +64,7 @@ namespace character {
static std::string_view billy_object_to_string(const billyObject &object) noexcept;
void add_object(const billyObject &object, CharacterSheet &sheet) noexcept;
void push_object(const billyObject &object, CharacterSheet &sheet) noexcept;
void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept;
@ -74,8 +74,8 @@ namespace character {
std::minus<std::uint32_t> minus;
std::uint8_t end_object{ 0 };
static void change_carac_weapon(CharacterSheet &sheet,
const weapons &arg,
static void change_carac_weapon(const weapons &arg,
CharacterSheet &sheet,
characteristic::Characteristic &localHabilete,
characteristic::Characteristic &localAdresse,
characteristic::Characteristic &localEndurance,

View File

@ -8,9 +8,10 @@
namespace character {
using characteristic::Characteristic;
void BillyObjects::add_object(const billyObject &object, CharacterSheet &sheet) noexcept {
void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
if (end_object < 3) {
objects.at(end_object) = object;
++end_object;
auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
@ -20,7 +21,7 @@ namespace character {
std::visit(overloaded{
[&](const weapons &arg) {
++sheet.nb_weapons;
change_carac_weapon(sheet, arg, local_habilete, local_adresse, local_endurance, plus);
change_carac_weapon(arg, sheet, local_habilete, local_adresse, local_endurance, plus);
},
[&](const equipments &arg) {
++sheet.nb_equipments;
@ -101,8 +102,8 @@ namespace character {
}
}
void BillyObjects::change_carac_weapon(CharacterSheet &sheet,
const weapons &arg,
void BillyObjects::change_carac_weapon(const weapons &arg,
CharacterSheet &sheet,
Characteristic &localHabilete,
Characteristic &localAdresse,
Characteristic &localEndurance,