|
From: <ste...@us...> - 2010-08-10 21:52:25
|
Revision: 1377
http://rails.svn.sourceforge.net/rails/?rev=1377&view=rev
Author: stefanfrey
Date: 2010-08-10 21:52:19 +0000 (Tue, 10 Aug 2010)
Log Message:
-----------
Made numOfORs a state integer variable to support undo behavior
Modified Paths:
--------------
trunk/18xx/rails/game/GameManager.java
trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java
Modified: trunk/18xx/rails/game/GameManager.java
===================================================================
--- trunk/18xx/rails/game/GameManager.java 2010-08-10 21:51:07 UTC (rev 1376)
+++ trunk/18xx/rails/game/GameManager.java 2010-08-10 21:52:19 UTC (rev 1377)
@@ -108,7 +108,7 @@
new IntegerState("AbsoluteORNUmber");
protected IntegerState relativeORNumber =
new IntegerState("RelativeORNumber");
- protected int numOfORs;
+ protected IntegerState numOfORs = new IntegerState("numOfORs");
protected BooleanState gameOver = new BooleanState("GameOver" ,false);
protected Boolean gameOverReportedUI = false;
@@ -567,7 +567,9 @@
} else if (skipFirstStockRound) {
PhaseI currentPhase =
phaseManager.getCurrentPhase();
- numOfORs = currentPhase.getNumberOfOperatingRounds();
+ if (currentPhase.getNumberOfOperatingRounds() != numOfORs.intValue()) {
+ numOfORs.set(currentPhase.getNumberOfOperatingRounds());
+ }
log.info("Phase=" + currentPhase.getName() + " ORs=" + numOfORs);
// Create a new OperatingRound (never more than one Stock Round)
@@ -581,7 +583,7 @@
} else if (round instanceof StockRound) {
PhaseI currentPhase = getCurrentPhase();
if (currentPhase == null) log.error ("Current Phase is null??", new Exception (""));
- numOfORs = currentPhase.getNumberOfOperatingRounds();
+ numOfORs.set(currentPhase.getNumberOfOperatingRounds());
log.info("Phase=" + currentPhase.getName() + " ORs=" + numOfORs);
// Create a new OperatingRound (never more than one Stock Round)
@@ -594,7 +596,7 @@
finishGame();
- } else if (relativeORNumber.add(1) <= numOfORs) {
+ } else if (relativeORNumber.add(1) <= numOfORs.intValue()) {
// There will be another OR
startOperatingRound(true);
} else if (startPacket != null && !startPacket.areAllSold()) {
@@ -697,7 +699,7 @@
}
public String getNumOfORs () {
- return new Integer(numOfORs).toString();
+ return numOfORs.getText();
}
/* (non-Javadoc)
@@ -1639,7 +1641,6 @@
}
return cm;
}
-
/** Return a list of companies in operation order.
* <p>Note that, unlike Round.setOperatingCompanies(), this method does <b>not</b> check
* if the companies are actualy allowed to operate. One purpose is to check for upping the
Modified: trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java
===================================================================
--- trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java 2010-08-10 21:51:07 UTC (rev 1376)
+++ trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java 2010-08-10 21:52:19 UTC (rev 1377)
@@ -19,7 +19,7 @@
public void nextRound(RoundI round) {
if (round instanceof OperatingRound_18EU) {
if (playerToStartFMERound.getObject() != null
- && relativeORNumber.intValue() == numOfORs) {
+ && relativeORNumber.intValue() == numOfORs.intValue()) {
createRound (FinalMinorExchangeRound.class).start
((Player)playerToStartFMERound.getObject());
playerToStartFMERound.set(null);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|