Erwan
- Fix a memory leak with Sacrifice costs
This commit is contained in:
@@ -26,6 +26,7 @@ public:
|
|||||||
MTGCardInstance * source;
|
MTGCardInstance * source;
|
||||||
MTGAbility * action;
|
MTGAbility * action;
|
||||||
ExtraCosts();
|
ExtraCosts();
|
||||||
|
~ExtraCosts();
|
||||||
void Render();
|
void Render();
|
||||||
int tryToSetPayment(MTGCardInstance * card);
|
int tryToSetPayment(MTGCardInstance * card);
|
||||||
int isPaymentSet();
|
int isPaymentSet();
|
||||||
|
|||||||
@@ -113,6 +113,13 @@ int ExtraCosts::doPay(){
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExtraCosts::~ExtraCosts(){
|
||||||
|
for (size_t i = 0; i < costs.size(); i++){
|
||||||
|
SAFE_DELETE(costs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ExtraCosts::Dump(){
|
void ExtraCosts::Dump(){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstance * c){
|
ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstance * c){
|
||||||
#if defined (WIN32) || defined (LINUX)
|
|
||||||
char buf[4096];
|
|
||||||
#endif
|
|
||||||
ManaCost * manaCost;
|
ManaCost * manaCost;
|
||||||
if (_manaCost){
|
if (_manaCost){
|
||||||
manaCost = _manaCost;
|
manaCost = _manaCost;
|
||||||
@@ -159,6 +156,7 @@ void ManaCost::copy(ManaCost * _manaCost){
|
|||||||
|
|
||||||
if (_manaCost->extraCosts){
|
if (_manaCost->extraCosts){
|
||||||
//TODO Deep copy ?
|
//TODO Deep copy ?
|
||||||
|
if(!extraCostsIsCopy) SAFE_DELETE(extraCosts);
|
||||||
extraCosts = _manaCost->extraCosts;
|
extraCosts = _manaCost->extraCosts;
|
||||||
extraCostsIsCopy = 1;
|
extraCostsIsCopy = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user