From: Erik V. <ev...@us...> - 2010-03-27 18:44:31
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11490/rails/game/specific/_1835 Modified Files: GameManager_1835.java PrussianFormationRound.java Log Message: Prussian formation Index: PrussianFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/PrussianFormationRound.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PrussianFormationRound.java 21 Mar 2010 17:43:50 -0000 1.6 --- PrussianFormationRound.java 27 Mar 2010 18:44:24 -0000 1.7 *************** *** 3,18 **** import java.util.ArrayList; import java.util.Arrays; - import java.util.HashMap; import java.util.List; - import java.util.Map; - import java.util.TreeSet; import rails.common.GuiDef; import rails.game.*; - import rails.game.action.ExchangeableToken; import rails.game.action.PossibleAction; import rails.game.move.CashMove; import rails.game.special.ExchangeForShare; - import rails.game.special.SellBonusToken; import rails.game.special.SpecialPropertyI; import rails.util.LocalText; --- 3,13 ---- *************** *** 157,164 **** FoldIntoPrussian a = (FoldIntoPrussian) action; ! List<CompanyI> folded = a.getFoldedCompanies(); ! if (step == Step.START) { ! if (folded == null || folded.isEmpty() || !startPrussian(a)) { finishRound(); } else { --- 152,158 ---- FoldIntoPrussian a = (FoldIntoPrussian) action; ! if (step == Step.START) { ! if (!startPrussian(a)) { finishRound(); } else { *************** *** 166,178 **** } } else if (step == Step.MERGE) { ! if (!folded.isEmpty()) mergeIntoPrussian (a); ! } ! // No merge options for the current player, try the next one ! setNextPlayer(); ! if (getCurrentPlayer() == startingPlayer) { ! finishRound(); ! } return true; } else { --- 160,173 ---- } } else if (step == Step.MERGE) { ! ! mergeIntoPrussian (a); ! // No merge options for the current player, try the next one ! setNextPlayer(); ! if (getCurrentPlayer() == startingPlayer) { ! finishRound(); ! } + } return true; } else { *************** *** 186,190 **** String errMsg = null; ! while (true) { if (!(M2_ID.equals(action.getFoldedCompanyNames()))) { errMsg = LocalText.getText("WrongCompany", --- 181,188 ---- String errMsg = null; ! List<CompanyI> folded = action.getFoldedCompanies(); ! boolean folding = folded != null && !folded.isEmpty(); ! ! while (folding) { if (!(M2_ID.equals(action.getFoldedCompanyNames()))) { errMsg = LocalText.getText("WrongCompany", *************** *** 206,212 **** moveStack.start(false); ! executeStartPrussian(false); ! return true; } --- 204,210 ---- moveStack.start(false); ! if (folding) executeStartPrussian(false); ! return folding; } *************** *** 230,234 **** String errMsg = null; ! while (true) { break; } --- 228,235 ---- String errMsg = null; ! List<CompanyI> folded = action.getFoldedCompanies(); ! boolean folding = folded != null && !folded.isEmpty(); ! ! while (folding) { break; } *************** *** 245,254 **** // Execute ! executeExchange (action.getFoldedCompanies(), false, false); ! return true; } ! private void executeExchange (List<CompanyI> companies, boolean president, boolean display) { --- 246,255 ---- // Execute ! if (folding) executeExchange (action.getFoldedCompanies(), false, false); ! return folding; } ! private void executeExchange (List<CompanyI> companies, boolean president, boolean display) { Index: GameManager_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/GameManager_1835.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GameManager_1835.java 4 Mar 2010 22:12:41 -0000 1.3 --- GameManager_1835.java 27 Mar 2010 18:44:24 -0000 1.4 *************** *** 7,11 **** public static String PR_NAME = PrussianFormationRound.PR_ID; ! private RoundI previousRound; private Player prFormStartingPlayer = null; --- 7,11 ---- public static String PR_NAME = PrussianFormationRound.PR_ID; ! private RoundI previousRound = null; private Player prFormStartingPlayer = null; *************** *** 18,22 **** if (round instanceof PrussianFormationRound) { ! super.nextRound(previousRound); } else { PhaseI phase = getCurrentPhase(); --- 18,29 ---- if (round instanceof PrussianFormationRound) { ! if (interruptedRound != null) { ! setRound(interruptedRound); ! interruptedRound.resume(); ! interruptedRound = null; ! } else if (previousRound != null) { ! super.nextRound(previousRound); ! previousRound = null; ! } } else { PhaseI phase = getCurrentPhase(); *************** *** 33,36 **** --- 40,54 ---- } + + public void newPhaseChecks(RoundI round) { + PhaseI phase = getCurrentPhase(); + if (phase.getName().equals("4") || phase.getName().equals("4+4") + || phase.getName().equals("5")) { + if (!PrussianFormationRound.prussianIsComplete(this)) { + interruptedRound = round; + startPrussianFormationRound (); + } + } + } private void startPrussianFormationRound() { |