- fixed memory leaks introduced in previous revision

- removed incorrect casts of MTGCardInstance into Spell objects.
- AI Test system now allows you to put decks in ai/bakaA and ai/bakaB instead of ai/baka. This allows to let AIPlayerBaka and AIPlayerBakaB play with specific decks
- Test suite speed improvement. Improved the card name cache. Test suite now runs in 850 seconds instead of 950 on my machine.
- minor code cleanup
This commit is contained in:
wagic.the.homebrew
2011-09-22 04:43:05 +00:00
parent 997b154d46
commit ee4c7e23bd
15 changed files with 163 additions and 85 deletions
+5 -5
View File
@@ -416,7 +416,7 @@ ACounterShroud::~ACounterShroud()
SAFE_DELETE(counter);
}
//sheild a card from a certain type of counter.
//shield a card from a certain type of counter.
ACounterTracker::ACounterTracker(int id, MTGCardInstance * source, MTGCardInstance * target, string scounter) :
MTGAbility(id, source, target),scounter(scounter)
{
@@ -428,7 +428,7 @@ int ACounterTracker::addToGame()
MTGCardInstance * _target = (MTGCardInstance*)target;
Counter * counter = NULL;
AbilityFactory af;
counter = af.parseCounter(scounter, _target, (Spell*)source);
counter = af.parseCounter(scounter, _target, NULL); //(Spell*)source);
if (!counter)
{
return 0;
@@ -455,7 +455,7 @@ int ACounterTracker::destroy()
MTGCardInstance * _target = (MTGCardInstance*)target;
Counter * counter = NULL;
AbilityFactory af;
counter = af.parseCounter(scounter, _target, (Spell*)source);
counter = af.parseCounter(scounter, _target, NULL); //(Spell*)source);
if (!counter)
{
return 0;
@@ -665,12 +665,12 @@ int AAFizzler::resolve()
if(!target && source->target)
{
//ai is casting a spell from it's hand to fizzle.
target = stack->getAt(stack->getActionElementFromCard(source->target));
target = stack->getActionElementFromCard(source->target);
}
else if(target->typeAsTarget() == TARGET_CARD)
{
//ai targeted using an ability on a card to fizzle.
target = stack->getAt(stack->getActionElementFromCard((MTGCardInstance*)target));
target = stack->getActionElementFromCard((MTGCardInstance*)target);
}
Spell * sTarget = (Spell *) target;
MTGCardInstance* sCard = (MTGCardInstance*)sTarget->source;