- 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

View File

@@ -566,7 +566,8 @@ TestSuite::TestSuite(const char * filename)
seed = 0;
forceAbility = false;
aiMaxCalls = -1;
startTime = JGEGetTime();
endTime = startTime;
std::string contents;
if (JFileSystem::GetInstance()->readIntoString(filename, contents))
{
@@ -585,6 +586,11 @@ TestSuite::TestSuite(const char * filename)
}
}
//If more than 1 test, prefecth names to make the suite run faster
if (nbfiles > 1)
MTGCollection()->prefetchCardNameCache();
ofstream file2;
if (JFileSystem::GetInstance()->openForWrite(file2, "/test/results.html"))
{
@@ -603,6 +609,7 @@ TestSuite::TestSuite(const char * filename)
int TestSuite::loadNext()
{
endTime = JGEGetTime();
summoningSickness = 0;
seed = 0;
aiMaxCalls = -1;
@@ -613,8 +620,6 @@ int TestSuite::loadNext()
return loadNext();
else
cout << "Starting test : " << files[currentfile - 1] << endl;
//load(files[currentfile].c_str());
//currentfile++;
return currentfile;
}