From: Erik V. <ev...@us...> - 2008-11-15 13:43:49
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7613/rails/game Modified Files: OperatingRound.java Log Message: New setNextOperatingCompany method & some refactoring to allow specific 1856 rules in a subclass Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** OperatingRound.java 26 Oct 2008 20:47:37 -0000 1.42 --- OperatingRound.java 15 Nov 2008 13:43:38 -0000 1.43 *************** *** 130,137 **** public void start(boolean operate, String orNumber) { ! if (operatingCompanyIndexObject == null) { ! operatingCompanyIndexObject = ! new IntegerState("OperatingCompanyIndex", 0); ! } if (players == null) { --- 130,137 ---- public void start(boolean operate, String orNumber) { ! //if (operatingCompanyIndexObject == null) { ! // operatingCompanyIndexObject = ! // new IntegerState("OperatingCompanyIndex", 0); ! //} if (players == null) { *************** *** 153,163 **** if (operatingCompanyArray.length > 0) { gameManager.setRound(this); - operatingCompanyIndex = operatingCompanyIndexObject.intValue(); - operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! setStep(STEP_INITIAL); } - return; } --- 153,163 ---- if (operatingCompanyArray.length > 0) { gameManager.setRound(this); ! if (setNextOperatingCompany(true)) { ! setStep(STEP_INITIAL); ! return; ! } } } *************** *** 321,325 **** if (tile == null) break; ! if (!tile.isLayableNow()) { errMsg = LocalText.getText("TileNotYetAvailable", --- 321,326 ---- if (tile == null) break; ! //if (!tile.isLayableNow()) { ! if (!currentPhase.isTileColourAllowed(tile.getColourName())) { errMsg = LocalText.getText("TileNotYetAvailable", *************** *** 1122,1136 **** } ! if (operatingCompanyIndex >= operatingCompanyArray.length - 1) { finishOR(); ! } else { - operatingCompanyIndexObject.add(1); ! operatingCompanyIndex = operatingCompanyIndexObject.intValue(); operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! ! setStep(STEP_INITIAL); } } --- 1123,1154 ---- } ! if (setNextOperatingCompany(false)) { + setStep(STEP_INITIAL); + } else { finishOR(); ! } ! } ! ! protected boolean setNextOperatingCompany(boolean initial) { ! ! ! if (operatingCompanyIndexObject == null) { ! operatingCompanyIndexObject = ! new IntegerState("OperatingCompanyIndex"); ! } ! if (initial) { ! operatingCompanyIndexObject.set(0); } else { operatingCompanyIndexObject.add(1); ! } ! ! operatingCompanyIndex = operatingCompanyIndexObject.intValue(); ! ! if (operatingCompanyIndex >= operatingCompanyArray.length) { ! return false; ! } else { operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! return true; } } |