From: Erik V. <ev...@us...> - 2010-01-19 19:51:21
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20628/rails/ui/swing Modified Files: ORUIManager.java Log Message: Localized extra tile and token messages by calling new getInfo() methods Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** ORUIManager.java 14 Jan 2010 20:46:59 -0000 1.45 --- ORUIManager.java 19 Jan 2010 19:51:02 -0000 1.46 *************** *** 185,192 **** if (localStep == ORUIManager.SELECT_HEX_FOR_TILE) { /* Compose prompt for tile laying */ - int tileNumber; StringBuffer normalTileMessage = new StringBuffer(" "); - StringBuffer extraTileMessage = new StringBuffer(" "); - StringBuffer specialTiles = new StringBuffer("#"); List<LayTile> tileLays = possibleActions.getType(LayTile.class); --- 185,189 ---- *************** *** 207,231 **** if (sp != null && sp instanceof SpecialTileLay) { SpecialTileLay stl = (SpecialTileLay) sp; ! if (extraTileMessage.length() > 1) ! extraTileMessage.append(", "); ! extraTileMessage.append(stl.getLocationNameString()).append( ! " (").append(stl.isExtra() ? "" : "not ").append( ! "extra"); ! for (MapHex hex : stl.getLocations()) { ! if (hex.getTileCost() > 0) { ! extraTileMessage.append(", ").append( ! stl.isFree() ? "" : "not ").append(" free"); ! break; ! } ! } ! extraTileMessage.append(")"); ! if ((tileNumber = stl.getTileNumber()) > 0) { ! if (specialTiles.length() > 1) ! specialTiles.append(", "); ! specialTiles.append(tileNumber); ! if (Util.hasValue(stl.getName())) { ! specialTiles.insert(0, stl.getName() + " "); ! } ! } } else if ((tileColours = tileLay.getTileColours()) != null) { int number; --- 204,208 ---- if (sp != null && sp instanceof SpecialTileLay) { SpecialTileLay stl = (SpecialTileLay) sp; ! extraMessage += "<br>" + stl.getHelp(); } else if ((tileColours = tileLay.getTileColours()) != null) { int number; *************** *** 241,253 **** } } - if (specialTiles.length() > 1) { - extraMessage += - LocalText.getText("SpecialTile", - specialTiles.toString(), - extraTileMessage.toString() ); - } else if (extraTileMessage.length() > 1) { - extraMessage += - LocalText.getText("ExtraTile", extraTileMessage); - } if (normalTileMessage.length() > 1) { message += --- 218,221 ---- *************** *** 262,266 **** String locations; StringBuffer normalTokenMessage = new StringBuffer(" "); - StringBuffer extraTokenMessage = new StringBuffer(" "); List<LayBaseToken> tokenLays = --- 230,233 ---- *************** *** 272,293 **** log.debug("TokenLay object " + (++ii) + ": " + tokenLay); sp = tokenLay.getSpecialProperty(); - /* - * A LayToken object contais either: 1. a special property - * (specifying a location) 2. a location (perhaps a list of?) - * where a token of a specified company (the currently operating - * one) may be laid, or 3. null location and the currently - * operating company. The last option is only a stopgap as we - * can't yet determine connectivity. - */ if (sp != null && sp instanceof SpecialTokenLay) { ! if (extraTokenMessage.length() > 1) ! extraTokenMessage.append(", "); ! extraTokenMessage.append( ! ((SpecialTokenLay) sp).getLocationCodeString()).append( ! " (").append( ! ((SpecialTokenLay) sp).isExtra() ? "" : "not ").append( ! "extra, ").append( ! ((SpecialTokenLay) sp).isFree() ? "" : "not ").append( ! "free)"); } else if ((locations = tokenLay.getLocationNameString()) != null) { if (normalTokenMessage.length() > 1) { --- 239,244 ---- log.debug("TokenLay object " + (++ii) + ": " + tokenLay); sp = tokenLay.getSpecialProperty(); if (sp != null && sp instanceof SpecialTokenLay) { ! extraMessage += "<br>" + sp.getHelp(); } else if ((locations = tokenLay.getLocationNameString()) != null) { if (normalTokenMessage.length() > 1) { *************** *** 298,314 **** } } - if (extraTokenMessage.length() > 1) { - extraMessage += - LocalText.getText("ExtraToken", extraTokenMessage); - } if (normalTokenMessage.length() > 1) { ! message += ! " " ! + LocalText.getText("NormalToken", normalTokenMessage); } } if (extraMessage.length() > 0) { ! message += "<br><font color=\"red\">" + extraMessage + "</font>"; } --- 249,259 ---- } } if (normalTokenMessage.length() > 1) { ! message += " " + LocalText.getText("NormalToken", normalTokenMessage); } } if (extraMessage.length() > 0) { ! message += "<font color=\"red\">" + extraMessage + "</font>"; } *************** *** 1294,1303 **** for (LayBonusToken btAction : bonusTokenActions) { SpecialTokenLay stl = btAction.getSpecialProperty(); ! BonusToken token = (BonusToken) stl.getToken(); ! String text = ! LocalText.getText("LayBonusToken", ! token.toString(), ! stl.getLocationCodeString() ); ! orPanel.addSpecialAction(btAction, text); } } --- 1239,1248 ---- for (LayBonusToken btAction : bonusTokenActions) { SpecialTokenLay stl = btAction.getSpecialProperty(); ! //BonusToken token = (BonusToken) stl.getToken(); ! //String text = ! // LocalText.getText("LayBonusToken", ! // token.toString(), ! // stl.getLocationCodeString() ); ! orPanel.addSpecialAction(btAction, stl.toMenu()); } } |