From: Erik V. <ev...@us...> - 2009-11-20 20:57:04
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9296/rails/game Modified Files: OperatingRound.java Log Message: Allow not buying a train when trainless, with a warning that this is only allowed without a route Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** OperatingRound.java 17 Nov 2009 19:31:25 -0000 1.77 --- OperatingRound.java 20 Nov 2009 20:56:50 -0000 1.78 *************** *** 1183,1186 **** --- 1183,1187 ---- // FIXME: Need to check for valid route before throwing an // error. + /* Check TEMPORARILY disabled errMsg = LocalText.getText("CompanyMustOwnATrain", *************** *** 1189,1192 **** --- 1190,1194 ---- DisplayBuffer.add(errMsg); return false; + */ } *************** *** 1949,1956 **** } else if (step == STEP_BUY_TRAIN) { setBuyableTrains(); ! if (!operatingCompany.mustOwnATrain() ! || operatingCompany.getPortfolio().getNumberOfTrains() > 0) { doneAllowed = true; ! } } else if (step == STEP_DISCARD_TRAINS) { setTrainsToDiscard(); --- 1951,1960 ---- } else if (step == STEP_BUY_TRAIN) { setBuyableTrains(); ! // TODO Need route checking here. ! // TEMPORARILY allow not buying a train if none owned ! //if (!operatingCompany.mustOwnATrain() ! // || operatingCompany.getPortfolio().getNumberOfTrains() > 0) { doneAllowed = true; ! //} } else if (step == STEP_DISCARD_TRAINS) { setTrainsToDiscard(); *************** *** 2079,2084 **** cost = train.getCost(); if (cost <= cash) { ! if (canBuyTrainNow) ! possibleActions.add(new BuyTrain(train, ipo, cost)); } else if (costOfCheapestTrain == 0 || cost < costOfCheapestTrain) { --- 2083,2091 ---- cost = train.getCost(); if (cost <= cash) { ! if (canBuyTrainNow) { ! BuyTrain action = new BuyTrain(train, ipo, cost); ! action.setHasNoTrains(!hasTrains); // TEMPORARY ! possibleActions.add(action); ! } } else if (costOfCheapestTrain == 0 || cost < costOfCheapestTrain) { *************** *** 2111,2114 **** --- 2118,2122 ---- BuyTrain bt = new BuyTrain(train, ipo, reducedPrice); bt.setSpecialProperty(stb); + bt.setHasNoTrains(!hasTrains); // TEMPORARY possibleActions.add(bt); } *************** *** 2126,2130 **** cost = train.getCost(); if (cost <= cash) { ! possibleActions.add(new BuyTrain(train, pool, cost)); } else if (costOfCheapestTrain == 0 || cost < costOfCheapestTrain) { --- 2134,2140 ---- cost = train.getCost(); if (cost <= cash) { ! BuyTrain bt = new BuyTrain(train, pool, cost); ! bt.setHasNoTrains(!hasTrains); // TEMPORARY ! possibleActions.add(bt); } else if (costOfCheapestTrain == 0 || cost < costOfCheapestTrain) { *************** *** 2134,2142 **** } if (!hasTrains && possibleActions.getType(BuyTrain.class).isEmpty() ! && cheapestTrain != null && presidentMayHelp) { ! possibleActions.add(new BuyTrain(cheapestTrain, ! cheapestTrain.getHolder(), costOfCheapestTrain) ! .setPresidentMustAddCash(costOfCheapestTrain ! - cash)); } } --- 2144,2153 ---- } if (!hasTrains && possibleActions.getType(BuyTrain.class).isEmpty() ! && cheapestTrain != null && presidentMayHelp) { ! BuyTrain bt = new BuyTrain(cheapestTrain, ! cheapestTrain.getHolder(), costOfCheapestTrain); ! bt.setPresidentMustAddCash(costOfCheapestTrain); ! bt.setHasNoTrains(!hasTrains); // TEMPORARY ! possibleActions.add(bt); } } |