|
From: <ev...@us...> - 2011-02-05 20:00:23
|
Revision: 1481
http://rails.svn.sourceforge.net/rails/?rev=1481&view=rev
Author: evos
Date: 2011-02-05 20:00:15 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
Fix: in 1835, tile laying can hang if OBB owner lays first OBB special property tile.
Modified Paths:
--------------
trunk/18xx/rails/game/Game.java
trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java
Modified: trunk/18xx/rails/game/Game.java
===================================================================
--- trunk/18xx/rails/game/Game.java 2011-02-05 15:10:22 UTC (rev 1480)
+++ trunk/18xx/rails/game/Game.java 2011-02-05 20:00:15 UTC (rev 1481)
@@ -13,7 +13,7 @@
import rails.util.Tag;
public class Game {
- public static final String version = "1.4.1";
+ public static final String version = "1.4.1+";
/** The component Manager */
protected ComponentManager componentManager;
Modified: trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java
===================================================================
--- trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java 2011-02-05 15:10:22 UTC (rev 1480)
+++ trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java 2011-02-05 20:00:15 UTC (rev 1481)
@@ -219,10 +219,12 @@
}
@Override
public boolean layTile(LayTile action) {
+
+ boolean hasJustLaidExtraOBBTile = action.getSpecialProperty() != null
+ && action.getSpecialProperty().getLocationNameString().matches("M1(5|7)");
// The extra OBB tiles may not both be laid in the same round
- if (action.getSpecialProperty() != null
- && action.getSpecialProperty().getLocationNameString().matches("M1(5|7)")) {
+ if (hasJustLaidExtraOBBTile) {
if (hasLaidExtraOBBTile.booleanValue()) {
String errMsg = LocalText.getText("InvalidTileLay");
DisplayBuffer.add(LocalText.getText("CannotLayTileOn",
@@ -232,14 +234,18 @@
Bank.format(0),
errMsg ));
return false;
+ } else {
+ hasLaidExtraOBBTile.set(true);
+ // Done here to make getSpecialTileLays() return the correct value.
+ // It's provisional, on the assumption that other validations are OK.
}
}
boolean result = super.layTile(action);
- if (result && action.getSpecialProperty() != null
- && action.getSpecialProperty().getLocationNameString().matches("M1(5|7)")) {
- hasLaidExtraOBBTile.set(true);
+ if (!result && hasJustLaidExtraOBBTile) {
+ // Revert if tile lay is unsuccessful
+ hasLaidExtraOBBTile.set(false);
}
return result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|