From 8121849a185b913ef2de59fff2f3d9a6c9b3a613 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 5 Oct 2014 16:35:08 +0200 Subject: [PATCH] * Tournament game info -player names are listed beginning with the starting player. --- Mage/src/mage/game/Game.java | 1 + Mage/src/mage/game/GameImpl.java | 6 ++++++ Mage/src/mage/game/match/MatchImpl.java | 13 ++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/game/Game.java b/Mage/src/mage/game/Game.java index 1b167e15bb..24769cad46 100644 --- a/Mage/src/mage/game/Game.java +++ b/Mage/src/mage/game/Game.java @@ -291,4 +291,5 @@ public interface Game extends MageItem, Serializable { void pauseTimer(UUID playerId); int getPriorityTime(); void setPriorityTime(int priorityTime); + UUID getStartingPlayerId(); } diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index 3c64024247..5bb82a891e 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -2456,4 +2456,10 @@ public abstract class GameImpl implements Game, Serializable { public void setPriorityTime(int priorityTime) { this.priorityTime = priorityTime; } + + @Override + public UUID getStartingPlayerId() { + return startingPlayerId; + } + } diff --git a/Mage/src/mage/game/match/MatchImpl.java b/Mage/src/mage/game/match/MatchImpl.java index 2c63091527..72eb0ebddd 100644 --- a/Mage/src/mage/game/match/MatchImpl.java +++ b/Mage/src/mage/game/match/MatchImpl.java @@ -44,6 +44,7 @@ import mage.game.events.TableEvent; import mage.game.events.TableEvent.EventType; import mage.game.events.TableEventSource; import mage.players.Player; +import mage.players.PlayerList; import mage.util.DateFormat; import org.apache.log4j.Logger; @@ -275,13 +276,19 @@ public abstract class MatchImpl implements Match { public GameInfo createGameInfo(Game game) { StringBuilder playersInfo = new StringBuilder(); int counter = 0; - for(MatchPlayer matchPlayer: players) { + + PlayerList playerList = game.getPlayerList(); + playerList.setCurrent(game.getStartingPlayerId()); + Player currentPlayer = game.getPlayer(game.getStartingPlayerId()); + do { if (counter > 0) { playersInfo.append(" - "); } - playersInfo.append(matchPlayer.getName()); + playersInfo.append(currentPlayer.getName()); counter++; - } + currentPlayer = game.getPlayer(playerList.getNext()); + } while(!currentPlayer.getId().equals(game.getStartingPlayerId())); + String state; String result; String duelingTime = "";