Make all individual scripts smart pointers.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-06-02 13:43:44 +02:00
parent dba1275813
commit e4b9550efa
11 changed files with 48 additions and 58 deletions

View File

@@ -47,7 +47,7 @@ namespace CreatureLib::Battling {
std::string _nickname = "";
CreatureLib::Library::TalentIndex _talentIndex;
Script* _activeTalent = nullptr;
std::unique_ptr<Script> _activeTalent = nullptr;
bool _hasOverridenTalent;
ArbUt::CaseInsensitiveConstString _overridenTalentName = ""_cnc;
@@ -56,7 +56,7 @@ namespace CreatureLib::Battling {
ArbUt::UniquePtrList<LearnedAttack> _attacks;
bool _allowedExperienceGain;
Script* _status = nullptr;
std::unique_ptr<Script> _status = nullptr;
ScriptSet _volatile = {};
private:
@@ -70,10 +70,7 @@ namespace CreatureLib::Battling {
const Library::TalentIndex& talent, const std::vector<LearnedAttack*>& attacks,
bool allowedExperienceGain = true);
virtual ~Creature() {
delete _activeTalent;
delete _status;
};
virtual ~Creature() = default;
virtual void Initialize() {
RecalculateFlatStats();