From: Erik V. <ev...@us...> - 2012-01-26 21:09:28
|
rails/game/GameManager.java | 15 +++++++-------- rails/game/GameManagerI.java | 26 ++++++++++++-------------- rails/ui/swing/GameUIManager.java | 8 ++++---- 3 files changed, 23 insertions(+), 26 deletions(-) New commits: commit fb01a78aa7fc7de3b7c66bcc2e4a074cb14b72ce Author: Erik Vos <eri...@xs...> Date: Thu Jan 26 22:08:29 2012 +0100 Fixed 1880 reloading. The original player names sequence is now saved, rather than the reordered list. Method getPlayerNames() has been removed from teh GameManagerI interface; it was hardly used. diff --git a/rails/game/GameManager.java b/rails/game/GameManager.java index 8058d91..d18cba0 100644 --- a/rails/game/GameManager.java +++ b/rails/game/GameManager.java @@ -17,7 +17,6 @@ import rails.game.move.*; import rails.game.special.SpecialPropertyI; import rails.game.special.SpecialTokenLay; import rails.game.state.*; -import rails.sound.BackgroundMusicManager; import rails.util.GameFileIO; import rails.util.Util; @@ -67,7 +66,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI { protected Map<String, String> gameOptions; protected List<Player> players; - protected List<String> playerNames; + protected List<String> originalPlayerNamesList; protected int numberOfPlayers; protected State currentPlayer = new State("CurrentPlayer", Player.class); protected State priorityPlayer = new State("PriorityPlayer", Player.class); @@ -551,7 +550,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI { this.bank = bank; players = playerManager.getPlayers(); - playerNames = playerManager.getPlayerNames(); + originalPlayerNamesList = playerManager.getPlayerNames(); numberOfPlayers = players.size(); priorityPlayer.setState(players.get(0)); setPlayerCertificateLimit (playerManager.getInitialPlayerCertificateLimit()); @@ -1152,7 +1151,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI { protected boolean save(File file, boolean displayErrorMessage, String errorMessageKey) { GameFileIO gameSaver = new GameFileIO(); - gameSaver.initSave(saveFileVersionID, gameName, gameOptions, playerNames); + gameSaver.initSave(saveFileVersionID, gameName, gameOptions, originalPlayerNamesList); gameSaver.setActions(executedActions); gameSaver.setComments(ReportBuffer.getCommentItems()); return gameSaver.saveGame(file, displayErrorMessage, errorMessageKey); @@ -1502,9 +1501,9 @@ public class GameManager implements ConfigurableComponentI, GameManagerI { /* (non-Javadoc) * @see rails.game.GameManagerI#getPlayerNames() */ - public List<String> getPlayerNames() { - return playerNames; - } + //public List<String> getPlayerNames() { + // return originalPlayerNamesList; + //} public int getPlayerCertificateLimit(Player player) { return playerCertificateLimit.intValue(); @@ -1899,7 +1898,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI { for (int i=0; i<this.players.size(); i++) { player = this.players.get(i); player.setIndex (i); - this.playerNames.set (i, player.getName()); + //this.originalPlayerNamesList.set (i, player.getName()); log.debug("New player "+i+" is "+player.getName() +" (cash="+Bank.format(player.getCash())+")"); } diff --git a/rails/game/GameManagerI.java b/rails/game/GameManagerI.java index 01253a0..2703019 100644 --- a/rails/game/GameManagerI.java +++ b/rails/game/GameManagerI.java @@ -4,9 +4,7 @@ import java.util.List; import java.util.Map; import rails.algorithms.RevenueManager; -import rails.common.DisplayBuffer; -import rails.common.GuiDef; -import rails.common.GuiHints; +import rails.common.*; import rails.common.parser.ConfigurableComponentI; import rails.game.action.PossibleAction; import rails.game.correct.CorrectionManagerI; @@ -71,7 +69,7 @@ public interface GameManagerI extends MoveableHolder, ConfigurableComponentI { public abstract void registerBrokenBank(); public void registerMaxedSharePrice(PublicCompanyI company, StockSpaceI space); - + public boolean isDynamicOperatingOrder(); /** @@ -136,7 +134,7 @@ public interface GameManagerI extends MoveableHolder, ConfigurableComponentI { public abstract int getNumberOfPlayers(); - public abstract List<String> getPlayerNames(); + //public abstract List<String> getPlayerNames(); public abstract List<PublicCompanyI> getAllPublicCompanies(); @@ -210,28 +208,28 @@ public interface GameManagerI extends MoveableHolder, ConfigurableComponentI { public CorrectionManagerI getCorrectionManager(CorrectionType ct); public List<PublicCompanyI> getCompaniesInRunningOrder (); - public boolean isReloading(); - public void setReloading(boolean reloading); - public void setSkipDone (GameDef.OrStep step); - - public Player reorderPlayersByCash(boolean high); + public boolean isReloading(); + public void setReloading(boolean reloading); + public void setSkipDone (GameDef.OrStep step); + + public Player reorderPlayersByCash(boolean high); /** * reset the storage for other elements like tokens, special property * that a referred by unique ids * TODO */ - public void resetStorage(); - + public void resetStorage(); + /** * store element in storage * @param name to identify the type of the object to retrieve * @param object to store - * @return unique id of the object in the storage + * @return unique id of the object in the storage * TODO move to a better place */ public int storeObject(String typeName, Object object); - + /** * ask storage for object * @param name to identify the type of the object to retrieve diff --git a/rails/ui/swing/GameUIManager.java b/rails/ui/swing/GameUIManager.java index 07b5726..e50d32e 100644 --- a/rails/ui/swing/GameUIManager.java +++ b/rails/ui/swing/GameUIManager.java @@ -149,7 +149,7 @@ public class GameUIManager implements DialogOwner { if (Util.hasValue(saveSuffixSpec) && !saveSuffixSpec.equals(NEXT_PLAYER_SUFFIX)) { saveSuffix = saveSuffixSpec; } else { - saveSuffix = getPlayerNames().get(0); + saveSuffix = getPlayers().get(0).getName(); } log.debug("Initial save suffix: "+saveSuffix); } @@ -1030,9 +1030,9 @@ public class GameUIManager implements DialogOwner { return gameManager.getPlayers(); } - public List<String> getPlayerNames() { - return gameManager.getPlayerNames(); - } + //public List<String> getPlayerNames() { + // return gameManager.getPlayerNames(); + //} public Player getCurrentPlayer() { return gameManager.getCurrentPlayer(); |