From: Erik V. <ev...@us...> - 2008-12-23 19:55:39
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26872/rails/game Modified Files: Round.java RoundI.java Log Message: New constructors Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Round.java 4 Dec 2008 00:46:46 -0000 1.13 --- Round.java 23 Dec 2008 19:55:29 -0000 1.14 *************** *** 25,40 **** protected static Logger log = Logger.getLogger(Round.class.getPackage().getName()); ! ! protected GameManager gameManager = null; protected CompanyManagerI companyManager = null; ! /** ! * Constructor with no parameters, call the setGameManager with null to properly initialize ! * ! */ ! public Round () { ! setGameManager (null); ! } ! /** * Constructor with the GameManager, will call setGameManager with the parameter to initialize --- 25,35 ---- protected static Logger log = Logger.getLogger(Round.class.getPackage().getName()); ! ! protected GameManagerI gameManager = null; protected CompanyManagerI companyManager = null; ! /** Default constructor cannot be used */ ! private Round () {} ! /** * Constructor with the GameManager, will call setGameManager with the parameter to initialize *************** *** 43,71 **** * */ ! public Round (GameManager aGameManager) { ! setGameManager (aGameManager); } - - /** Initialization routine that will set the gameManager and the companyManager objects for use in the class - * - * @param aGameManager The GameManager Object to save in the class, and use to find the CompanyManager - * - */ - public void setGameManager (GameManager aGameManager) { - gameManager = aGameManager; - if (aGameManager == null) { - companyManager = null; - } else { - companyManager = aGameManager.getCompanyManager(); - } - } - - public GameManager getGameManager () { - return gameManager; - } /* * (non-Javadoc) ! * * @see rails.game.RoundI#getCurrentPlayer() */ --- 38,56 ---- * */ ! public Round (GameManagerI aGameManager) { ! ! this.gameManager = aGameManager; ! ! if (aGameManager == null) { ! companyManager = null; ! } else { ! companyManager = aGameManager.getCompanyManager(); ! } ! } /* * (non-Javadoc) ! * * @see rails.game.RoundI#getCurrentPlayer() */ *************** *** 82,94 **** return getCurrentPlayer().getIndex(); } ! public void setCurrentPlayerIndex(int newIndex) { gameManager.setCurrentPlayerIndex(newIndex); } ! public void setCurrentPlayer(Player player) { gameManager.setCurrentPlayer(player); } ! public PhaseI getCurrentPhase() { return gameManager.getCurrentPhase(); --- 67,79 ---- return getCurrentPlayer().getIndex(); } ! public void setCurrentPlayerIndex(int newIndex) { gameManager.setCurrentPlayerIndex(newIndex); } ! public void setCurrentPlayer(Player player) { gameManager.setCurrentPlayer(player); } ! public PhaseI getCurrentPhase() { return gameManager.getCurrentPhase(); *************** *** 97,101 **** /* * (non-Javadoc) ! * * @see rails.game.RoundI#getHelp() */ --- 82,86 ---- /* * (non-Javadoc) ! * * @see rails.game.RoundI#getHelp() */ *************** *** 107,111 **** /* * (non-Javadoc) ! * * @see rails.game.RoundI#getSpecialProperties() */ --- 92,96 ---- /* * (non-Javadoc) ! * * @see rails.game.RoundI#getSpecialProperties() */ *************** *** 122,126 **** * Default version, does nothing. Subclasses should override this method * with a real version. ! * * @return */ --- 107,111 ---- * Default version, does nothing. Subclasses should override this method * with a real version. ! * * @return */ *************** *** 161,165 **** * Check if a company must be floated, and if so, do it. <p>This method is * included here because it is used in various types of Round. ! * * @param company */ --- 146,150 ---- * Check if a company must be floated, and if so, do it. <p>This method is * included here because it is used in various types of Round. ! * * @param company */ *************** *** 219,223 **** company.getName(), Bank.format(cash) })); } else { ! ReportBuffer.add(LocalText.getText("Floats", company.getName())); } --- 204,208 ---- company.getName(), Bank.format(cash) })); } else { ! ReportBuffer.add(LocalText.getText("Floats", company.getName())); } *************** *** 242,256 **** protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price) { ! Portfolio oldHolder = (Portfolio) cert.getHolder(); cert.moveTo(newHolder); ! if (price != 0) { new CashMove(newHolder.getOwner(), oldHolder.getOwner(), price); } ! } ! ! /** * Who receives the cash when a certificate is bought. * Normally this is owner of the previously holding portfolio. --- 227,241 ---- protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price) { ! Portfolio oldHolder = (Portfolio) cert.getHolder(); cert.moveTo(newHolder); ! if (price != 0) { new CashMove(newHolder.getOwner(), oldHolder.getOwner(), price); } ! } ! ! /** * Who receives the cash when a certificate is bought. * Normally this is owner of the previously holding portfolio. *************** *** 263,266 **** return ((Portfolio)cert.getHolder()).getOwner(); } ! } --- 248,251 ---- return ((Portfolio)cert.getHolder()).getOwner(); } ! } Index: RoundI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/RoundI.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RoundI.java 3 Dec 2008 20:15:15 -0000 1.8 --- RoundI.java 23 Dec 2008 19:55:29 -0000 1.9 *************** *** 10,17 **** public interface RoundI { - public void setGameManager (GameManager gameManager); - - public GameManager getGameManager (); - /** * Get the player that has the next turn. --- 10,13 ---- |