- fixed a bug with Flagstones of Trokair. There was no easy fix (cloned objects deleting stuff from their parents...) and I ended up using a "garbage collect at end of turn" technique the way I did with the ActionStack. As a result, the memory print of a turn will become bigger, and even more bugs might occur at the end of a turn... I'm ready to discuss this, although I think it's the best solution (in terms of result/amount of work) given the way abilities work right now
- Test suite now gives the number of failed/success at the end of the tests
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-26 14:25:29 +00:00
parent bb83817c82
commit 0bf83b6bf5
10 changed files with 76 additions and 41 deletions

View File

@@ -117,6 +117,7 @@ void GameObserver::nextGamePhase(){
//Auto Hand cleaning, in case the player didn't do it himself
while(currentPlayer->game->hand->nb_cards > 7)
currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]);
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
mLayers->actionLayer()->Update(0);
for (int i=0; i < 2; i++){
@@ -240,13 +241,8 @@ void GameObserver::addObserver(MTGAbility * observer){
void GameObserver::removeObserver(ActionElement * observer){
if (observer)
{
if (mLayers->actionLayer()->getIndexOf(observer) != -1){
observer->destroy();
mLayers->actionLayer()->Remove(observer);
}
}
if (observer)mLayers->actionLayer()->moveToGarbage(observer);
else
{} //TODO log error
}