Removing useless intermediate variables.
This commit is contained in:
parent
66911014f0
commit
f06227f02e
2 changed files with 8 additions and 26 deletions
|
|
@ -74,11 +74,7 @@ namespace character {
|
|||
|
||||
static void change_carac(const billyObjects &arg,
|
||||
CharacterSheet &sheet,
|
||||
characteristic::Characteristic &localHabilete,
|
||||
characteristic::Characteristic &localAdresse,
|
||||
characteristic::Characteristic &localEndurance,
|
||||
characteristic::Characteristic &localChance,
|
||||
const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept;
|
||||
const std::function<uint32_t(uint32_t, uint32_t)> &operation) noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,18 +40,13 @@ namespace character {
|
|||
const auto &object = sheet.objects[objType];
|
||||
sheet.available_objects.erase(objType);
|
||||
|
||||
auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
|
||||
auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
|
||||
auto &local_endurance = static_cast<Characteristic &>(sheet.endurance);
|
||||
auto &local_chance = static_cast<Characteristic &>(sheet.chance);
|
||||
|
||||
std::visit(overloaded{
|
||||
[&](const weapons &) { ++sheet.nb_weapons; },
|
||||
[&](const equipments &) { ++sheet.nb_equipments; },
|
||||
[&](const tools &) { ++sheet.nb_tools; },
|
||||
},
|
||||
objType);
|
||||
change_carac(object, sheet, local_habilete, local_adresse, local_endurance, local_chance, plus);
|
||||
change_carac(object, sheet, plus);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -63,18 +58,13 @@ namespace character {
|
|||
sheet.objects.erase(objToErase);
|
||||
sheet.available_objects.insert(objToErase);
|
||||
|
||||
auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
|
||||
auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
|
||||
auto &local_endurance = static_cast<Characteristic &>(sheet.endurance);
|
||||
auto &local_chance = static_cast<Characteristic &>(sheet.chance);
|
||||
|
||||
std::visit(overloaded{
|
||||
[&](const weapons &) { --sheet.nb_weapons; },
|
||||
[&](const equipments &) { --sheet.nb_equipments; },
|
||||
[&](const tools &) { --sheet.nb_tools; }
|
||||
},
|
||||
objToErase);
|
||||
change_carac(obj, sheet, local_habilete, local_adresse, local_endurance, local_chance, minus);
|
||||
change_carac(obj, sheet, minus);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -86,16 +76,12 @@ namespace character {
|
|||
|
||||
void BillyObjects::change_carac(const billyObjects &arg,
|
||||
CharacterSheet &sheet,
|
||||
Characteristic &localHabilete,
|
||||
Characteristic &localAdresse,
|
||||
Characteristic &localEndurance,
|
||||
Characteristic &localChance,
|
||||
const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation)
|
||||
const std::function<uint32_t(uint32_t, uint32_t)> &operation)
|
||||
noexcept {
|
||||
localHabilete.materiel = operation(localHabilete.materiel, arg->add_materiel(localHabilete.type));
|
||||
localAdresse.materiel = operation(localAdresse.materiel, arg->add_materiel(localAdresse.type));
|
||||
localEndurance.materiel = operation(localEndurance.materiel, arg->add_materiel(localEndurance.type));
|
||||
localChance.materiel = operation(localChance.materiel, arg->add_materiel(localChance.type));
|
||||
sheet.habilete.materiel = operation(sheet.habilete.materiel, arg->add_materiel(sheet.habilete.type));
|
||||
sheet.adresse.materiel = operation(sheet.adresse.materiel, arg->add_materiel(sheet.adresse.type));
|
||||
sheet.endurance.materiel = operation(sheet.endurance.materiel, arg->add_materiel(sheet.endurance.type));
|
||||
sheet.chance.materiel = operation(sheet.chance.materiel, arg->add_materiel(sheet.chance.type));
|
||||
sheet.armor = operation(sheet.armor, arg->add_armor());
|
||||
sheet.damage = operation(sheet.armor, arg->add_damage());
|
||||
sheet.critique = operation(sheet.critique, arg->add_critique());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue