From e3e0233b8a60773d9825588651c08eee5a789944 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 20 Sep 2011 03:13:52 +0000 Subject: [PATCH] changed a couple wParsed ints to assign the spell or NULL rather then relying in card to cast it as NULL. --- projects/mtg/src/MTGAbility.cpp | 8 +++++--- projects/mtg/src/TargetChooser.cpp | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index b0beb82c6..5de8e6b39 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -168,9 +168,10 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player } else if (i == 2) { - WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),(Spell*)card,card); - secondAmount = secondA->getValue(); - SAFE_DELETE(secondA); + Spell * spellCard = (Spell*)card; + WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),spellCard?spellCard:NULL,card); + secondAmount = secondA->getValue(); + SAFE_DELETE(secondA); } } if(firstAmount < secondAmount && !less && !more && !equal) @@ -967,6 +968,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } } + //if/ifnot COND then DO EFFECT. const string ifKeywords[] = {"if ", "ifnot "}; int checkIf[] = { 1, 2 }; diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 9ddfd097f..a4592c934 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -180,7 +180,8 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta { targetMin = true;//if upto: is not found, then we need to have a minimum of the amount.... } - WParsedInt * howmuch = NEW WParsedInt(howmany, (Spell*)card, card); + Spell * sCard = (Spell*)card; + WParsedInt * howmuch = NEW WParsedInt(howmany, sCard?sCard:NULL, card); howmany.find("anyamount") != string::npos?maxtargets = TargetChooser::UNLITMITED_TARGETS:maxtargets = howmuch->getValue(); if(howmany.find("anyamount") != string::npos) targetMin = false; @@ -467,6 +468,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta //again for effects such as these. Spell * spell; spell = (Spell*)card->backupTargets[0]; + if(spell) card->target = spell->source; } if( CDtype.find("name") != string::npos )