diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 6a853806e..da8511159 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1292,6 +1292,10 @@ class ALord:public ListMaintainerAbility{ return 1; } + ~ALord(){ + SAFE_DELETE(regenCost); + } + virtual ostream& toString(ostream& out) const { out << "ALord ::: power : " << power diff --git a/projects/mtg/include/ExtraCost.h b/projects/mtg/include/ExtraCost.h index dcdbfafe8..a42a1dcbb 100644 --- a/projects/mtg/include/ExtraCost.h +++ b/projects/mtg/include/ExtraCost.h @@ -13,6 +13,7 @@ public: TargetChooser * tc; MTGCardInstance * source; ExtraCost(TargetChooser *_tc = NULL); + ~ExtraCost(); virtual int setPayment(MTGCardInstance * card) = 0; virtual int isPaymentSet() = 0; virtual int doPay() = 0; diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 24d12d983..b578b2be6 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -7,6 +7,10 @@ ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){ } +ExtraCost::~ExtraCost(){ + SAFE_DELETE(tc); +} + int ExtraCost::setSource(MTGCardInstance * _source){ source=_source; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index de28da6d5..b1e5f726b 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -383,6 +383,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (tc){ if (all){ UntapAll(tc); + delete tc; }else{ game->addObserver(NEW AUntaper(id, card, cost, tc)); } @@ -470,6 +471,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (tc){ if (all){ moveAll(tc,szone); + delete(tc); }else{ AZoneMover * a = NEW AZoneMover(id,card,tc,szone,cost,doTap); if (may){ @@ -623,6 +625,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ game->addObserver(a); }else{ damageAll(tc,damage); + delete tc; } }else{ MTGAbility * a = NEW ADamager(id, card, cost, damage, tc,doTap); @@ -1007,6 +1010,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (tc){ if (all){ TapAll(tc); + delete tc; }else{ game->addObserver(NEW ATapper(id, card, cost, tc)); }