From: Erik V. <ev...@us...> - 2009-08-31 22:36:00
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20663/rails/game Modified Files: OperatingRound.java Log Message: Special train buying rules for 1856 CGR Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** OperatingRound.java 19 Jul 2009 19:24:21 -0000 1.61 --- OperatingRound.java 31 Aug 2009 22:35:51 -0000 1.62 *************** *** 243,249 **** result = repayLoans((RepayLoans) selectedAction); ! } else if (selectedAction instanceof ExchangeTokens) { ! result = exchangeTokens ((ExchangeTokens)selectedAction); --- 243,249 ---- result = repayLoans((RepayLoans) selectedAction); ! } else if (selectedAction instanceof ExchangeTokens) { ! result = exchangeTokens ((ExchangeTokens)selectedAction); *************** *** 1743,1747 **** if (repayment > 0) executeRepayLoans (action); ! doneAllowed = true; --- 1743,1747 ---- if (repayment > 0) executeRepayLoans (action); ! doneAllowed = true; *************** *** 1794,1798 **** return numberOfLoans * operatingCompany.getValuePerLoan(); } ! /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ --- 1794,1798 ---- return numberOfLoans * operatingCompany.getValuePerLoan(); } ! /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ *************** *** 1958,1963 **** * trains that the company has no money for. If there is no cash to buy any * train from the Bank, prepare for emergency train buying. - * - * @return List of all trains that could potentially be bought. */ public void setBuyableTrains() { --- 1958,1961 ---- *************** *** 1976,1980 **** operatingCompany.getNumberOfTrains() >= operatingCompany.getCurrentTrainLimit(); boolean canBuyTrainNow = canBuyTrain(); ! boolean presidentMayHelp = operatingCompany.mustOwnATrain(); TrainI cheapestTrain = null; int costOfCheapestTrain = 0; --- 1974,1978 ---- operatingCompany.getNumberOfTrains() >= operatingCompany.getCurrentTrainLimit(); boolean canBuyTrainNow = canBuyTrain(); ! boolean presidentMayHelp = !hasTrains && operatingCompany.mustOwnATrain(); TrainI cheapestTrain = null; int costOfCheapestTrain = 0; *************** *** 2054,2058 **** && cheapestTrain != null && presidentMayHelp) { possibleActions.add(new BuyTrain(cheapestTrain, ! cheapestTrain.getHolder(), costOfCheapestTrain).setPresidentMustAddCash(costOfCheapestTrain - cash)); } --- 2052,2057 ---- && cheapestTrain != null && presidentMayHelp) { possibleActions.add(new BuyTrain(cheapestTrain, ! cheapestTrain.getHolder(), costOfCheapestTrain) ! .setPresidentMustAddCash(costOfCheapestTrain - cash)); } *************** *** 2074,2078 **** companiesPerPlayer.add(new ArrayList<PublicCompanyI>(4)); List<PublicCompanyI> companies; ! // Sort out which players preside over wich companies. for (int j = 0; j < operatingCompanyArray.length; j++) { c = operatingCompanyArray[j]; --- 2073,2077 ---- companiesPerPlayer.add(new ArrayList<PublicCompanyI>(4)); List<PublicCompanyI> companies; ! // Sort out which players preside over which companies. for (int j = 0; j < operatingCompanyArray.length; j++) { c = operatingCompanyArray[j]; *************** *** 2095,2100 **** if (train.isObsolete()) continue; if (i != currentPlayerIndex ! && trainMgr.buyAtFaceValueBetweenDifferentPresidents()) { ! bt = new BuyTrain(train, pf, train.getCost()); } else { bt = new BuyTrain(train, pf, 0); --- 2094,2105 ---- if (train.isObsolete()) continue; if (i != currentPlayerIndex ! && trainMgr.buyAtFaceValueBetweenDifferentPresidents() ! || operatingCompany.mustTradeTrainsAtFixedPrice() ! || company.mustTradeTrainsAtFixedPrice()) { ! if (cash >= train.getCost()) { ! bt = new BuyTrain(train, pf, train.getCost()); ! } else { ! continue; ! } } else { bt = new BuyTrain(train, pf, 0); |