From: Erik V. <ev...@us...> - 2010-01-22 21:21:31
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15092/rails/game Modified Files: GameManager.java Log Message: <GameOption> tags are processed again (and it's now documented why) Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** GameManager.java 20 Jan 2010 19:52:44 -0000 1.80 --- GameManager.java 22 Jan 2010 21:21:15 -0000 1.81 *************** *** 206,215 **** initGameParameters(); ! // Get any available game options ! /* THIS IS NOT CURRENTLY USED, but I leave it in for another while (EV) GameOption option; String optionName, optionType, optionValues, optionDefault; String optionNameParameters; ! List<Tag> optionTags = tag.getChildren(OPTION_TAG); if (optionTags != null) { for (Tag optionTag : optionTags) { --- 206,219 ---- initGameParameters(); ! /* Check the game options provided with the game. ! * These duplicate the game options in Game.xml, but are still ! * required here to set default values when loading a game from ! * a save file, as in that case the options in GamesList.xml are ! * not included. ! * */ GameOption option; String optionName, optionType, optionValues, optionDefault; String optionNameParameters; ! List<Tag> optionTags = tag.getChildren("GameOption"); if (optionTags != null) { for (Tag optionTag : optionTags) { *************** *** 217,220 **** --- 221,227 ---- if (optionName == null) throw new ConfigurationException("GameOption without name"); + if (gameOptions.containsKey(optionName)) continue; + + // Include missing option option = new GameOption(optionName); availableGameOptions.add(option); *************** *** 228,237 **** if (optionValues != null) option.setAllowedValues(optionValues.split(",")); ! optionDefault = optionTag.getAttributeAsString("default"); if (optionDefault != null) option.setDefaultValue(optionDefault); } } ! */ Tag gameParmTag = tag.getChild("GameParameters"); --- 235,246 ---- if (optionValues != null) option.setAllowedValues(optionValues.split(",")); ! optionDefault = optionTag.getAttributeAsString("default", ""); if (optionDefault != null) option.setDefaultValue(optionDefault); + + gameOptions.put(optionName, optionDefault); } } ! Tag gameParmTag = tag.getChild("GameParameters"); |