Move Script ownership to script holder, added OnRemove script hook.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -42,6 +42,7 @@ namespace CreatureLib::Battling {
|
||||
for (auto s : _sides) {
|
||||
delete s;
|
||||
}
|
||||
delete _currentTurnQueue;
|
||||
}
|
||||
|
||||
[[nodiscard]] const BattleLibrary* GetLibrary() const;
|
||||
|
||||
@@ -114,6 +114,8 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
|
||||
|
||||
void Battling::Creature::OverrideActiveTalent(const std::string& talent) {
|
||||
_hasOverridenTalent = true;
|
||||
_activeTalent->OnRemove();
|
||||
delete _activeTalent;
|
||||
_overridenTalentName = talent;
|
||||
_activeTalent = this->_library->LoadScript(ScriptResolver::ScriptCategory::Talent, talent);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace CreatureLib::Battling {
|
||||
for (auto attack : _attacks) {
|
||||
delete attack;
|
||||
}
|
||||
delete _activeTalent;
|
||||
delete _status;
|
||||
};
|
||||
|
||||
virtual void Initialize() {
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace CreatureLib::Battling {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~ExecutingAttack() = default;
|
||||
virtual ~ExecutingAttack() { delete _script; };
|
||||
|
||||
TargetData& GetAttackDataForTarget(Creature* creature) { return _targets[creature]; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user