Fixed loading of duplicate games

This commit is contained in:
Olivier Teulière 2012-04-16 20:30:35 +02:00
parent e8649aae28
commit 1086051e56
3 changed files with 10 additions and 7 deletions

View file

@ -30,7 +30,7 @@ INIT_LOGGER(game, PlayerMoveCmd);
PlayerMoveCmd::PlayerMoveCmd(Player &ioPlayer, const Move &iMove, bool iAutoExec)
: m_player(ioPlayer), m_move(iMove)
{
setAutoExecutable(iAutoExec);
setAutoExecutable(iAutoExec || iMove.getType() == Move::NO_MOVE);
}

View file

@ -205,6 +205,13 @@ void XmlReader::startElement(const string& namespaceURI,
m_attributes[atts.getLocalName(i)] = atts.getValue(i);
}
}
else if (tag == "Turn")
{
if (m_firstTurn)
m_firstTurn = false;
else
m_game->accessNavigation().newTurn();
}
}
@ -318,11 +325,6 @@ void XmlReader::endElement(const string& namespaceURI,
}
}
else if (tag == "Turn")
{
m_game->accessNavigation().newTurn();
}
else if (tag == "GameRack")
{
// Build a rack for the correct player

View file

@ -101,6 +101,7 @@ private:
const Dictionary &m_dic;
Game *m_game;
string errorMessage;
bool m_firstTurn;
string m_context;
string m_data;
@ -111,7 +112,7 @@ private:
// Private constructor, because we only want the read() method
// to be called externally
XmlReader(const Dictionary &iDic) :
m_dic(iDic), m_game(NULL), m_params(iDic) {}
m_dic(iDic), m_game(NULL), m_firstTurn(true), m_params(iDic) {}
XmlReader(const XmlReader&);
XmlReader& operator=(const XmlReader&);