Pass LearnedAttack list to creature by reference.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-21 14:44:57 +02:00
parent bf6f77d904
commit 83f427368e
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 5 additions and 4 deletions

View File

@ -9,10 +9,11 @@ using namespace CreatureLib;
Battling::Creature::Creature(const BattleLibrary* library, const Library::CreatureSpecies* species,
const Library::SpeciesVariant* variant, uint8_t level, uint32_t experience, uint32_t uid,
Library::Gender gender, uint8_t coloring, const Library::Item* heldItem,
std::string nickname, const Library::TalentIndex& talent, List<LearnedAttack*> attacks)
std::string nickname, const Library::TalentIndex& talent,
const List<LearnedAttack*>& attacks)
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem), _nickname(std::move(nickname)),
_talentIndex(talent), _hasOverridenTalent(false), _attacks(std::move(attacks)) {
_talentIndex(talent), _hasOverridenTalent(false), _attacks(attacks) {
AssertNotNull(library)
AssertNotNull(species)
AssertNotNull(variant)

View File

@ -64,7 +64,7 @@ namespace CreatureLib::Battling {
Creature(const BattleLibrary* library, const Library::CreatureSpecies* species,
const Library::SpeciesVariant* variant, uint8_t level, uint32_t experience, uint32_t uid,
Library::Gender gender, uint8_t coloring, const Library::Item* heldItem, std::string nickname,
const Library::TalentIndex& talent, List<LearnedAttack*> attacks);
const Library::TalentIndex& talent, const List<LearnedAttack*>& attacks);
virtual ~Creature() {
for (auto attack : _attacks) {
@ -129,7 +129,7 @@ namespace CreatureLib::Battling {
void RemoveVolatileScript(Script* script);
bool HasVolatileScript(const ConstString& name) const;
List<LearnedAttack*>& GetAttacks() noexcept { return _attacks; }
const List<LearnedAttack*>& GetAttacks() noexcept { return _attacks; }
const Library::CreatureSpecies* GetDisplaySpecies() const noexcept;
const Library::SpeciesVariant* GetDisplayVariant() const noexcept;