From: Erik V. <ev...@us...> - 2009-11-20 20:57:01
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9296/rails/game/action Modified Files: BuyTrain.java Log Message: Allow not buying a train when trainless, with a warning that this is only allowed without a route Index: BuyTrain.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/BuyTrain.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BuyTrain.java 4 Nov 2009 20:33:21 -0000 1.11 --- BuyTrain.java 20 Nov 2009 20:56:51 -0000 1.12 *************** *** 27,30 **** --- 27,31 ---- private String fromName; private int fixedCost = 0; + private boolean hasNoTrains = false; // TODO Remove once route checking exists transient private List<TrainI> trainsForExchange = null; private String[] trainsForExchangeUniqueIds; *************** *** 88,92 **** } ! /** * @return Returns the specialProperty. */ --- 89,97 ---- } ! public void setHasNoTrains(boolean hasNoTrains) { ! this.hasNoTrains = hasNoTrains; ! } ! ! /** * @return Returns the specialProperty. */ *************** *** 143,147 **** } ! public Portfolio getHolder() { return train.getHolder(); } --- 148,156 ---- } ! public boolean hasNoTrains() { ! return hasNoTrains; ! } ! ! public Portfolio getHolder() { return train.getHolder(); } *************** *** 220,224 **** ClassNotFoundException { ! in.defaultReadObject(); GameManagerI gameManager = GameManager.getInstance(); --- 229,245 ---- ClassNotFoundException { ! //in.defaultReadObject(); ! // TEMPORARY Custom reading for backwards compatibility ! // TODO We need this code only until route checking is implemented, ! // as then it will be possible to detect route existence. ! ObjectInputStream.GetField fields = in.readFields(); ! trainUniqueId = (String) fields.get("trainUniqueId", trainUniqueId); ! fromName = (String) fields.get("fromName", fromName); ! fixedCost = fields.get("fixedCost", fixedCost); ! hasNoTrains = fields.get("hasNoTrains", hasNoTrains);//TEMPORARY ! trainsForExchangeUniqueIds = (String[]) fields.get("trainsForExchangeUniqueIds", trainsForExchangeUniqueIds); ! presidentMustAddCash = fields.get("presidentMustAddCash", presidentMustAddCash); ! presidentMayAddCash = fields.get("presidentMayAddCash", presidentMayAddCash); ! presidentCashToAdd = fields.get("presidentCashToAdd", presidentCashToAdd); GameManagerI gameManager = GameManager.getInstance(); |