mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
Fixed loading of duplicate games
This commit is contained in:
parent
e8649aae28
commit
1086051e56
3 changed files with 10 additions and 7 deletions
|
@ -30,7 +30,7 @@ INIT_LOGGER(game, PlayerMoveCmd);
|
||||||
PlayerMoveCmd::PlayerMoveCmd(Player &ioPlayer, const Move &iMove, bool iAutoExec)
|
PlayerMoveCmd::PlayerMoveCmd(Player &ioPlayer, const Move &iMove, bool iAutoExec)
|
||||||
: m_player(ioPlayer), m_move(iMove)
|
: m_player(ioPlayer), m_move(iMove)
|
||||||
{
|
{
|
||||||
setAutoExecutable(iAutoExec);
|
setAutoExecutable(iAutoExec || iMove.getType() == Move::NO_MOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,13 @@ void XmlReader::startElement(const string& namespaceURI,
|
||||||
m_attributes[atts.getLocalName(i)] = atts.getValue(i);
|
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")
|
else if (tag == "GameRack")
|
||||||
{
|
{
|
||||||
// Build a rack for the correct player
|
// Build a rack for the correct player
|
||||||
|
|
|
@ -101,6 +101,7 @@ private:
|
||||||
const Dictionary &m_dic;
|
const Dictionary &m_dic;
|
||||||
Game *m_game;
|
Game *m_game;
|
||||||
string errorMessage;
|
string errorMessage;
|
||||||
|
bool m_firstTurn;
|
||||||
|
|
||||||
string m_context;
|
string m_context;
|
||||||
string m_data;
|
string m_data;
|
||||||
|
@ -111,7 +112,7 @@ private:
|
||||||
// Private constructor, because we only want the read() method
|
// Private constructor, because we only want the read() method
|
||||||
// to be called externally
|
// to be called externally
|
||||||
XmlReader(const Dictionary &iDic) :
|
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(const XmlReader&);
|
||||||
XmlReader& operator=(const XmlReader&);
|
XmlReader& operator=(const XmlReader&);
|
||||||
|
|
Loading…
Reference in a new issue