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. |
From: <ev...@us...> - 2010-10-11 17:19:08
|
Revision: 1442 http://rails.svn.sourceforge.net/rails/?rev=1442&view=rev Author: evos Date: 2010-10-11 17:19:02 +0000 (Mon, 11 Oct 2010) Log Message: ----------- Check company order after each turn. If changed, recreate ORPanel. 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-11 17:18:21 UTC (rev 1441) +++ trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-11 17:19:02 UTC (rev 1442) @@ -1433,6 +1433,9 @@ if (oRound.getOperatingCompanyIndex() != orCompIndex) { if (orCompIndex >= 0) orPanel.finishORCompanyTurn(orCompIndex); + + // Check if sequence has changed + checkORCompanySequence(companies, oRound.getOperatingCompanies()); setORCompanyTurn(oRound.getOperatingCompanyIndex()); } @@ -1669,6 +1672,18 @@ } + /** Redraw the ORPanel if the company operating order has changed */ + protected void checkORCompanySequence (PublicCompanyI[] oldCompanies, List<PublicCompanyI> newCompanies) { + for (int i=0; i<newCompanies.size(); i++) { + if (newCompanies.get(i) != oldCompanies[i]) { + log.debug("Detected a OR company sequence change: "+oldCompanies[i].getName() + +" becomes "+newCompanies.get(i).getName()); + } + orPanel.recreate(oRound); + return; + } + } + public void setORCompanyTurn(int orCompIndex) { this.orCompIndex = orCompIndex; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-10-11 17:31:40
|
Revision: 1446 http://rails.svn.sourceforge.net/rails/?rev=1446&view=rev Author: evos Date: 2010-10-11 17:31:34 +0000 (Mon, 11 Oct 2010) Log Message: ----------- Fix 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-11 17:22:49 UTC (rev 1445) +++ trunk/18xx/rails/ui/swing/ORUIManager.java 2010-10-11 17:31:34 UTC (rev 1446) @@ -1678,10 +1678,11 @@ if (newCompanies.get(i) != oldCompanies[i]) { log.debug("Detected a OR company sequence change: "+oldCompanies[i].getName() +" becomes "+newCompanies.get(i).getName()); + orPanel.recreate(oRound); + break; } - orPanel.recreate(oRound); - return; } + return; } public void setORCompanyTurn(int orCompIndex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |