- 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
+19 -7
View File
@@ -37,12 +37,9 @@ public:
if (card) return card->X;
return 1; //this should only hapen when the ai calls the ability. This is to give it an idea of the "direction" of X (positive/negative)
}
WParsedInt(int value = 0)
{
intValue = value;
}
WParsedInt(string s, Spell * spell, MTGCardInstance * card)
private:
void init(string s, Spell * spell, MTGCardInstance * card)
{
if(!card)
return;
@@ -73,8 +70,7 @@ public:
}
if(s == "prex")
{
ManaCost * cX = NEW ManaCost(card->controller()->getManaPool()->Diff(card->getManaCost()));
int preX =
ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost());
intValue = cX->getCost(Constants::MTG_NB_COLORS);
delete cX;
}
@@ -220,6 +216,22 @@ public:
}
intValue *= multiplier;
}
public:
WParsedInt(int value = 0)
{
intValue = value;
}
WParsedInt(string s, Spell * spell, MTGCardInstance * card)
{
init(s, spell, card);
}
WParsedInt(string s, MTGCardInstance * card)
{
init(s, NULL, card);
}
int getValue()
{