From: Erik V. <ev...@us...> - 2009-09-01 21:14:48
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31489/rails/game/specific/_1856 Modified Files: PublicCompany_State.java OperatingRound_1856.java Log Message: Added running with borrowed train (CGR) Index: PublicCompany_State.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_State.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PublicCompany_State.java 31 Aug 2009 22:35:51 -0000 1.3 --- PublicCompany_State.java 1 Sep 2009 21:14:38 -0000 1.4 *************** *** 21,24 **** --- 21,35 ---- } + public boolean canRunTrains() { + if (!hadPermanentTrain) { + return true; + } + return getNumberOfTrains() > 0; + } + + public boolean runsWithBorrowedTrain () { + return !hadPermanentTrain && getNumberOfTrains() == 0; + } + @Override public void buyTrain(TrainI train, int price) { Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** OperatingRound_1856.java 31 Aug 2009 22:35:21 -0000 1.15 --- OperatingRound_1856.java 1 Sep 2009 21:14:38 -0000 1.16 *************** *** 17,20 **** --- 17,21 ---- public static final int STEP_REPAY_LOANS = 6; + private final String CGRNAME = "CGR"; static { *************** *** 63,67 **** operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! // 1856 special: check if the company may operate if (!operatingCompany.hasOperated()) { int soldPercentage --- 64,70 ---- operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! // 1856 special: check if the company has sold enough shares to operate ! // This check does not apply to the CGR ! if (operatingCompany.getName().equals(CGRNAME)) return true; if (!operatingCompany.hasOperated()) { int soldPercentage *************** *** 113,117 **** // There is only revenue if there are any trains ! if (operatingCompany.getPortfolio().getNumberOfTrains() > 0) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() --- 116,120 ---- // There is only revenue if there are any trains ! if (operatingCompany.canRunTrains()) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() *************** *** 133,136 **** --- 136,145 ---- // question should be suppressed. // In that case, the follow-up is done from this class. + + if (operatingCompany instanceof PublicCompany_State + && !((PublicCompany_State)operatingCompany).runsWithBorrowedTrain()) { + DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", + "CGR", "D")); + } } } *************** *** 342,346 **** PhaseI postPhase = currentPhase; ! if (postPhase != prePhase && postPhase.getName().equals("5")) { finalLoanRepaymentPending.set(true); --- 351,355 ---- PhaseI postPhase = currentPhase; ! log.debug("+++Phase was "+prePhase.getName()+" now "+postPhase.getName()); if (postPhase != prePhase && postPhase.getName().equals("5")) { finalLoanRepaymentPending.set(true); |