From: Stefan F. <ste...@us...> - 2010-04-09 17:49:38
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv26622/rails/ui/swing Modified Files: ORUIManager.java Log Message: Updated Lay Tile and Token Hints Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** ORUIManager.java 9 Apr 2010 07:20:27 -0000 1.63 --- ORUIManager.java 9 Apr 2010 17:49:31 -0000 1.64 *************** *** 189,200 **** nextSubStep = ORUIManager.SELECT_HEX_FOR_TILE; mapPanel.setAllowedTileLays(allowedTileLays); ! // generate network graph to indicate the allowed tiles ! hexUpgrades = NetworkGraphBuilder.getMapHexes(getCompanyGraph()); ! for (MapHex hex:hexUpgrades) { ! if (hex.isUpgradeableNow()){ GUIHex guiHex = map.getHexByName(hex.getName()); ! guiHex.setSelectable(true); } } } --- 189,234 ---- nextSubStep = ORUIManager.SELECT_HEX_FOR_TILE; mapPanel.setAllowedTileLays(allowedTileLays); ! // if hexupgrades is not null, then remove indicators ! if (hexUpgrades != null) { ! for (MapHex hex:hexUpgrades) { GUIHex guiHex = map.getHexByName(hex.getName()); ! guiHex.setSelectable(false); ! } ! } ! ! // check actions for allowed hexes ! boolean mapHexes = false; ! hexUpgrades = new ArrayList<MapHex>(); ! for (LayTile layTile:allowedTileLays) { ! switch (layTile.getType()) { ! case (LayTile.GENERIC): ! mapHexes = true; ! break; ! case (LayTile.SPECIAL_PROPERTY): ! SpecialPropertyI sp = layTile.getSpecialProperty(); ! if (sp == null || !(sp instanceof SpecialTileLay) || ! ((SpecialTileLay)sp).requiresConnection()) ! break; ! case (LayTile.LOCATION_SPECIFIC): ! if (layTile.getLocations() != null) ! hexUpgrades.addAll(layTile.getLocations()); ! } ! } ! ! // standard upgrades ! if (mapHexes) { ! // generate network graph to indicate the allowed tiles ! List<MapHex> mapHexUpgrades = NetworkGraphBuilder.getMapHexes(getCompanyGraph()); ! for (MapHex hex:mapHexUpgrades) { ! if (hex.isUpgradeableNow(gameUIManager.getCurrentPhase())) ! hexUpgrades.add(hex); } } + + // activate upgrades + for (MapHex hex:hexUpgrades) { + GUIHex guiHex = map.getHexByName(hex.getName()); + guiHex.setSelectable(true); + } } *************** *** 202,209 **** nextSubStep = ORUIManager.SELECT_HEX_FOR_TOKEN; mapPanel.setAllowedTokenLays(allowedTokenLays); ! // generate network graph to indicate the token lays ! hexUpgrades = NetworkGraphBuilder.getStationHexes(getCompanyGraph(), true); ! for (MapHex hex:hexUpgrades) { ! if (hex.hasTokenSlotsLeft()){ GUIHex guiHex = map.getHexByName(hex.getName()); guiHex.setSelectable(true); --- 236,267 ---- nextSubStep = ORUIManager.SELECT_HEX_FOR_TOKEN; mapPanel.setAllowedTokenLays(allowedTokenLays); ! // if hexupgrades is not null, then remove indicators ! if (hexUpgrades != null) { ! for (MapHex hex:hexUpgrades) { ! GUIHex guiHex = map.getHexByName(hex.getName()); ! guiHex.setSelectable(false); ! } ! } ! ! // check actions for allowed hexes ! boolean mapHexes = false; ! hexUpgrades = new ArrayList<MapHex>(); ! for (LayToken layToken:allowedTokenLays) { ! SpecialPropertyI sp = layToken.getSpecialProperty(); ! if (sp == null) { ! mapHexes = true; ! } else if (layToken.getLocations() != null) ! hexUpgrades.addAll(layToken.getLocations()); ! } ! ! // standard tokens ! if (mapHexes) { ! // generate network graph to indicate the token lays ! hexUpgrades = NetworkGraphBuilder.getStationHexes(getCompanyGraph(), orComp); ! for (LayToken layToken:allowedTokenLays) { ! if (layToken.getLocations() != null) ! hexUpgrades.addAll(layToken.getLocations()); ! } ! for (MapHex hex:hexUpgrades) { GUIHex guiHex = map.getHexByName(hex.getName()); guiHex.setSelectable(true); |