From: Erik V. <ev...@us...> - 2009-12-30 11:32:10
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13202/rails/game Modified Files: PublicCompanyI.java OperatingRound.java PublicCompany.java Log Message: Added mayBuyTrainType() to fix incorrect 4-train buy option for 1856 CGR. Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** OperatingRound.java 28 Dec 2009 14:53:00 -0000 1.86 --- OperatingRound.java 30 Dec 2009 11:32:00 -0000 1.87 *************** *** 753,757 **** Bank.format(sbt.getValue()), seller.getName(), ! Bank.format(sbt.getValue()))); sbt.setExercised(); --- 753,757 ---- Bank.format(sbt.getValue()), seller.getName(), ! Bank.format(sbt.getPrice()))); sbt.setExercised(); *************** *** 2099,2102 **** --- 2099,2103 ---- trains = trainMgr.getAvailableNewTrains(); for (TrainI train : trains) { + if (!operatingCompany.mayBuyTrainType(train)) continue; if (!mayBuyMoreOfEachType && trainsBoughtThisTurn.contains(train.getType())) { Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** PublicCompany.java 28 Dec 2009 13:21:13 -0000 1.75 --- PublicCompany.java 30 Dec 2009 11:32:00 -0000 1.76 *************** *** 803,806 **** --- 803,811 ---- return mayTradeShares; } + + /** Stub that allows exclusions such as that 1856 CGR may not buy a 4 */ + public boolean mayBuyTrainType (TrainI train) { + return true; + } public boolean mustHaveOperatedToTradeShares() { Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** PublicCompanyI.java 9 Oct 2009 20:20:34 -0000 1.38 --- PublicCompanyI.java 30 Dec 2009 11:32:00 -0000 1.39 *************** *** 64,67 **** --- 64,69 ---- public boolean mayTradeShares(); + public boolean mayBuyTrainType (TrainI train); + /** * Start the company. |