Erwan
- fixed divergent growth (issue 243). Unfortunately the underlying issue is quite complex, and Wagic doesn't handle it very well. Basically, all "until end of turn" effects run the risk of being partially deleted before the end of the turn, leading to segfaults or memory leaks. This is because some abilities' "clone" method doesn't actually clone them entirely... The fix for divergent growth is a hack that works only for lords+mana producer combination, but I need a more "generic fix" in the long run...
This commit is contained in:
@@ -2247,7 +2247,6 @@ AManaProducer::AManaProducer(int id, MTGCardInstance * card, Targetable * t, Man
|
||||
|
||||
|
||||
AManaProducer::~AManaProducer(){
|
||||
if (isClone) return;
|
||||
LOG("==Destroying ManaProducer Object");
|
||||
SAFE_DELETE(cost);
|
||||
SAFE_DELETE(output);
|
||||
@@ -2256,6 +2255,10 @@ AManaProducer::AManaProducer(int id, MTGCardInstance * card, Targetable * t, Man
|
||||
|
||||
AManaProducer * AManaProducer::clone() const{
|
||||
AManaProducer * a = NEW AManaProducer(*this);
|
||||
a->cost = NEW ManaCost();
|
||||
a->output = NEW ManaCost();
|
||||
a->cost->copy(cost);
|
||||
a->output->copy(output);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user