From c748d029500e99a87d81296093fb2d2ebceedc65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Wed, 24 Oct 2012 00:31:21 +0200 Subject: [PATCH] Saved games: use the real player ID, not a modified one --- game/xml_writer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/game/xml_writer.cpp b/game/xml_writer.cpp index ead1bf3..aee0abf 100644 --- a/game/xml_writer.cpp +++ b/game/xml_writer.cpp @@ -178,7 +178,7 @@ void XmlWriter::write(const Game &iGame, const string &iFileName) for (unsigned int i = 0; i < iGame.getNPlayers(); ++i) { const Player &player = iGame.getPlayer(i); - out << indent << "" << endl; + out << indent << "" << endl; addIndent(indent); out << indent << "" << toUtf8(player.getName()) << "" << endl; out << indent << "" << (player.isHuman() ? "human" : "computer") << "" << endl; @@ -230,7 +230,7 @@ void XmlWriter::write(const Game &iGame, const string &iFileName) else if (dynamic_cast(cmd)) { const PlayerRackCmd *rackCmd = static_cast(cmd); - unsigned int id = rackCmd->getPlayer().getId() + 1; + unsigned int id = rackCmd->getPlayer().getId(); out << indent << "" << toUtf8(rackCmd->getRack().toString()) << "" << endl; @@ -238,7 +238,7 @@ void XmlWriter::write(const Game &iGame, const string &iFileName) else if (dynamic_cast(cmd)) { const PlayerMoveCmd *moveCmd = static_cast(cmd); - unsigned int id = moveCmd->getPlayer().getId() + 1; + unsigned int id = moveCmd->getPlayer().getId(); out << indent; writeMove(out, moveCmd->getMove(), "PlayerMove", id); out << endl; @@ -246,7 +246,7 @@ void XmlWriter::write(const Game &iGame, const string &iFileName) else if (dynamic_cast(cmd)) { const GameMoveCmd *moveCmd = static_cast(cmd); - unsigned int id = moveCmd->getPlayerId() + 1; + unsigned int id = moveCmd->getPlayerId(); out << indent; writeMove(out, moveCmd->getMove(), "GameMove", id); out << endl; @@ -262,7 +262,7 @@ void XmlWriter::write(const Game &iGame, const string &iFileName) else if (dynamic_cast(cmd)) { const PlayerEventCmd *eventCmd = static_cast(cmd); - unsigned int id = eventCmd->getPlayer().getId() + 1; + unsigned int id = eventCmd->getPlayer().getId(); int value = eventCmd->getPoints(); // Warnings if (eventCmd->getEventType() == PlayerEventCmd::WARNING)