From: Erik V. <ev...@us...> - 2009-10-30 21:53:18
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11565/rails/game/action Modified Files: LayBaseToken.java LayTile.java LayBonusToken.java PossibleAction.java Log Message: More rationalising of static method usage Index: PossibleAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/PossibleAction.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PossibleAction.java 29 Oct 2009 19:41:30 -0000 1.13 --- PossibleAction.java 30 Oct 2009 21:53:04 -0000 1.14 *************** *** 24,27 **** --- 24,28 ---- protected String playerName; protected int playerIndex; + transient protected GameManagerI gameManager; protected boolean acted = false; *************** *** 37,41 **** public PossibleAction() { ! Player player = GameManager.getInstance().getCurrentPlayer(); if (player != null) { playerName = player.getName(); --- 38,43 ---- public PossibleAction() { ! gameManager = GameManager.getInstance(); ! Player player = gameManager.getCurrentPlayer(); if (player != null) { playerName = player.getName(); *************** *** 84,87 **** --- 86,91 ---- ClassNotFoundException { in.defaultReadObject(); + gameManager = GameManager.getInstance(); + } } Index: LayBaseToken.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/LayBaseToken.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LayBaseToken.java 4 Jun 2008 19:00:29 -0000 1.4 --- LayBaseToken.java 30 Oct 2009 21:53:04 -0000 1.5 *************** *** 1,4 **** /* $Header$ ! * * Created on 14-Sep-2006 * Change Log: --- 1,4 ---- /* $Header$ ! * * Created on 14-Sep-2006 * Change Log: *************** *** 64,68 **** } ! public boolean equals(PossibleAction action) { if (!(action instanceof LayBaseToken)) return false; LayBaseToken a = (LayBaseToken) action; --- 64,69 ---- } ! @Override ! public boolean equals(PossibleAction action) { if (!(action instanceof LayBaseToken)) return false; LayBaseToken a = (LayBaseToken) action; *************** *** 73,77 **** } ! public String toString() { StringBuffer b = new StringBuffer("LayBaseToken "); if (chosenHex == null) { --- 74,79 ---- } ! @Override ! public String toString() { StringBuffer b = new StringBuffer("LayBaseToken "); if (chosenHex == null) { *************** *** 91,95 **** in.defaultReadObject(); ! MapManager mmgr = MapManager.getInstance(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { --- 93,97 ---- in.defaultReadObject(); ! MapManager mmgr = gameManager.getMapManager(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { *************** *** 104,108 **** } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = MapManager.getInstance().getHex(chosenHexName); } } --- 106,110 ---- } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = mmgr.getHex(chosenHexName); } } Index: LayTile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/LayTile.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** LayTile.java 11 Dec 2008 20:12:07 -0000 1.16 --- LayTile.java 30 Oct 2009 21:53:04 -0000 1.17 *************** *** 273,277 **** relaidBaseTokensString = (String) fields.get("relaidBaseTokensString", relaidBaseTokensString); ! MapManager mmgr = MapManager.getInstance(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { --- 273,278 ---- relaidBaseTokensString = (String) fields.get("relaidBaseTokensString", relaidBaseTokensString); ! MapManager mmgr = gameManager.getMapManager(); ! TileManager tmgr = gameManager.getTileManager(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { *************** *** 284,288 **** tiles = new ArrayList<TileI>(); for (int i = 0; i < tileIds.length; i++) { ! tiles.add(TileManager.get().getTile(tileIds[i])); } } --- 285,289 ---- tiles = new ArrayList<TileI>(); for (int i = 0; i < tileIds.length; i++) { ! tiles.add(tmgr.getTile(tileIds[i])); } } *************** *** 292,299 **** } if (laidTileId != 0) { ! laidTile = TileManager.get().getTile(laidTileId); } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = MapManager.getInstance().getHex(chosenHexName); } --- 293,300 ---- } if (laidTileId != 0) { ! laidTile = tmgr.getTile(laidTileId); } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = mmgr.getHex(chosenHexName); } Index: LayBonusToken.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/LayBonusToken.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LayBonusToken.java 4 Jun 2008 19:00:30 -0000 1.6 --- LayBonusToken.java 30 Oct 2009 21:53:04 -0000 1.7 *************** *** 1,4 **** /* $Header$ ! * * Created on 14-Sep-2006 * Change Log: --- 1,4 ---- /* $Header$ ! * * Created on 14-Sep-2006 * Change Log: *************** *** 10,17 **** import java.util.ArrayList; ! import rails.game.BonusToken; ! import rails.game.MapHex; ! import rails.game.MapManager; ! import rails.game.Token; import rails.game.special.SpecialProperty; import rails.game.special.SpecialTokenLay; --- 10,14 ---- import java.util.ArrayList; ! import rails.game.*; import rails.game.special.SpecialProperty; import rails.game.special.SpecialTokenLay; *************** *** 42,46 **** } ! public boolean equals(PossibleAction action) { if (!(action instanceof LayBonusToken)) return false; LayBonusToken a = (LayBonusToken) action; --- 39,44 ---- } ! @Override ! public boolean equals(PossibleAction action) { if (!(action instanceof LayBonusToken)) return false; LayBonusToken a = (LayBonusToken) action; *************** *** 49,53 **** } ! public String toString() { StringBuffer b = new StringBuffer("LayBonusToken "); if (chosenHex == null) { --- 47,52 ---- } ! @Override ! public String toString() { StringBuffer b = new StringBuffer("LayBonusToken "); if (chosenHex == null) { *************** *** 66,70 **** in.defaultReadObject(); ! MapManager mmgr = MapManager.getInstance(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { --- 65,69 ---- in.defaultReadObject(); ! MapManager mmgr = gameManager.getMapManager(); locations = new ArrayList<MapHex>(); if (Util.hasValue(locationNames)) { *************** *** 82,86 **** } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = MapManager.getInstance().getHex(chosenHexName); } } --- 81,85 ---- } if (chosenHexName != null && chosenHexName.length() > 0) { ! chosenHex = mmgr.getHex(chosenHexName); } } |