changed a couple wParsed ints to assign the spell or NULL rather then relying in card to cast it as NULL.

This commit is contained in:
omegablast2002@yahoo.com
2011-09-20 03:13:52 +00:00
parent fbfac78b09
commit e3e0233b8a
2 changed files with 8 additions and 4 deletions

View File

@@ -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 };

View File

@@ -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 )