- modified gameOver to be protected and defined two new operations to do the same thing (didWin and setLoser)

- removed ACTION_LOGGING_TESTING code
- Fixed AIvsAI games multithreaded games
- Activated undo when testsuite is enable
- Defined an initial player comparison operator
- Fixed multi-threaded modification to subtypes
- Fixed gameTurn cleanup for gameObserver reuse
This commit is contained in:
Xawotihs@gmail.com
2012-03-20 23:10:05 +00:00
parent 865bc7e494
commit cb8af6d6c0
14 changed files with 80 additions and 58 deletions

View File

@@ -45,14 +45,11 @@ void GameObserver::cleanup()
combatStep = BLOCKERS;
connectRule = false;
actionsList.clear();
gameTurn.clear();
}
GameObserver::~GameObserver()
{
#ifdef ACTION_LOGGING_TESTING
if(oldGame) SAFE_DELETE(oldGame);
#endif //ACTION_LOGGING_TESTING
LOG("==Destroying GameObserver==");
for (size_t i = 0; i < players.size(); ++i)
{
@@ -79,10 +76,6 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
: randomGenerator(true), mResourceManager(output), mJGE(input)
{
updateCtr = 0;
#ifdef ACTION_LOGGING_TESTING
oldGame = 0;
#endif //ACTION_LOGGING_TESTING
ExtraRules = new MTGCardInstance[2]();
mGameType = GAME_TYPE_CLASSIC;
@@ -549,23 +542,6 @@ void GameObserver::dumpAssert(bool val)
void GameObserver::Update(float dt)
{
/*******************/
updateCtr++;
#ifdef ACTION_LOGGING_TESTING
if(!oldGame || (!(*oldGame == *this) &&
!mLoading && mLayers->stackLayer()->isCalm()))
{ // constant game check
stringstream stream;
stream << *this;
if(oldGame) SAFE_DELETE(oldGame);
oldGame = new GameObserver();
oldGame->mRules = mRules;
oldGame->load(stream.str());
DumpAssert(*this == *oldGame);
}
#endif // ACTION_LOGGING_TESTING
/*******************/
Player * player = currentPlayer;
if (MTG_PHASE_COMBATBLOCKERS == currentGamePhase && BLOCKERS == combatStep)
{
@@ -757,7 +733,7 @@ void GameObserver::gameStateBasedEffects()
}
if (cantlosers < 1)
{
gameOver = players[i];
setLoser(players[i]);
}
}
}