From: Erik V. <ev...@us...> - 2009-09-25 19:13:14
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5549/rails/game/specific/_1856 Modified Files: CGRFormationRound.java PublicCompany_CGR.java StockRound_1856.java OperatingRound_1856.java Log Message: Rationalised Bank, removing statics Removed two unnecessary Util methods Index: StockRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/StockRound_1856.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** StockRound_1856.java 15 Jan 2009 20:53:28 -0000 1.8 --- StockRound_1856.java 25 Sep 2009 19:13:01 -0000 1.9 *************** *** 54,58 **** if (price != 0 && cert instanceof PublicCertificateI ! && oldHolder == Bank.getIpo()) { PublicCompany_1856 comp = (PublicCompany_1856)((PublicCertificateI) cert).getCompany(); --- 54,58 ---- if (price != 0 && cert instanceof PublicCertificateI ! && oldHolder == ipo) { PublicCompany_1856 comp = (PublicCompany_1856)((PublicCertificateI) cert).getCompany(); Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CGRFormationRound.java 23 Sep 2009 21:38:57 -0000 1.16 --- CGRFormationRound.java 25 Sep 2009 19:13:01 -0000 1.17 *************** *** 142,146 **** payment = numberToRepay * valuePerLoan; ! new CashMove (currentCompany, null, payment); currentCompany.addLoans(-numberToRepay); --- 142,146 ---- payment = numberToRepay * valuePerLoan; ! new CashMove (currentCompany, bank, payment); currentCompany.addLoans(-numberToRepay); *************** *** 238,242 **** company.addLoans(-numberRepaid); if (repaymentByCompany > 0) { ! new CashMove (company, null, repaymentByCompany); ReportBuffer.add (LocalText.getText("CompanyRepaysLoans", company.getName(), --- 238,242 ---- company.addLoans(-numberRepaid); if (repaymentByCompany > 0) { ! new CashMove (company, bank, repaymentByCompany); ReportBuffer.add (LocalText.getText("CompanyRepaysLoans", company.getName(), *************** *** 248,252 **** if (repaymentByPresident > 0) { Player president = company.getPresident(); ! new CashMove (president, null, repaymentByPresident); ReportBuffer.add (LocalText.getText("CompanyRepaysLoansWithPresCash", company.getName(), --- 248,252 ---- if (repaymentByPresident > 0) { Player president = company.getPresident(); ! new CashMove (president, bank, repaymentByPresident); ReportBuffer.add (LocalText.getText("CompanyRepaysLoansWithPresCash", company.getName(), *************** *** 280,287 **** PublicCertificateI cgrCert, poolCert; List<PublicCertificateI> certs = new ArrayList<PublicCertificateI>(); - Portfolio scrapHeap = Bank.getScrapHeap(); - Portfolio pool = Bank.getPool(); - Portfolio unavailable = Bank.getUnavailable(); - Portfolio ipo = Bank.getIpo(); Player temporaryPresident = null; Player newPresident = null; --- 280,283 ---- *************** *** 775,779 **** if (action.isForced()) MoveSet.setLinkedToPrevious(); ! train.moveTo(Bank.getPool()); ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain", companyName, --- 771,775 ---- if (action.isForced()) MoveSet.setLinkedToPrevious(); ! train.moveTo(pool); ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain", companyName, Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** OperatingRound_1856.java 12 Sep 2009 09:40:56 -0000 1.21 --- OperatingRound_1856.java 25 Sep 2009 19:13:01 -0000 1.22 *************** *** 66,72 **** // This check does not apply to the CGR if (operatingCompany instanceof PublicCompany_CGR) return true; ! if (operatingCompany.isClosed()) continue; ! if (!operatingCompany.hasOperated()) { int soldPercentage --- 66,72 ---- // This check does not apply to the CGR if (operatingCompany instanceof PublicCompany_CGR) return true; ! if (operatingCompany.isClosed()) continue; ! if (!operatingCompany.hasOperated()) { int soldPercentage *************** *** 218,222 **** int payment = Math.min(due, (operatingCompany.getCash() / 10) * 10); if (payment > 0) { ! new CashMove (operatingCompany, null, payment); if (payment == due) { ReportBuffer.add (LocalText.getText("InterestPaidFromTreasury", --- 218,222 ---- int payment = Math.min(due, (operatingCompany.getCash() / 10) * 10); if (payment > 0) { ! new CashMove (operatingCompany, bank, payment); if (payment == due) { ReportBuffer.add (LocalText.getText("InterestPaidFromTreasury", *************** *** 260,264 **** payment = remainder; ! new CashMove (president, null, payment); ReportBuffer.add (LocalText.getText("InterestPaidFromPresidentCash", operatingCompany.getName(), --- 260,264 ---- payment = remainder; ! new CashMove (president, bank, payment); ReportBuffer.add (LocalText.getText("InterestPaidFromPresidentCash", operatingCompany.getName(), *************** *** 293,297 **** int cashInEscrow = comp.getMoneyInEscrow(); if (cashInEscrow > 0) { ! new CashMove (null, company, cashInEscrow); ReportBuffer.add(LocalText.getText("ReleasedFromEscrow", company.getName(), --- 293,297 ---- int cashInEscrow = comp.getMoneyInEscrow(); if (cashInEscrow > 0) { ! new CashMove (bank, company, cashInEscrow); ReportBuffer.add(LocalText.getText("ReleasedFromEscrow", company.getName(), Index: PublicCompany_CGR.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_CGR.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PublicCompany_CGR.java 6 Sep 2009 12:27:31 -0000 1.2 --- PublicCompany_CGR.java 25 Sep 2009 19:13:01 -0000 1.3 *************** *** 15,19 **** /** Special rules apply before CGR has got its first permanent train */ private BooleanState hadPermanentTrain; ! /* Cope with multiple 5% share sales in one turn */ private IntegerState sharesSoldSoFar; --- 15,19 ---- /** Special rules apply before CGR has got its first permanent train */ private BooleanState hadPermanentTrain; ! /* Cope with multiple 5% share sales in one turn */ private IntegerState sharesSoldSoFar; *************** *** 61,65 **** @Override public void withhold(int amount) { ! if (amount > 0) new CashMove(null, this, amount); if (hasStockPrice && !runsWithBorrowedTrain()) { Game.getStockMarket().withhold(this); --- 61,65 ---- @Override public void withhold(int amount) { ! if (amount > 0) new CashMove(bank, this, amount); if (hasStockPrice && !runsWithBorrowedTrain()) { Game.getStockMarket().withhold(this); *************** *** 81,85 **** List<PublicCertificateI>certs = new ArrayList<PublicCertificateI>(certificates); int share = 0; ! MoveableHolderI scrapHeap = Bank.getScrapHeap(); for (PublicCertificateI cert : certs) { if (share >= 100) { --- 81,85 ---- List<PublicCertificateI>certs = new ArrayList<PublicCertificateI>(certificates); int share = 0; ! MoveableHolderI scrapHeap = bank.getScrapHeap(); for (PublicCertificateI cert : certs) { if (share >= 100) { *************** *** 107,120 **** } ! public void adjustSharePrice (int actionPerformed, int numberOfSharesSold, StockMarketI stockMarket) { ! if (actionPerformed == StockRound.SOLD) { if (canSharePriceVary()) { int numberOfSpaces; if (shareUnit.intValue() == 5) { ! // Take care for selling 5% shares in multiple blocks per turn ! numberOfSpaces ! = (sharesSoldSoFar.intValue() + numberOfSharesSold)/2 - squaresDownSoFar.intValue(); sharesSoldSoFar.add(numberOfSharesSold); --- 107,121 ---- } ! @Override ! public void adjustSharePrice (int actionPerformed, int numberOfSharesSold, StockMarketI stockMarket) { ! if (actionPerformed == StockRound.SOLD) { if (canSharePriceVary()) { int numberOfSpaces; if (shareUnit.intValue() == 5) { ! // Take care for selling 5% shares in multiple blocks per turn ! numberOfSpaces ! = (sharesSoldSoFar.intValue() + numberOfSharesSold)/2 - squaresDownSoFar.intValue(); sharesSoldSoFar.add(numberOfSharesSold); *************** *** 127,134 **** } } ! ! public void setOperated() { super.setOperated(); ! // Reset the share selling counts // TODO Should this be a generic function? --- 128,136 ---- } } ! ! @Override ! public void setOperated() { super.setOperated(); ! // Reset the share selling counts // TODO Should this be a generic function? |