From: Erik V. <ev...@us...> - 2008-12-23 20:02:24
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27634/rails/game/specific/_18EU Modified Files: OperatingRound_18EU.java FinalMinorExchangeRound.java GameManager_18EU.java Log Message: Apply new round initialisation logic. Fixed bugs: - Final Minor Exchange Round came immediately after OR in which first 5-train was bought in stead of before the next SR. - Starting player in FMER was last player to buy 5-train rather than first one. Index: FinalMinorExchangeRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/FinalMinorExchangeRound.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FinalMinorExchangeRound.java 7 Dec 2008 19:27:08 -0000 1.5 --- FinalMinorExchangeRound.java 23 Dec 2008 20:02:18 -0000 1.6 *************** *** 17,51 **** */ public class FinalMinorExchangeRound extends StockRound_18EU { - OperatingRound_18EU lastOR; ! /** ! * Constructor with no parameters, will call super class (StockRound_18EU's) Constructor to initialize ! * ! */ ! public FinalMinorExchangeRound() ! { ! super (); ! } ! ! /** ! * Constructor with the GameManager, will call super class (StockRound_18EU's) Constructor to initialize ! * ! * @param aGameManager The GameManager Object needed to initialize the Stock Round ! * ! */ ! public FinalMinorExchangeRound(GameManager aGameManager) { ! super (aGameManager); ! } ! ! public void start(OperatingRound_18EU lastOR) { ReportBuffer.add("\n" + LocalText.getText("StartFinalMinorExchangeRound")); ! this.lastOR = lastOR; ! Player firstPlayer = lastOR.getPlayerToStartExchangeRound(); ! setCurrentPlayerIndex(firstPlayer.getIndex()); initPlayer(); ReportBuffer.add(LocalText.getText("HasFirstTurn", ! new String[] { currentPlayer.getName() })); } --- 17,33 ---- */ public class FinalMinorExchangeRound extends StockRound_18EU { ! public FinalMinorExchangeRound(GameManagerI aGameManager) { ! super (aGameManager); ! } ! ! public void start(Player playerToStartFMERound) { ReportBuffer.add("\n" + LocalText.getText("StartFinalMinorExchangeRound")); ! setCurrentPlayerIndex(playerToStartFMERound.getIndex()); initPlayer(); ReportBuffer.add(LocalText.getText("HasFirstTurn", ! new String[] { playerToStartFMERound.getName() })); } *************** *** 71,75 **** List<PublicCompanyI> comps = ! Game.getCompanyManager().getAllPublicCompanies(); List<PublicCompanyI> minors = new ArrayList<PublicCompanyI>(); List<PublicCompanyI> targetCompanies = new ArrayList<PublicCompanyI>(); --- 53,57 ---- List<PublicCompanyI> comps = ! companyManager.getAllPublicCompanies(); List<PublicCompanyI> minors = new ArrayList<PublicCompanyI>(); List<PublicCompanyI> targetCompanies = new ArrayList<PublicCompanyI>(); Index: GameManager_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/GameManager_18EU.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GameManager_18EU.java 10 Dec 2008 20:44:48 -0000 1.3 --- GameManager_18EU.java 23 Dec 2008 20:02:18 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- import rails.game.GameManager; + import rails.game.Player; import rails.game.RoundI; *************** *** 11,22 **** public class GameManager_18EU extends GameManager { ! private OperatingRound_18EU lastOperatingRound = null; @Override public void nextRound(RoundI round) { ! if (round instanceof OperatingRound_18EU ! && ((OperatingRound_18EU) round).getPlayerToStartExchangeRound() != null) { ! lastOperatingRound = (OperatingRound_18EU) round; ! startFinalMinorExchangeRound(lastOperatingRound); } else if (round instanceof FinalMinorExchangeRound) { startStockRound(); --- 12,30 ---- public class GameManager_18EU extends GameManager { ! private Player playerToStartFMERound = null; @Override public void nextRound(RoundI round) { ! if (round instanceof OperatingRound_18EU) { ! if (((OperatingRound_18EU) round).getPlayerToStartExchangeRound() != null) { ! playerToStartFMERound = ((OperatingRound_18EU) round).getPlayerToStartExchangeRound(); ! } ! if (playerToStartFMERound != null ! && relativeORNumber.intValue() == numOfORs) { ! createRound (FinalMinorExchangeRound.class).start (playerToStartFMERound); ! playerToStartFMERound = null; ! } else { ! super.nextRound(round); ! } } else if (round instanceof FinalMinorExchangeRound) { startStockRound(); *************** *** 27,37 **** } - private void startFinalMinorExchangeRound(OperatingRound_18EU or) { - - FinalMinorExchangeRound sr = new FinalMinorExchangeRound(); - sr.setGameManager(this); - sr.start(or); - setRound (sr); - } - } --- 35,37 ---- Index: OperatingRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/OperatingRound_18EU.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OperatingRound_18EU.java 4 Jul 2008 20:46:33 -0000 1.4 --- OperatingRound_18EU.java 23 Dec 2008 20:02:18 -0000 1.5 *************** *** 21,24 **** --- 21,28 ---- protected State playerToStartExchangeRound = new State("PlayerToStartExchangeRound", Player.class); + + public OperatingRound_18EU (GameManagerI gameManager) { + super (gameManager); + } @Override *************** *** 173,177 **** // one to act in the Final Minor Exchange Round. if (result && gameManager.getPhaseManager().hasReachedPhase("5") ! && operatingCompanyArray[0].getTypeName().equals("Minor")) { playerToStartExchangeRound.set(operatingCompany.getPresident()); } --- 177,182 ---- // one to act in the Final Minor Exchange Round. if (result && gameManager.getPhaseManager().hasReachedPhase("5") ! && operatingCompanyArray[0].getTypeName().equals("Minor") ! && playerToStartExchangeRound.getObject() == null) { playerToStartExchangeRound.set(operatingCompany.getPresident()); } |