resolution to issue 794. Non-classic games crashed at the completion of the game.
This commit is contained in:
@@ -28,6 +28,8 @@ using namespace std;
|
||||
|
||||
class GameObserver{
|
||||
protected:
|
||||
|
||||
GameType mGameType;
|
||||
MTGCardInstance * cardWaitingForTargets;
|
||||
queue<WEvent *> eventsQueue;
|
||||
// used when we're running to log actions
|
||||
@@ -84,10 +86,13 @@ class GameObserver{
|
||||
vector<Player *> players; //created outside
|
||||
time_t startedAt;
|
||||
Rules * mRules;
|
||||
GameType mGameType;
|
||||
MTGCardInstance* ExtraRules;
|
||||
Trash* mTrash;
|
||||
|
||||
GameType gameType() const
|
||||
{
|
||||
return mGameType;
|
||||
};
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void stackObjectClicked(Interruptible * action);
|
||||
|
||||
|
||||
@@ -105,10 +105,7 @@ class HumanPlayer: public Player
|
||||
{
|
||||
public:
|
||||
HumanPlayer(GameObserver *observer, string deckFile, string deckFileSmall, bool premade = false, MTGDeck * deck = NULL);
|
||||
void End(){
|
||||
if(!premade && opponent())
|
||||
DeckStats::GetInstance()->saveStats(this, opponent(), observer);
|
||||
};
|
||||
void End();
|
||||
friend ostream& operator<<(ostream&, const HumanPlayer&);
|
||||
};
|
||||
|
||||
|
||||
@@ -314,6 +314,12 @@ bool Player::parseLine(const string& s)
|
||||
return false;
|
||||
}
|
||||
|
||||
void HumanPlayer::End()
|
||||
{
|
||||
if(!premade && opponent() && (observer->gameType() == GAME_TYPE_CLASSIC))
|
||||
DeckStats::GetInstance()->saveStats(this, opponent(), observer);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& out, const Player& p)
|
||||
{
|
||||
out << "mode=" << p.playMode << endl;
|
||||
|
||||
@@ -767,7 +767,7 @@ void TestSuite::ThreadProc(void* inParam)
|
||||
while(!theGame.observer->gameOver)
|
||||
theGame.observer->Update(counter++);
|
||||
|
||||
if(theGame.observer->mGameType != GAME_TYPE_MOMIR)
|
||||
if(theGame.observer->gameType() != GAME_TYPE_MOMIR)
|
||||
{
|
||||
stringstream stream;
|
||||
stream << *(theGame.observer);
|
||||
|
||||
Reference in New Issue
Block a user