|
From: <ev...@us...> - 2010-10-08 19:26:17
|
Revision: 1438
http://rails.svn.sourceforge.net/rails/?rev=1438&view=rev
Author: evos
Date: 2010-10-08 19:26:11 +0000 (Fri, 08 Oct 2010)
Log Message:
-----------
Fix: always display Buy Train button in train buying step.
Grey out button if no possible train actions exist.
Modified Paths:
--------------
trunk/18xx/rails/ui/swing/ORUIManager.java
Modified: trunk/18xx/rails/ui/swing/ORUIManager.java
===================================================================
--- trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-08 19:25:05 UTC (rev 1437)
+++ trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-08 19:26:11 UTC (rev 1438)
@@ -18,9 +18,7 @@
import rails.ui.swing.elements.*;
import rails.ui.swing.hexmap.GUIHex;
import rails.ui.swing.hexmap.HexMap;
-import rails.util.Config;
-import rails.util.LocalText;
-import rails.util.Util;
+import rails.util.*;
public class ORUIManager implements DialogOwner {
@@ -199,7 +197,7 @@
// check actions for allowed hexes
boolean mapHexes = false;
hexUpgrades = new ArrayList<MapHex>();
-
+
if (gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.ROUTE_HIGHLIGHT)) {
for (LayTile layTile:allowedTileLays) {
switch (layTile.getType()) {
@@ -240,7 +238,7 @@
GUIHex guiHex = map.getHexByName(hex.getName());
guiHex.setSelectable(true);
}
-
+
}
}
@@ -909,7 +907,7 @@
PublicCompanyI company = token.getCompany();
List<String> prompts = new ArrayList<String>();
-
+
Map<String, Station> promptToStationMap = new HashMap<String, Station>();
String prompt;
for (Station station:possibleStations) {
@@ -936,8 +934,8 @@
Station station = promptToStationMap.get(selected);
return station;
}
-
-
+
+
/**
* Lay Token finished.
*
@@ -1419,7 +1417,7 @@
mapRelatedActions.clear();
orPanel.resetActions();
-
+
messagePanel.setMessage(null);
if (actionToComplete != null) {
@@ -1446,22 +1444,21 @@
// initialize operating costs actions
orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class));
- // initial deactivation of MapTileCorrection Actions
+ // initial deactivation of MapTileCorrection Actions
mapCorrectionEnabled = false;
mapCorrectionAction = null;
-
+
// initial deactivation of revenue calculation
if (!possibleActions.contains(SetDividend.class)) {
orPanel.stopRevenueUpdate();
orPanel.resetCurrentRevenueDisplay();
}
-
+
if (possibleActions.contains(MapCorrectionAction.class)) {
orPanel.initTileLayingStep();
orWindow.requestFocus();
- MapCorrectionAction action = (MapCorrectionAction)
- (possibleActions.getType(MapCorrectionAction.class)).get(0);
+ MapCorrectionAction action = (possibleActions.getType(MapCorrectionAction.class)).get(0);
mapCorrectionEnabled = true;
mapCorrectionAction = action;
@@ -1526,9 +1523,10 @@
}
setMessage(message);
- } else if (possibleActions.contains(BuyTrain.class)) {
+ } else if (orStep == GameDef.OrStep.BUY_TRAIN) {
- orPanel.initTrainBuying(true);
+ boolean canBuyTrain = possibleActions.contains(BuyTrain.class);
+ orPanel.initTrainBuying(canBuyTrain);
StringBuffer b = new StringBuffer(LocalText.getText("BuyTrain"));
@@ -1846,7 +1844,7 @@
upgradePanel.setCancelEnabled(true);
showTilesInUpgrade = true;
}
-
+
log.debug("Active map tile correction");
if (showTilesInUpgrade) {
upgradePanel.showCorrectionTileUpgrades();
@@ -1858,11 +1856,11 @@
public void setMessage(String message) {
messagePanel.setMessage(message);
}
-
+
public void addInformation(String infoText) {
messagePanel.addInformation(infoText);
}
-
+
public void addDetail(String detailText) {
messagePanel.addDetail(detailText);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|