safe delete

This commit is contained in:
Anthony Calosa
2017-03-10 08:49:35 +08:00
parent 44926393ac
commit 88d1c29621
2 changed files with 25 additions and 3 deletions

View File

@@ -2102,6 +2102,7 @@ public:
int resolve();
const string getMenuText();
AALibraryBottom * clone() const;
~AALibraryBottom();
};
//Copier. ActivatedAbility
@@ -2115,6 +2116,7 @@ public:
int resolve();
const string getMenuText();
AACopier * clone() const;
~AACopier();
};
//phaseout
class AAPhaseOut: public ActivatedAbility

View File

@@ -1543,7 +1543,15 @@ const string AALibraryBottom::getMenuText()
AALibraryBottom * AALibraryBottom::clone() const
{
return NEW AALibraryBottom(*this);
AALibraryBottom * a = NEW AALibraryBottom(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AALibraryBottom::~AALibraryBottom()
{
SAFE_DELETE(andAbility);
}
//AACopier
@@ -1687,7 +1695,15 @@ const string AACopier::getMenuText()
AACopier * AACopier::clone() const
{
return NEW AACopier(*this);
AACopier * a = NEW AACopier(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AACopier::~AACopier()
{
SAFE_DELETE(andAbility);
}
//phaseout
@@ -4295,10 +4311,14 @@ ostream& AACloner::toString(ostream& out) const
AACloner * AACloner::clone() const
{
return NEW AACloner(*this);
AACloner * a = NEW AACloner(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AACloner::~AACloner()
{
SAFE_DELETE(andAbility);
}
// Cast/Play Restriction modifier