Update of /cvsroot/rails/18xx/rails/game
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7185/rails/game
Modified Files:
OperatingRound.java
Log Message:
Fixes to 18EU Pullmann problems
Index: OperatingRound.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** OperatingRound.java 19 Jan 2010 19:54:50 -0000 1.92
--- OperatingRound.java 24 Jan 2010 16:21:28 -0000 1.93
***************
*** 1312,1316 ****
// Does the company have room for another train?
int trainLimit = operatingCompany.getCurrentTrainLimit();
! if (!isBelowTrainLimit() && !action.isForcedExchange()) {
errMsg =
LocalText.getText("WouldExceedTrainLimit",
--- 1312,1316 ----
// Does the company have room for another train?
int trainLimit = operatingCompany.getCurrentTrainLimit();
! if (!canBuyTrainNow() && !action.isForcedExchange()) {
errMsg =
LocalText.getText("WouldExceedTrainLimit",
***************
*** 2068,2072 ****
boolean atTrainLimit =
operatingCompany.getNumberOfTrains() >= operatingCompany.getCurrentTrainLimit();
! boolean canBuyTrainNow = isBelowTrainLimit();
boolean presidentMayHelp = !hasTrains && operatingCompany.mustOwnATrain();
TrainI cheapestTrain = null;
--- 2068,2072 ----
boolean atTrainLimit =
operatingCompany.getNumberOfTrains() >= operatingCompany.getCurrentTrainLimit();
! boolean canBuyTrainNow = canBuyTrainNow();
boolean presidentMayHelp = !hasTrains && operatingCompany.mustOwnATrain();
TrainI cheapestTrain = null;
***************
*** 2234,2237 ****
--- 2234,2248 ----
return operatingCompany.getNumberOfTrains() < operatingCompany.getCurrentTrainLimit();
}
+
+ /**
+ * Can the company buy a train now?
+ * Normally only calls isBelowTrainLimit() to get the result.
+ * May be overridden if other considerations apply (such as
+ * having a Pullmann in 18EU).
+ * @return
+ */
+ protected boolean canBuyTrainNow () {
+ return isBelowTrainLimit();
+ }
protected void setTrainsToDiscard() {
|