Merge pull request #757 from zethfoxster/master

more fixes
This commit is contained in:
zethfoxster
2016-07-16 14:47:12 -04:00
committed by GitHub
3 changed files with 24 additions and 15 deletions
+1 -4
View File
@@ -5941,9 +5941,7 @@ int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana)
//and far to prone to bugs. //and far to prone to bugs.
if (_card == source) if (_card == source)
{ {
if (!tap || (tap && !source->isTapped())) if (!tap || (tap && (!source->isTapped() && !source->hasSummoningSickness())))
{
if (!source->hasSummoningSickness())
{ {
if (game->currentlyActing()->game->inPlay->hasCard(source) && (source->hasType(Subtypes::TYPE_LAND) || !tap || !source->hasSummoningSickness())) if (game->currentlyActing()->game->inPlay->hasCard(source) && (source->hasType(Subtypes::TYPE_LAND) || !tap || !source->hasSummoningSickness()))
{ {
@@ -5958,7 +5956,6 @@ int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana)
} }
} }
} }
}
return result; return result;
} }
+16 -4
View File
@@ -76,10 +76,22 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
MTGCardInstance * MTGCardInstance::createSnapShot() MTGCardInstance * MTGCardInstance::createSnapShot()
{ {
MTGCardInstance * snapShot = NEW MTGCardInstance(*this); //the below section of code was changed without all possible side effects checked
snapShot->previous = NULL; //the reason was becuase while NEW MTGCardInstance(*this); does indeed return an exact copy
snapShot->counters = NEW Counters(snapShot); //the lower layer cardprimitive data is pointed to from the original source.
controller()->game->garbage->addCard(snapShot); //this would cause cards like lotus bloom, which contain a restriction, to already has deleted the restriction
//which belonged to the original card before getting to the safe_delete,
//it was leaving a dangling pointer which leads to
//a total crash on "cleanup()" calls from garbage zone.
//snapshots are created for extra cost, they are used for abilities contained after the cost through storecard variable.
//TODO:fix this correctly. I want this to use an exact copy of the card in its current state for stored.
//making it safe_delete these "copies" leads to the same crash, as they are still pointing to the original data.
MTGCardInstance * snapShot = this;
//below is how we used to handle this.
// MTGCardInstance * snapShot = NEW MTGCardInstance(*this);
//snapShot->previous = NULL;
// snapShot->counters = NEW Counters(snapShot);
//controller()->game->garbage->addCard(snapShot);
return snapShot; return snapShot;
} }
+1 -1
View File
@@ -577,7 +577,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->storedSourceCard = card->storedSourceCard; copy->storedSourceCard = card->storedSourceCard;
copy->lastController = card->controller(); copy->lastController = card->controller();
copy->previousController = card->controller(); copy->previousController = card->controller();
for (int i = 0; i < ManaCost::MANA_PAID_WITH_OVERLOAD +1; i++) for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++)
copy->alternateCostPaid[i] = card->alternateCostPaid[i]; copy->alternateCostPaid[i] = card->alternateCostPaid[i];
//stupid bug with tokens... //stupid bug with tokens...