From: Erik V. <ev...@us...> - 2009-09-03 18:34:06
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3885/rails/game/specific/_1856 Modified Files: CGRFormationRound.java OperatingRound_1856.java Log Message: Certificate limits after CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CGRFormationRound.java 2 Sep 2009 21:47:47 -0000 1.11 --- CGRFormationRound.java 3 Sep 2009 18:33:26 -0000 1.12 *************** *** 33,36 **** --- 33,43 ---- public static final int STEP_EXCHANGE_TOKENS = 3; + private static int[][] certLimitsTable = { + {10, 13, 15, 18, 20, 22, 25, 28}, + {8, 10, 12, 14, 16, 18, 20, 22}, + {7, 8, 10, 11, 13, 15, 16, 18}, + {6, 7, 8, 10, 11, 12, 14, 15} + }; + public CGRFormationRound (GameManagerI gameManager) { super (gameManager); *************** *** 395,399 **** // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! ((PublicCompany_State)cgr).setShareUnit (10); // All superfluous shares have been removed } --- 402,406 ---- // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! (cgr).setShareUnit (10); // All superfluous shares have been removed } *************** *** 580,583 **** --- 587,606 ---- break; } + + // Determine the new certificate limit. + // The number of available companies is 11, + // or 12 minus the number of closed companies, whichever is lower. + int numCompanies = Math.min(11, 12-mergingCompanies.size()); + int numPlayers = gameManager.getNumberOfPlayers(); + // Need some checks here... + int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; + Player.setPlayerCertificateLimit(newCertLimit); + message = LocalText.getText("CertificateLimit", + newCertLimit, + numPlayers, + numCompanies); + DisplayBuffer.add(message); + ReportBuffer.add(message); + } Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** OperatingRound_1856.java 2 Sep 2009 21:47:47 -0000 1.17 --- OperatingRound_1856.java 3 Sep 2009 18:33:26 -0000 1.18 *************** *** 464,476 **** PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); ! //for (Iterator<PublicCompanyI> it = companies.iterator(); ! // it.hasNext(); ) { ! // company = it.next(); ! // if (company.isClosed()) { ! // if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! // //it.remove(); ! // } ! //} ! for (PublicCompanyI company : mergingCompanies) {; if (companiesOperatedThisRound.contains(company)) cgrCanOperate = false; } --- 464,469 ---- PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); ! ! for (PublicCompanyI company : mergingCompanies) { if (companiesOperatedThisRound.contains(company)) cgrCanOperate = false; } *************** *** 481,484 **** --- 474,486 ---- && getOperatingCompany().isClosed()); + // Remove closed companies from the operating company list + // (leave this code in case we need it; it works) + //for (Iterator<PublicCompanyI> it = companies.iterator(); + // it.hasNext(); ) { + // if ((it.next()).isClosed()) { + // it.remove(); + // } + //} + if (operatingCompany != null) { operatingCompanyIndex = companies.indexOf(operatingCompany); *************** *** 495,498 **** --- 497,501 ---- companies.add(operatingCompanyIndex, cgr); operatingCompany = cgr; + operatingCompanyIndex = companies.indexOf(operatingCompany); message = LocalText.getText("CanOperate", cgr.getName()); } else { *************** *** 512,536 **** @Override ! protected void finishTurn() { ! ! operatingCompany.setOperated(true); ! ! // Check if any privates must be closed ! // (now only applies to 1856 W&SR) ! for (PrivateCompanyI priv : operatingCompany.getPortfolio().getPrivateCompanies()) { ! priv.checkClosingIfExercised(true); ! } if (finalLoanRepaymentPending.booleanValue()) { ((GameManager_1856)gameManager).startCGRFormationRound(this, playerToStartLoanRepayment); ! return; } ! if (setNextOperatingCompany(false)) { ! setStep(STEP_INITIAL); ! } else { ! finishOR(); ! } } } --- 515,527 ---- @Override ! protected boolean finishTurnSpecials() { if (finalLoanRepaymentPending.booleanValue()) { ((GameManager_1856)gameManager).startCGRFormationRound(this, playerToStartLoanRepayment); ! return false; } ! return true; } } |