- revert r3645

- fix memory leak in GenericInstantAbility
This commit is contained in:
wagic.the.homebrew@gmail.com
2011-05-11 08:06:53 +00:00
parent 413926515f
commit 1ee3c9eccc
4 changed files with 21 additions and 53 deletions

View File

@@ -825,20 +825,6 @@ public:
return a;
}
};
//make instant ability out of anything
class AGenericInstantWrapper: public InstantAbility
{
public:
MTGAbility * ability;
AGenericInstantWrapper(int id, MTGCardInstance * source, Damageable * target,MTGAbility * wrapThis);
int resolve();
const char * getMenuText();
AGenericInstantWrapper * clone() const;
~AGenericInstantWrapper();
};
//counters
class AACounter: public ActivatedAbility
{
@@ -1773,16 +1759,25 @@ public:
int destroy()
{
ability->forceDestroy = 1;
if (game->removeObserver(ability))
ability = NULL;
else
SAFE_DELETE(ability);
return InstantAbility::destroy();
}
GenericInstantAbility * clone() const
{
GenericInstantAbility * a = NEW GenericInstantAbility(*this);
a->ability = ability->clone();
a->isClone = 1;
return a;
}
~GenericInstantAbility()
{
SAFE_DELETE(ability);
}
};
//Circle of Protections