Arbitration: when loading a saved game, make PlayerMoveCmd auto-executable.

This is not very clean, but without this the played moves of past turns
are not visible. This commit also fixes a test with was incorrect.
This commit is contained in:
Olivier Teulière 2012-10-24 11:11:24 +02:00
parent 34ed25e9e9
commit 08c3f2ccb2
3 changed files with 9 additions and 6 deletions

View file

@ -429,7 +429,7 @@ void Duplicate::setGameAndPlayersRack(const PlayedRack &iRack)
// and solos should be assigned.
BOOST_FOREACH(Player *player, m_players)
{
Command *pCmd = new PlayerMoveCmd(*player, Move(), true);
Command *pCmd = new PlayerMoveCmd(*player, Move());
accessNavigation().addAndExecute(pCmd);
}
}

View file

@ -398,9 +398,12 @@ void XmlReader::endElement(const string& namespaceURI,
else if (tag == "PlayerMove")
{
// FIXME: this is game-related logic. It should not be done here.
bool isArbitrationGame = m_game->getParams().getMode() == GameParams::kARBITRATION;
const Move &move = buildMove(*m_game, m_attributes, /*XXX:true*/false);
Player &p = getPlayer(m_players, m_attributes["playerId"], tag);
PlayerMoveCmd *cmd = new PlayerMoveCmd(p, move);
PlayerMoveCmd *cmd = new PlayerMoveCmd(p, move, isArbitrationGame);
m_game->accessNavigation().addAndExecute(cmd);
}

View file

@ -169,10 +169,10 @@ Game: history:
1 | 0 | CHARITO | CHARIOT | H3 | 82 | *
Rack 0: LAERSIU
Rack 1: LAERSIU
Score 0: 80
Score 1: 82
Rack 0:
Rack 1:
Score 0: 154
Score 1: 156
commande> h n
commande> t TEEEPMO
commande> m ESTOMPEE O3