From: Erik V. <ev...@us...> - 2010-04-22 19:10:06
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23526/rails/game/specific/_1856 Modified Files: OperatingRound_1856.java StockRound_1856.java Log Message: Restructured float detection such that an 1835 bug is fixed (BY must not float if one of its privates is unsold) and that game specific aspects can more easily be implemented in Round subclasses. Index: StockRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/StockRound_1856.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StockRound_1856.java 15 Apr 2010 19:49:50 -0000 1.16 --- StockRound_1856.java 22 Apr 2010 19:09:58 -0000 1.17 *************** *** 35,39 **** if (!company.hasStarted() || company.hasFloated()) return; ! int unsoldPercentage = company.getUnsoldPercentage(); PublicCompany_1856 comp = (PublicCompany_1856) company; --- 35,39 ---- if (!company.hasStarted() || company.hasFloated()) return; ! int soldPercentage = getSoldPercentage(company); PublicCompany_1856 comp = (PublicCompany_1856) company; *************** *** 43,47 **** log.debug ("Floatpercentage is "+floatPercentage); ! if (unsoldPercentage <= 100 - floatPercentage) { // Company floats. // In 1856 this does not mean that the company will operate, --- 43,47 ---- log.debug ("Floatpercentage is "+floatPercentage); ! if (soldPercentage >= floatPercentage) { // Company floats. // In 1856 this does not mean that the company will operate, *************** *** 55,59 **** } ! protected void initPlayer() { super.initPlayer(); sharesSoldSoFar.set(0); --- 55,60 ---- } ! @Override ! protected void initPlayer() { super.initPlayer(); sharesSoldSoFar.set(0); *************** *** 61,66 **** } ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { ! if (company instanceof PublicCompany_CGR) { if (company.canSharePriceVary()) { --- 62,68 ---- } ! @Override ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { ! if (company instanceof PublicCompany_CGR) { if (company.canSharePriceVary()) { *************** *** 100,106 **** case 4: // Note, that the share has not yet been moved ! if (comp.getUnsoldPercentage() <= 50 && !comp.hasReachedDestination()) { ! recipient = oldHolder.getOwner(); // i.e. the Bank comp.addMoneyInEscrow(cost); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", --- 102,108 ---- case 4: // Note, that the share has not yet been moved ! if (getSoldPercentage(comp) >= 50 && !comp.hasReachedDestination()) { ! recipient = bank; comp.addMoneyInEscrow(cost); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", *************** *** 112,120 **** // fall through case 5: ! recipient = (cert).getCompany(); break; case 6: default: ! recipient = oldHolder.getOwner(); } } else { --- 114,122 ---- // fall through case 5: ! recipient = comp; break; case 6: default: ! recipient = bank; } } else { Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** OperatingRound_1856.java 15 Apr 2010 19:49:50 -0000 1.34 --- OperatingRound_1856.java 22 Apr 2010 19:09:58 -0000 1.35 *************** *** 23,36 **** { ! steps = new GameDef.OrStep[] { GameDef.OrStep.INITIAL, GameDef.OrStep.LAY_TRACK, GameDef.OrStep.LAY_TOKEN, GameDef.OrStep.CALC_REVENUE, ! GameDef.OrStep.PAYOUT, ! GameDef.OrStep.BUY_TRAIN, GameDef.OrStep.TRADE_SHARES, ! GameDef.OrStep.REPAY_LOANS, ! GameDef.OrStep.FINAL }; } --- 23,36 ---- { ! steps = new GameDef.OrStep[] { GameDef.OrStep.INITIAL, GameDef.OrStep.LAY_TRACK, GameDef.OrStep.LAY_TOKEN, GameDef.OrStep.CALC_REVENUE, ! GameDef.OrStep.PAYOUT, ! GameDef.OrStep.BUY_TRAIN, GameDef.OrStep.TRADE_SHARES, ! GameDef.OrStep.REPAY_LOANS, ! GameDef.OrStep.FINAL }; } *************** *** 74,79 **** if (!operatingCompany.hasOperated()) { ! int soldPercentage ! = 100 - operatingCompany.getUnsoldPercentage(); TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); --- 74,78 ---- if (!operatingCompany.hasOperated()) { ! int soldPercentage = getSoldPercentage (operatingCompany); TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); *************** *** 352,356 **** // Step may only be skipped if repayment is optional if (minNumber == 0) doneAllowed = true; ! } else { // No (more) loans --- 351,355 ---- // Step may only be skipped if repayment is optional if (minNumber == 0) doneAllowed = true; ! } else { // No (more) loans |