You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: <ste...@us...> - 2011-07-07 04:53:42
|
Revision: 1607 http://rails.svn.sourceforge.net/rails/?rev=1607&view=rev Author: stefanfrey Date: 2011-07-07 04:53:35 +0000 (Thu, 07 Jul 2011) Log Message: ----------- Added support for runTo and runThrough properties of MapHex to revenue calculation Modified Paths: -------------- trunk/18xx/rails/algorithms/NetworkCompanyGraph.java trunk/18xx/rails/algorithms/NetworkVertex.java trunk/18xx/rails/algorithms/RevenueAdapter.java Modified: trunk/18xx/rails/algorithms/NetworkCompanyGraph.java =================================================================== --- trunk/18xx/rails/algorithms/NetworkCompanyGraph.java 2011-07-06 13:13:50 UTC (rev 1606) +++ trunk/18xx/rails/algorithms/NetworkCompanyGraph.java 2011-07-07 04:53:35 UTC (rev 1607) @@ -52,12 +52,24 @@ return new NetworkCompanyGraph(graphBuilder, company); } + public SimpleGraph<NetworkVertex, NetworkEdge> getRouteGraph() { + return routeGraph; + } + + public SimpleGraph<NetworkVertex, NetworkEdge> getRevenueGraph() { + return revenueGraph; + } + + public Multigraph<NetworkVertex, NetworkEdge> getPhase2Graph() { + return phase2Graph; + } + public SimpleGraph<NetworkVertex, NetworkEdge> createRouteGraph(boolean addHQ) { // get mapgraph from builder SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = graphBuilder.getMapGraph(); // set sinks on mapgraph - NetworkVertex.initAllRailsVertices(mapGraph.vertexSet(), company, null); + NetworkVertex.initAllRailsVertices(mapGraph, company, null); // initialized simple graph SimpleGraph<NetworkVertex, NetworkEdge> graph = new SimpleGraph<NetworkVertex, NetworkEdge>(NetworkEdge.class); @@ -93,7 +105,7 @@ if (!addHQ) graph.removeVertex(hqVertex); // deactivate sinks on mapgraph - NetworkVertex.initAllRailsVertices(mapGraph.vertexSet(), null, null); + NetworkVertex.initAllRailsVertices(mapGraph, null, null); // store and return routeGraph = graph; Modified: trunk/18xx/rails/algorithms/NetworkVertex.java =================================================================== --- trunk/18xx/rails/algorithms/NetworkVertex.java 2011-07-06 13:13:50 UTC (rev 1606) +++ trunk/18xx/rails/algorithms/NetworkVertex.java 2011-07-07 04:53:35 UTC (rev 1607) @@ -10,6 +10,7 @@ import java.util.Set; import org.apache.log4j.Logger; +import org.jgrapht.Graph; import org.jgrapht.graph.SimpleGraph; import rails.game.City; @@ -227,13 +228,22 @@ /** * Initialize for rails vertexes + * @return true = can stay inside the network, false = has to be removed */ - public void initRailsVertex(PublicCompanyI company) { + public boolean initRailsVertex(PublicCompanyI company) { // side vertices use the defaults, virtuals cannot use this function - if (virtual || type == VertexType.SIDE) return; + if (virtual || type == VertexType.SIDE) return true; log.info("Init of vertex " + this); + // check if it has to be removed because it is run-to only + if (company != null) { // if company == null, then no vertex gets removed + if (hex.isRunToAllowed() == MapHex.Run.NO || hex.isRunToAllowed() == MapHex.Run.TOKENONLY && !city.hasTokenOf(company)) + { + return false; + } + } + // check if it is a major or minor if (station.getType().equals(Station.CITY) || station.getType().equals(Station.OFF_MAP_AREA)) { setStationType(StationType.MAJOR); @@ -245,8 +255,14 @@ // check if it is a sink if (company == null) { // if company == null, then all sinks are deactivated sink = false; - } else if (station.getType().equals(Station.OFF_MAP_AREA) || - station.getType().equals(Station.CITY) && !city.hasTokenSlotsLeft() && city.getSlots() != 0 && !city.hasTokenOf(company)) { + } else if (station.getType().equals(Station.OFF_MAP_AREA) || ( + // or station is city + station.getType().equals(Station.CITY) + // and is either fully tokened and has token slots or only tokens allow run through + && ( city.getSlots() != 0 && !city.hasTokenSlotsLeft() || hex.isRunThroughAllowed() == MapHex.Run.TOKENONLY) + // and city does not have a token + && !city.hasTokenOf(company)) + ) { sink = true; } @@ -262,6 +278,10 @@ cityName = hex.getCityName() + "." + station.getCityName(); } } + + // no removal + return true; + } public void setRailsVertexValue(PhaseI phase) { @@ -269,7 +289,6 @@ if (virtual || type == VertexType.SIDE) return; // define value -// if (station.getType().equals(Station.OFF_MAP_AREA) || station.getValue() == -1) { if (hex.hasOffBoardValues()) { value = hex.getCurrentOffBoardValue(phase); } else { @@ -308,14 +327,28 @@ } } - public static void initAllRailsVertices(Collection<NetworkVertex> vertices, + /** + * + * @param graph network graph + * @param company the company (with regard to values, sinks and removals) + * @param phase the current phase (with regard to values) + */ + public static void initAllRailsVertices(Graph<NetworkVertex, NetworkEdge> graph, PublicCompanyI company, PhaseI phase) { - for (NetworkVertex v:vertices) { - if (company != null) - v.initRailsVertex(company); - if (phase != null) + + // store vertices for removal + List<NetworkVertex> verticesToRemove = new ArrayList<NetworkVertex>(); + for (NetworkVertex v:graph.vertexSet()) { + if (company != null) { + if (!v.initRailsVertex(company)) { + verticesToRemove.add(v); + } + } + if (phase != null) { v.setRailsVertexValue(phase); + } } + graph.removeAllVertices(verticesToRemove); } /** Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-06 13:13:50 UTC (rev 1606) +++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-07 04:53:35 UTC (rev 1607) @@ -208,7 +208,7 @@ graph = companyGraph.createRouteGraph(false); // initialize vertices - NetworkVertex.initAllRailsVertices(graph.vertexSet(), company, phase); + NetworkVertex.initAllRailsVertices(graph, company, phase); // define startVertexes addStartVertices(companyGraph.getCompanyBaseTokenVertexes(company)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-07-06 13:13:56
|
Revision: 1606 http://rails.svn.sourceforge.net/rails/?rev=1606&view=rev Author: evos Date: 2011-07-06 13:13:50 +0000 (Wed, 06 Jul 2011) Log Message: ----------- Phase management step 1: added <NewPhase> tag to 18TN. Added phases 3?\194?\189 and 6?\194?\189. Fixed incorrect 2- and 3-train obsolescence for 18TN. Modified Paths: -------------- trunk/18xx/data/18TN/CompanyManager.xml trunk/18xx/data/18TN/Game.xml trunk/18xx/rails/game/TrainCertificateType.java trunk/18xx/rails/game/TrainManager.java Modified: trunk/18xx/data/18TN/CompanyManager.xml =================================================================== --- trunk/18xx/data/18TN/CompanyManager.xml 2011-07-06 05:39:16 UTC (rev 1605) +++ trunk/18xx/data/18TN/CompanyManager.xml 2011-07-06 13:13:50 UTC (rev 1606) @@ -13,17 +13,15 @@ <Float percentage="60"/> <ShareUnit percentage="10"/> <BaseTokens> - <!-- HomeBase lay options: "whenStarted", "whenFloated", "firstOR" (default) --> <HomeBase lay="firstOR"/> - <!-- LayCost methods: only "sequence" (1830 style) implemented so far (default) --> <LayCost method="sequence" cost="0,40,100"/> </BaseTokens> <Certificate type="President" shares="2"/> <Certificate shares="1" number="8"/> - <Trains limit="4,4,3,2"/> + <Trains limit="4,4,4,3,2"/> <CanUseSpecialProperties/> <TileLays> - <Number colour="yellow" phase="3,4,5,6,8" number="2"/> + <Number colour="yellow" phase="3,3½,4,5,6,6½,8" number="2"/> </TileLays> </CompanyType> Modified: trunk/18xx/data/18TN/Game.xml =================================================================== --- trunk/18xx/data/18TN/Game.xml 2011-07-06 05:39:16 UTC (rev 1605) +++ trunk/18xx/data/18TN/Game.xml 2011-07-06 13:13:50 UTC (rev 1606) @@ -66,6 +66,7 @@ cities="double" if city-revenue is doubled (e.g. 1826 TGV). --> </Defaults> + <!-- <TrainType name="2" majorStops="2" cost="80" quantity="5" obsoleting="yes"/> <TrainType name="3" majorStops="3" cost="180" quantity="5" obsoleting="yes" startPhase="3"/> <TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes" startPhase="4" @@ -77,6 +78,27 @@ </TrainType> <TrainType name="8" majorStops="8" cost="700" quantity="7" startPhase="8" rustedTrain="4" /> + --> + <TrainType name="2" majorStops="2" cost="80" quantity="5"/> + <TrainType name="3" majorStops="3" cost="180" quantity="5"> + <NewPhase phaseName="3"/> + <NewPhase phaseName="3½" trainIndex="4"/> + </TrainType> + <TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes" + rustedTrain="2"> + <NewPhase phaseName="4"/> + </TrainType> + <TrainType name="5" majorStops="5" cost="450" quantity="2"> + <NewPhase phaseName="5"/> + </TrainType> + <TrainType name="6" majorStops="6" cost="630" quantity="2" rustedTrain="3"> + <NewPhase phaseName="6"/> + <NewPhase phaseName="6½" trainIndex="2"/> + <Sub index="2" rustedTrain="4"/> + </TrainType> + <TrainType name="8" majorStops="8" cost="700" quantity="7" rustedTrain="4"> + <NewPhase phaseName="8"/> + </TrainType> </Component> <Component name="PhaseManager" class="rails.game.PhaseManager"> <!-- Note: released and rusted trains are now specified per TrainType @@ -93,6 +115,9 @@ <Privates sellingAllowed="yes"/> <OperatingRounds number="2"/> </Phase> + <Phase name="3½"> + <Tiles colour="yellow,green"/> + </Phase> <Phase name="4"> <Tiles colour="yellow,green"/> </Phase> @@ -105,6 +130,9 @@ <Phase name="6"> <Tiles colour="yellow,green,brown"/> </Phase> + <Phase name="6½"> + <Tiles colour="yellow,green,brown"/> + </Phase> <Phase name="8"> <Tiles colour="yellow,green,brown"/> </Phase> Modified: trunk/18xx/rails/game/TrainCertificateType.java =================================================================== --- trunk/18xx/rails/game/TrainCertificateType.java 2011-07-06 05:39:16 UTC (rev 1605) +++ trunk/18xx/rails/game/TrainCertificateType.java 2011-07-06 13:13:50 UTC (rev 1606) @@ -22,6 +22,8 @@ protected List<TrainType> potentialTrainTypes = new ArrayList<TrainType>(2); + protected Map<Integer, String> newPhaseNames; + protected Map<Integer, String> rustedTrainTypeNames = null; protected Map<Integer, TrainCertificateType> rustedTrainType = null; @@ -38,9 +40,6 @@ protected String trainClassName = "rails.game.Train"; protected Class<? extends Train> trainClass; - - protected int lastIndex = 0; - // State variables protected IntegerState numberBoughtFromIPO; protected BooleanState available; @@ -99,12 +98,28 @@ for (Tag sub : tag.getChildren("Sub")) { int index = sub.getAttributeAsInteger("index"); rustedTrainTypeName1 = sub.getAttributeAsString("rustedTrain"); - if (rustedTrainTypeNames == null) { - rustedTrainTypeNames = new HashMap<Integer, String>(); - } - rustedTrainTypeNames.put(index, rustedTrainTypeName1); + if (rustedTrainTypeNames == null) { + rustedTrainTypeNames = new HashMap<Integer, String>(); } + rustedTrainTypeNames.put(index, rustedTrainTypeName1); } + } + + // New style phase changes (to replace 'startPhase' attribute and <Sub> tag) + List<Tag> newPhaseTags = tag.getChildren("NewPhase"); + if (newPhaseTags != null) { + int index; + String phaseName; + newPhaseNames = new HashMap<Integer, String>(); + for (Tag newPhaseTag : newPhaseTags) { + phaseName = newPhaseTag.getAttributeAsString("phaseName"); + if (!Util.hasValue(phaseName)) { + throw new ConfigurationException ("TrainType "+name+" has NewPhase without phase name"); + } + index = newPhaseTag.getAttributeAsInteger("trainIndex", 1); + newPhaseNames.put(index, phaseName); + } + } // Exchangeable Tag swapTag = tag.getChild("Exchange"); @@ -139,6 +154,10 @@ } } + public Map<Integer, String> getNewPhaseNames() { + return newPhaseNames; + } + public TrainI createTrain () throws ConfigurationException { TrainI train; Modified: trunk/18xx/rails/game/TrainManager.java =================================================================== --- trunk/18xx/rails/game/TrainManager.java 2011-07-06 05:39:16 UTC (rev 1605) +++ trunk/18xx/rails/game/TrainManager.java 2011-07-06 13:13:50 UTC (rev 1606) @@ -54,6 +54,10 @@ /** Required for the sell-train-to-foreigners feature of some games */ protected BooleanState anyTrainBought = new BooleanState ("AnyTrainBought", false); + + // Triggered phase changes + protected Map<TrainCertificateType, Map<Integer, Phase>> newPhases + = new HashMap<TrainCertificateType, Map<Integer, Phase>>(); // Non-game attributes protected Portfolio ipo, pool, unavailable; @@ -167,6 +171,11 @@ } } + Map<Integer, String> newPhaseNames; + Phase phase; + String phaseName; + PhaseManager phaseManager = gameManager.getPhaseManager(); + for (TrainCertificateType certType : trainCertTypes) { certType.finishConfiguration(gameManager); @@ -189,6 +198,20 @@ addTrain(train); unavailable.addTrain(train); } + + // Register any phase changes + newPhaseNames = certType.getNewPhaseNames(); + if (newPhaseNames != null && !newPhaseNames.isEmpty()) { + for (int index : newPhaseNames.keySet()) { + phaseName = newPhaseNames.get(index); + phase = (Phase)phaseManager.getPhaseByName(phaseName); + if (phase == null) { + throw new ConfigurationException ("New phase '"+phaseName+"' does not exist"); + } + if (newPhases.get(certType) == null) newPhases.put(certType, new HashMap<Integer, Phase>()); + newPhases.get(certType).put(index, phase); + } + } } @@ -301,6 +324,14 @@ trainAvailabilityChanged = true; } } + + // New style phase changes, can be triggered by any bought train. + Phase newPhase; + if (newPhases.get(boughtType) != null + && (newPhase = newPhases.get(boughtType).get(trainIndex)) != null) { + gameManager.getPhaseManager().setPhase(newPhase); + phaseHasChanged = true; + } TrainCertificateType rustedType = boughtType.getRustedTrainType(trainIndex); if (rustedType != null && !rustedType.hasRusted()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2011-07-06 05:39:23
|
Revision: 1605 http://rails.svn.sourceforge.net/rails/?rev=1605&view=rev Author: stefanfrey Date: 2011-07-06 05:39:16 +0000 (Wed, 06 Jul 2011) Log Message: ----------- Refactored save and load code into GameFileIO and GameData classes Modified Paths: -------------- trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/util/ListAndFixSavedFiles.java Added Paths: ----------- trunk/18xx/rails/util/GameData.java trunk/18xx/rails/util/GameFileIO.java Removed Paths: ------------- trunk/18xx/rails/util/GameLoader.java Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2011-07-05 17:03:23 UTC (rev 1604) +++ trunk/18xx/rails/game/Game.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -13,7 +13,7 @@ import rails.common.parser.GameFileParser; import rails.common.parser.GameOption; import rails.game.action.PossibleAction; -import rails.util.GameLoader; +import rails.util.GameFileIO; public class Game { public static final String version = "1.4.1+"; @@ -124,7 +124,7 @@ public static Game load(String filepath) { // use GameLoader object to load game - GameLoader gameLoader = new GameLoader(); + GameFileIO gameLoader = new GameFileIO(); gameLoader.loadGameData(filepath); try{ gameLoader.initGame(); Modified: trunk/18xx/rails/game/GameManager.java =================================================================== --- trunk/18xx/rails/game/GameManager.java 2011-07-05 17:03:23 UTC (rev 1604) +++ trunk/18xx/rails/game/GameManager.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -1115,31 +1115,11 @@ } protected boolean save(File file, boolean displayErrorMessage, String errorMessageKey) { - boolean result = false; - - try { - ObjectOutputStream oos = - new ObjectOutputStream(new FileOutputStream(file)); - oos.writeObject(Game.version+" "+BuildInfo.buildDate); - oos.writeObject(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); - oos.writeObject(saveFileVersionID); - oos.writeObject(gameName); - oos.writeObject(gameOptions); - oos.writeObject(playerNames); - for (PossibleAction action : executedActions) { - oos.writeObject(action); - } - oos.writeObject(ReportBuffer.getCommentItems()); - oos.close(); - - result = true; - } catch (IOException e) { - log.error(errorMessageKey, e); - if (displayErrorMessage) { - DisplayBuffer.add(LocalText.getText("SaveFailed", e.getMessage())); - } - } - return result; + GameFileIO gameSaver = new GameFileIO(); + gameSaver.initSave(saveFileVersionID, gameName, gameOptions, playerNames); + gameSaver.setActions(executedActions); + gameSaver.setComments(ReportBuffer.getCommentItems()); + return gameSaver.saveGame(file, displayErrorMessage, errorMessageKey); } /** * tries to reload the current game @@ -1149,7 +1129,7 @@ log.info("Reloading started"); /* Use gameLoader to load the game data */ - GameLoader gameLoader = new GameLoader(); + GameFileIO gameLoader = new GameFileIO(); String filepath = reloadAction.getFilepath(); gameLoader.loadGameData(filepath); Added: trunk/18xx/rails/util/GameData.java =================================================================== --- trunk/18xx/rails/util/GameData.java (rev 0) +++ trunk/18xx/rails/util/GameData.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -0,0 +1,57 @@ +package rails.util; + +import java.util.List; +import java.util.Map; +import java.util.SortedMap; + +import rails.game.action.PossibleAction; + +/** + * Combines all fields required for game IO + * Defines the complete game + * + * @author freystef + * */ + + +class GameData { + class MetaData { + String version; + String date; + Long fileVersionID; + String gameName; + }; + + MetaData meta = new MetaData(); + Map<String, String> gameOptions; + List<String> playerNames; + List<PossibleAction> actions; + SortedMap<Integer, String> userComments; + + String metaDataAsText() { + StringBuilder s = new StringBuilder(); + s.append("Rails saveVersion = " + meta.version + "\n"); + s.append("File was saved at " + meta.date + "\n"); + s.append("Saved versionID=" + meta.fileVersionID + "\n"); + s.append("Save game=" + meta.gameName + "\n"); + return s.toString(); + } + + String gameOptionsAsText() { + StringBuilder s = new StringBuilder(); + for (String key : gameOptions.keySet()) { + s.append("Option "+key+"="+gameOptions.get(key)+ "\n"); + } + return s.toString(); + } + String playerNamesAsText() { + StringBuilder s = new StringBuilder(); + int i=1; + for (String player : playerNames) { + s.append("Player "+(i++)+": "+player + "\n"); + } + return s.toString(); + } + + +} Property changes on: trunk/18xx/rails/util/GameData.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/18xx/rails/util/GameFileIO.java (from rev 1604, trunk/18xx/rails/util/GameLoader.java) =================================================================== --- trunk/18xx/rails/util/GameFileIO.java (rev 0) +++ trunk/18xx/rails/util/GameFileIO.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -0,0 +1,296 @@ +package rails.util; + +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.apache.log4j.Logger; + +import rails.common.DisplayBuffer; +import rails.common.LocalText; +import rails.common.parser.ConfigurationException; +import rails.game.Game; +import rails.game.GameManager; +import rails.game.GameManagerI; +import rails.game.ReportBuffer; +import rails.game.action.PossibleAction; + +/** + * Functions to load and save games from/to file + * + * @author freystef + * + */ +public class GameFileIO { + + protected static Logger log = + Logger.getLogger(Game.class.getPackage().getName()); + + private GameData gameData = new GameData(); + + // fields for data load + private ObjectInputStream ois = null; + private Game loadedGame = null; + private boolean dataLoadDone = false; + private boolean initialized = false; + + // fields for data save + private boolean initSave = false; + + public String getGameDataAsText() { + return gameData.metaDataAsText() + gameData.gameOptionsAsText() + gameData.playerNamesAsText(); + } + + public Game getGame() { + return loadedGame; + } + + public List<PossibleAction> getActions() { + return gameData.actions; + } + + public void setActions(List<PossibleAction> actions) { + gameData.actions = actions; + } + + public SortedMap<Integer, String> getComments() { + return gameData.userComments; + } + + public void setComments(SortedMap<Integer, String> comments) { + gameData.userComments = comments; + } + + @SuppressWarnings("unchecked") + public void loadGameData(String filepath) { + + dataLoadDone = true; + + log.info("Loading game from file " + filepath); + String filename = filepath.replaceAll(".*[/\\\\]", ""); + + try { + ois = new ObjectInputStream(new FileInputStream( + new File(filepath))); + + Object object = ois.readObject(); + if (object instanceof String) { + // New in 1.0.7: Rails version & save date/time. + gameData.meta.version = (String)object; + object = ois.readObject(); + } else { + // Allow for older saved file versions. + gameData.meta.version = "pre-1.0.7"; + } + + log.info("Reading Rails " + gameData.meta.version +" saved file "+filename); + + if (object instanceof String) { + gameData.meta.date = (String)object; + log.info("File was saved at "+ gameData.meta.date); + object = ois.readObject(); + } + + // read versionID for serialization compatibility + gameData.meta.fileVersionID = (Long) object; + log.debug("Saved versionID="+gameData.meta.fileVersionID+" (object="+object+")"); + long GMsaveFileVersionID = GameManager.saveFileVersionID; + + if (gameData.meta.fileVersionID != GMsaveFileVersionID) { + throw new Exception("Save version " + gameData.meta.fileVersionID + + " is incompatible with current version " + + GMsaveFileVersionID); + } + + // read name of saved game + gameData.meta.gameName = (String) ois.readObject(); + log.debug("Saved game="+ gameData.meta.gameName); + + // read selected game options and player names + gameData.gameOptions = (Map<String, String>) ois.readObject(); + log.debug("Selected game options = " + gameData.gameOptions); + gameData.playerNames = (List<String>) ois.readObject(); + log.debug("Player names = " + gameData.playerNames); + + } catch (Exception e) { + dataLoadDone = false; + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + } + + public Game initGame() throws ConfigurationException { + + // check if initial load was done + if (!dataLoadDone) { + throw new ConfigurationException("No game was loaded"); + } + + // initialize loadedGame + loadedGame = new Game(gameData.meta.gameName, gameData.playerNames, gameData.gameOptions); + + if (!loadedGame.setup()) { + loadedGame = null; + throw new ConfigurationException("Error in setting up " + gameData.meta.gameName); + } + + String startError = loadedGame.start(); + if (startError != null) { + DisplayBuffer.add(startError); + } + + return loadedGame; + } + + + @SuppressWarnings("unchecked") + public boolean loadActionsAndComments() throws ConfigurationException { + if (!dataLoadDone) { + throw new ConfigurationException("No game was loaded"); + } + // Read game actions into gameData.listOfActions + try { + // read next object in stream + Object actionObject = null; + while (true) { // Single-pass loop. + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + // Allow saved file at start of game (with no actions). + break; + + } + if (actionObject instanceof List) { + // Until Rails 1.3: one List of PossibleAction + gameData.actions = (List<PossibleAction>) actionObject; + } else if (actionObject instanceof PossibleAction) { + gameData.actions = new ArrayList<PossibleAction>(); + // Since Rails 1.3.1: separate PossibleActionsObjects + while (actionObject instanceof PossibleAction) { + gameData.actions.add((PossibleAction)actionObject); + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + break; + } + } + } + break; + } + /** + todo: the code below is far from perfect, but robust + */ + + // init user comments to have a defined object in any case + gameData.userComments = new TreeMap<Integer,String>(); + + // at the end of file user comments are added as SortedMap + if (actionObject instanceof SortedMap) { + gameData.userComments = (SortedMap<Integer, String>) actionObject; + log.debug("file load: found user comments"); + } else { + try { + Object object = ois.readObject(); + if (object instanceof SortedMap) { + gameData.userComments = (SortedMap<Integer, String>) actionObject; + log.debug("file load: found user comments"); + } + } catch (IOException e) { + // continue without comments, if any IOException occurs + // sometimes not only the EOF Exception is raised + // but also the java.io.StreamCorruptedException: invalid type code + } + } + ois.close(); + ois = null; + initialized = true; + } catch (Exception e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + initialized = false; + } + return initialized; + } + + public void replayGame() throws Exception { + if (!initialized) { + throw new ConfigurationException("No game was loaded/initialized"); + } + + GameManagerI gameManager = loadedGame.getGameManager(); + log.debug("Starting to execute loaded actions"); + gameManager.setReloading(true); + + for (PossibleAction action : gameData.actions) { + if (!gameManager.processOnReload(action)) { + log.error ("Load interrupted"); + DisplayBuffer.add(LocalText.getText("LoadInterrupted")); + break; + } + } + + gameManager.setReloading(false); + ReportBuffer.setCommentItems(gameData.userComments); + + // callback to GameManager + gameManager.finishLoading(); + } + + /** + * sets the meta data required for a game save + */ + public void initSave(Long saveFileVersionID, String gameName, Map<String, String> gameOptions, List<String> playerNames) { + gameData.meta.version = Game.version+" "+BuildInfo.buildDate; + gameData.meta.date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); + gameData.meta.fileVersionID = saveFileVersionID; + gameData.meta.gameName = gameName; + gameData.gameOptions = gameOptions; + gameData.playerNames = playerNames; + initSave = true; + } + + /** + * Stores the game to a file + * requires initSave and setting actions and comments + */ + public boolean saveGame(File file, boolean displayErrorMessage, String errorMessageKey) { + if (!initSave || gameData.actions == null) return false; + boolean result = false; + + try { + ObjectOutputStream oos = + new ObjectOutputStream(new FileOutputStream(file)); + oos.writeObject(gameData.meta.version); + oos.writeObject(gameData.meta.date); + oos.writeObject(gameData.meta.fileVersionID); + oos.writeObject(gameData.meta.gameName); + oos.writeObject(gameData.gameOptions); + oos.writeObject(gameData.playerNames); + for (PossibleAction action : gameData.actions) { + oos.writeObject(action); + } + oos.writeObject(gameData.userComments); + oos.close(); + + result = true; + } catch (IOException e) { + log.error(errorMessageKey, e); + if (displayErrorMessage) { + DisplayBuffer.add(LocalText.getText("SaveFailed", e.getMessage())); + } + } + return result; + } + +} Property changes on: trunk/18xx/rails/util/GameFileIO.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: trunk/18xx/rails/util/GameLoader.java =================================================================== --- trunk/18xx/rails/util/GameLoader.java 2011-07-05 17:03:23 UTC (rev 1604) +++ trunk/18xx/rails/util/GameLoader.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -1,252 +0,0 @@ -package rails.util; - -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.apache.log4j.Logger; - -import rails.common.DisplayBuffer; -import rails.common.LocalText; -import rails.common.parser.ConfigurationException; -import rails.game.Game; -import rails.game.GameManager; -import rails.game.GameManagerI; -import rails.game.ReportBuffer; -import rails.game.action.PossibleAction; - -/** - * @author freystef - * - */ -public class GameLoader { - - protected static Logger log = - Logger.getLogger(Game.class.getPackage().getName()); - - private boolean dataLoadDone; - private boolean initialized; - - private ObjectInputStream ois; - - private String saveVersion; - private String saveDate; - private Long saveFileVersionID; - private String saveGameName; - private Map<String, String> selectedGameOptions; - private List<String> playerNames; - private List<PossibleAction> listOfActions; - private SortedMap<Integer, String> userComments; - - private Game loadedGame; - - public String getGameData() { - StringBuilder s = new StringBuilder(); - s.append("Rails saveVersion = " + saveVersion + "\n"); - s.append("File was saved at " + saveDate + "\n"); - s.append("Saved versionID=" + saveFileVersionID + "\n"); - s.append("Save game=" + saveGameName + "\n"); - for (String key : selectedGameOptions.keySet()) { - s.append("Option "+key+"="+selectedGameOptions.get(key)+ "\n"); - } - int i=1; - for (String player : playerNames) { - s.append("Player "+(i++)+": "+player + "\n"); - } - return s.toString(); - } - - public Game getGame() { - return loadedGame; - } - - public List<PossibleAction> getActions() { - return listOfActions; - } - - public SortedMap<Integer, String> getComments() { - return userComments; - } - - @SuppressWarnings("unchecked") - public void loadGameData(String filepath) { - - dataLoadDone = true; - log.info("Loading game from file " + filepath); - String filename = filepath.replaceAll(".*[/\\\\]", ""); - - try { - ois = new ObjectInputStream(new FileInputStream( - new File(filepath))); - - Object object = ois.readObject(); - if (object instanceof String) { - // New in 1.0.7: Rails version & save date/time. - saveVersion = (String)object; - object = ois.readObject(); - } else { - // Allow for older saved file versions. - saveVersion = "pre-1.0.7"; - } - - log.info("Reading Rails " + saveVersion +" saved file "+filename); - - if (object instanceof String) { - saveDate = (String)object; - log.info("File was saved at "+ saveDate); - object = ois.readObject(); - } - - // read versionID for serialization compatibility - saveFileVersionID = (Long) object; - log.debug("Saved versionID="+saveFileVersionID+" (object="+object+")"); - long GMsaveFileVersionID = GameManager.saveFileVersionID; - - if (saveFileVersionID != GMsaveFileVersionID) { - throw new Exception("Save version " + saveFileVersionID - + " is incompatible with current version " - + GMsaveFileVersionID); - } - - // read name of saved game - saveGameName = (String) ois.readObject(); - log.debug("Saved game="+ saveGameName); - - // read selected game options and player names - selectedGameOptions = (Map<String, String>) ois.readObject(); - log.debug("Selected game options = " + selectedGameOptions); - playerNames = (List<String>) ois.readObject(); - log.debug("Player names = " + playerNames); - - } catch (Exception e) { - log.fatal("Load failed", e); - DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); - } - - - } - - public Game initGame() throws ConfigurationException { - - // check if initial load was done - if (!dataLoadDone) { - throw new ConfigurationException("No game was loaded"); - } - - // initialize loadedGame - loadedGame = new Game(saveGameName, playerNames, selectedGameOptions); - - if (!loadedGame.setup()) { - loadedGame = null; - throw new ConfigurationException("Error in setting up " + saveGameName); - } - - String startError = loadedGame.start(); - if (startError != null) { - DisplayBuffer.add(startError); - } - - return loadedGame; - } - - - @SuppressWarnings("unchecked") - public boolean loadActionsAndComments() throws ConfigurationException { - if (!dataLoadDone) { - throw new ConfigurationException("No game was loaded"); - } - // Read game actions into listOfActions - try { - // read next object in stream - Object actionObject = null; - while (true) { // Single-pass loop. - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - // Allow saved file at start of game (with no actions). - break; - - } - if (actionObject instanceof List) { - // Until Rails 1.3: one List of PossibleAction - listOfActions = (List<PossibleAction>) actionObject; - } else if (actionObject instanceof PossibleAction) { - listOfActions = new ArrayList<PossibleAction>(); - // Since Rails 1.3.1: separate PossibleActionsObjects - while (actionObject instanceof PossibleAction) { - listOfActions.add((PossibleAction)actionObject); - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - break; - } - } - } - break; - } - /** - todo: the code below is far from perfect, but robust - */ - - // init user comments to have a defined object in any case - userComments = new TreeMap<Integer,String>(); - - // at the end of file user comments are added as SortedMap - if (actionObject instanceof SortedMap) { - userComments = (SortedMap<Integer, String>) actionObject; - log.debug("file load: found user comments"); - } else { - try { - Object object = ois.readObject(); - if (object instanceof SortedMap) { - userComments = (SortedMap<Integer, String>) actionObject; - log.debug("file load: found user comments"); - } - } catch (IOException e) { - // continue without comments, if any IOException occurs - // sometimes not only the EOF Exception is raised - // but also the java.io.StreamCorruptedException: invalid type code - } - } - ois.close(); - ois = null; - initialized = true; - } catch (Exception e) { - log.fatal("Load failed", e); - DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); - initialized = false; - } - return initialized; - } - - public void replayGame() throws Exception { - if (!initialized) { - throw new ConfigurationException("No game was loaded/initialized"); - } - - GameManagerI gameManager = loadedGame.getGameManager(); - log.debug("Starting to execute loaded actions"); - gameManager.setReloading(true); - - for (PossibleAction action : listOfActions) { - if (!gameManager.processOnReload(action)) { - log.error ("Load interrupted"); - DisplayBuffer.add(LocalText.getText("LoadInterrupted")); - break; - } - } - - gameManager.setReloading(false); - ReportBuffer.setCommentItems(userComments); - - // callback to GameManager - gameManager.finishLoading(); - } -} Modified: trunk/18xx/rails/util/ListAndFixSavedFiles.java =================================================================== --- trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-05 17:03:23 UTC (rev 1604) +++ trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-06 05:39:16 UTC (rev 1605) @@ -165,10 +165,10 @@ saveDirectory = selectedFile.getParent(); // use GameLoader object to load game - GameLoader gameLoader = new GameLoader(); + GameFileIO gameLoader = new GameFileIO(); gameLoader.loadGameData(filepath); - add(gameLoader.getGameData()); + add(gameLoader.getGameDataAsText()); try{ gameLoader.initGame(); gameLoader.loadActionsAndComments(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2011-07-05 17:03:29
|
Revision: 1604 http://rails.svn.sourceforge.net/rails/?rev=1604&view=rev Author: stefanfrey Date: 2011-07-05 17:03:23 +0000 (Tue, 05 Jul 2011) Log Message: ----------- Refactored the load code into a new Class GameLoader Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/util/ListAndFixSavedFiles.java Added Paths: ----------- trunk/18xx/rails/util/GameLoader.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2011-07-04 23:34:57 UTC (rev 1603) +++ trunk/18xx/LocalisedText.properties 2011-07-05 17:03:23 UTC (rev 1604) @@ -354,11 +354,11 @@ LaysTileAtFor={0} lays tile #{1} at hex {2}/{3} for {4} LDIncome=LD income is LeaveAuctionOnPass=Leave private auction on pass -LoadFailed=Load failed, reason: {0} +LoadFailed=Load failed.\n\Reason = {0}\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li... LoadGame=Load Game LoadRecentGame=Load Recent LOAD=Load -LoadInterrupted=Load interrupted at this point, you can continue play from here +LoadInterrupted=Load interrupted at this point, you can continue play from here.\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li... LoansNotAllowed={0} may not take any loans Major=Major MAP=Map Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2011-07-04 23:34:57 UTC (rev 1603) +++ trunk/18xx/rails/game/Game.java 2011-07-05 17:03:23 UTC (rev 1604) @@ -13,6 +13,7 @@ import rails.common.parser.GameFileParser; import rails.common.parser.GameOption; import rails.game.action.PossibleAction; +import rails.util.GameLoader; public class Game { public static final String version = "1.4.1+"; @@ -118,9 +119,32 @@ return true; } + + + public static Game load(String filepath) { + + // use GameLoader object to load game + GameLoader gameLoader = new GameLoader(); + gameLoader.loadGameData(filepath); + try{ + gameLoader.initGame(); + gameLoader.loadActionsAndComments(); + } catch (ConfigurationException e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + try{ + gameLoader.replayGame(); + } catch (Exception e) { + log.fatal("Replay failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + return gameLoader.getGame(); + } + @SuppressWarnings("unchecked") - public static Game load(String filepath) { + public static Game load_old(String filepath) { Game game = null; Modified: trunk/18xx/rails/game/GameManager.java =================================================================== --- trunk/18xx/rails/game/GameManager.java 2011-07-04 23:34:57 UTC (rev 1603) +++ trunk/18xx/rails/game/GameManager.java 2011-07-05 17:03:23 UTC (rev 1604) @@ -1049,8 +1049,8 @@ return true; } + /** allows callback from GameLoader */ public void finishLoading () { - guiHints.clearVisibilityHints(); } @@ -1141,72 +1141,44 @@ } return result; } - - @SuppressWarnings("unchecked") + /** + * tries to reload the current game + * executes the additional action(s) + */ protected boolean reload(GameAction reloadAction) { - + log.info("Reloading started"); + + /* Use gameLoader to load the game data */ + GameLoader gameLoader = new GameLoader(); String filepath = reloadAction.getFilepath(); - log.info("Reloading game from file " + filepath); - String filename = filepath.replaceAll(".*[/\\\\]", ""); + gameLoader.loadGameData(filepath); + + /* followed by actions and comments */ + try{ + gameLoader.loadActionsAndComments(); + } catch (ConfigurationException e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + log.debug("Starting to compare loaded actions"); + + /* gameLoader actions get compared to the executed actions of the current game */ + List<PossibleAction> savedActions = gameLoader.getActions(); + + setReloading(true); + + // Check size + if (savedActions.size() < executedActions.size()) { + DisplayBuffer.add(LocalText.getText("LoadFailed", + "loaded file has less actions than current game")); + return true; + } + + // Check action identity + int index = 0; + PossibleAction executedAction; try { - ObjectInputStream ois = - new ObjectInputStream(new FileInputStream( - new File(filepath))); - - // See Game.load(). Here we don't do as much checking. */ - Object object = ois.readObject(); - if (object instanceof String) { - log.info("Reading Rails "+(String)object+" saved file "+filename); - object = ois.readObject(); - } else { - log.info("Reading Rails (pre-1.0.7) saved file "+filename); - } - if (object instanceof String) { - log.info("File was saved at "+(String)object); - object = ois.readObject(); - } - String name = (String) ois.readObject(); - log.debug("Saved game="+name); - Map<String, String> selectedGameOptions = - (Map<String, String>) ois.readObject(); - List<String> playerNames = (List<String>) ois.readObject(); - - log.debug("Starting to compare loaded actions"); - - List<PossibleAction> savedActions; - int numberOfActions = 0; - setReloading(true); - - Object actionObject = ois.readObject(); - if (actionObject instanceof List) { - // Old-style: one List of PossibleActions - savedActions = (List<PossibleAction>) actionObject; - numberOfActions = savedActions.size(); - } else { - // New style: separate PossibleActionsObjects, since Rails 1.3.1 - savedActions = new ArrayList<PossibleAction>(); - while (actionObject instanceof PossibleAction) { - savedActions.add((PossibleAction) actionObject); - numberOfActions++; - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - break; - } - } - } - - // Check size - if (numberOfActions < executedActions.size()) { - DisplayBuffer.add(LocalText.getText("LoadFailed", - "loaded file has less actions than current game")); - return true; - } - - // Check action identity - int index = 0; - PossibleAction executedAction; for (PossibleAction savedAction : savedActions) { if (index < executedActions.size()) { executedAction = executedActions.get(index); @@ -1230,40 +1202,25 @@ } } index++; - } - - if (actionObject instanceof SortedMap) { - ReportBuffer.setCommentItems((SortedMap<Integer, String>) actionObject); - log.debug("Found sorted map"); - } else { - try { - object = ois.readObject(); - if (object instanceof SortedMap) { - ReportBuffer.setCommentItems((SortedMap<Integer, String>) object); - } - } catch (IOException e) { - // continue without comments, if any IOException occurs - // sometimes not only the EOF Exception is raised - // but also the java.io.StreamCorruptedException: invalid type code - } - } - - ois.close(); - ois = null; - - setReloading(false); - finishLoading(); - log.info("Reloading finished"); - + } } catch (Exception e) { log.error("Reload failed", e); DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); return true; } + + + setReloading(false); + finishLoading(); + // use new comments (without checks) + ReportBuffer.setCommentItems(gameLoader.getComments()); + + log.info("Reloading finished"); return true; } + protected boolean export(GameAction exportAction) { String filename = exportAction.getFilepath(); Added: trunk/18xx/rails/util/GameLoader.java =================================================================== --- trunk/18xx/rails/util/GameLoader.java (rev 0) +++ trunk/18xx/rails/util/GameLoader.java 2011-07-05 17:03:23 UTC (rev 1604) @@ -0,0 +1,252 @@ +package rails.util; + +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.apache.log4j.Logger; + +import rails.common.DisplayBuffer; +import rails.common.LocalText; +import rails.common.parser.ConfigurationException; +import rails.game.Game; +import rails.game.GameManager; +import rails.game.GameManagerI; +import rails.game.ReportBuffer; +import rails.game.action.PossibleAction; + +/** + * @author freystef + * + */ +public class GameLoader { + + protected static Logger log = + Logger.getLogger(Game.class.getPackage().getName()); + + private boolean dataLoadDone; + private boolean initialized; + + private ObjectInputStream ois; + + private String saveVersion; + private String saveDate; + private Long saveFileVersionID; + private String saveGameName; + private Map<String, String> selectedGameOptions; + private List<String> playerNames; + private List<PossibleAction> listOfActions; + private SortedMap<Integer, String> userComments; + + private Game loadedGame; + + public String getGameData() { + StringBuilder s = new StringBuilder(); + s.append("Rails saveVersion = " + saveVersion + "\n"); + s.append("File was saved at " + saveDate + "\n"); + s.append("Saved versionID=" + saveFileVersionID + "\n"); + s.append("Save game=" + saveGameName + "\n"); + for (String key : selectedGameOptions.keySet()) { + s.append("Option "+key+"="+selectedGameOptions.get(key)+ "\n"); + } + int i=1; + for (String player : playerNames) { + s.append("Player "+(i++)+": "+player + "\n"); + } + return s.toString(); + } + + public Game getGame() { + return loadedGame; + } + + public List<PossibleAction> getActions() { + return listOfActions; + } + + public SortedMap<Integer, String> getComments() { + return userComments; + } + + @SuppressWarnings("unchecked") + public void loadGameData(String filepath) { + + dataLoadDone = true; + log.info("Loading game from file " + filepath); + String filename = filepath.replaceAll(".*[/\\\\]", ""); + + try { + ois = new ObjectInputStream(new FileInputStream( + new File(filepath))); + + Object object = ois.readObject(); + if (object instanceof String) { + // New in 1.0.7: Rails version & save date/time. + saveVersion = (String)object; + object = ois.readObject(); + } else { + // Allow for older saved file versions. + saveVersion = "pre-1.0.7"; + } + + log.info("Reading Rails " + saveVersion +" saved file "+filename); + + if (object instanceof String) { + saveDate = (String)object; + log.info("File was saved at "+ saveDate); + object = ois.readObject(); + } + + // read versionID for serialization compatibility + saveFileVersionID = (Long) object; + log.debug("Saved versionID="+saveFileVersionID+" (object="+object+")"); + long GMsaveFileVersionID = GameManager.saveFileVersionID; + + if (saveFileVersionID != GMsaveFileVersionID) { + throw new Exception("Save version " + saveFileVersionID + + " is incompatible with current version " + + GMsaveFileVersionID); + } + + // read name of saved game + saveGameName = (String) ois.readObject(); + log.debug("Saved game="+ saveGameName); + + // read selected game options and player names + selectedGameOptions = (Map<String, String>) ois.readObject(); + log.debug("Selected game options = " + selectedGameOptions); + playerNames = (List<String>) ois.readObject(); + log.debug("Player names = " + playerNames); + + } catch (Exception e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + + + } + + public Game initGame() throws ConfigurationException { + + // check if initial load was done + if (!dataLoadDone) { + throw new ConfigurationException("No game was loaded"); + } + + // initialize loadedGame + loadedGame = new Game(saveGameName, playerNames, selectedGameOptions); + + if (!loadedGame.setup()) { + loadedGame = null; + throw new ConfigurationException("Error in setting up " + saveGameName); + } + + String startError = loadedGame.start(); + if (startError != null) { + DisplayBuffer.add(startError); + } + + return loadedGame; + } + + + @SuppressWarnings("unchecked") + public boolean loadActionsAndComments() throws ConfigurationException { + if (!dataLoadDone) { + throw new ConfigurationException("No game was loaded"); + } + // Read game actions into listOfActions + try { + // read next object in stream + Object actionObject = null; + while (true) { // Single-pass loop. + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + // Allow saved file at start of game (with no actions). + break; + + } + if (actionObject instanceof List) { + // Until Rails 1.3: one List of PossibleAction + listOfActions = (List<PossibleAction>) actionObject; + } else if (actionObject instanceof PossibleAction) { + listOfActions = new ArrayList<PossibleAction>(); + // Since Rails 1.3.1: separate PossibleActionsObjects + while (actionObject instanceof PossibleAction) { + listOfActions.add((PossibleAction)actionObject); + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + break; + } + } + } + break; + } + /** + todo: the code below is far from perfect, but robust + */ + + // init user comments to have a defined object in any case + userComments = new TreeMap<Integer,String>(); + + // at the end of file user comments are added as SortedMap + if (actionObject instanceof SortedMap) { + userComments = (SortedMap<Integer, String>) actionObject; + log.debug("file load: found user comments"); + } else { + try { + Object object = ois.readObject(); + if (object instanceof SortedMap) { + userComments = (SortedMap<Integer, String>) actionObject; + log.debug("file load: found user comments"); + } + } catch (IOException e) { + // continue without comments, if any IOException occurs + // sometimes not only the EOF Exception is raised + // but also the java.io.StreamCorruptedException: invalid type code + } + } + ois.close(); + ois = null; + initialized = true; + } catch (Exception e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + initialized = false; + } + return initialized; + } + + public void replayGame() throws Exception { + if (!initialized) { + throw new ConfigurationException("No game was loaded/initialized"); + } + + GameManagerI gameManager = loadedGame.getGameManager(); + log.debug("Starting to execute loaded actions"); + gameManager.setReloading(true); + + for (PossibleAction action : listOfActions) { + if (!gameManager.processOnReload(action)) { + log.error ("Load interrupted"); + DisplayBuffer.add(LocalText.getText("LoadInterrupted")); + break; + } + } + + gameManager.setReloading(false); + ReportBuffer.setCommentItems(userComments); + + // callback to GameManager + gameManager.finishLoading(); + } +} Property changes on: trunk/18xx/rails/util/GameLoader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/rails/util/ListAndFixSavedFiles.java =================================================================== --- trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-04 23:34:57 UTC (rev 1603) +++ trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-05 17:03:23 UTC (rev 1604) @@ -36,6 +36,7 @@ private List<Object> savedObjects = new ArrayList<Object>(512); private List<PossibleAction> executedActions; + private SortedMap<Integer,String> userComments; private int vbarPos; @@ -156,100 +157,33 @@ JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new File(saveDirectory)); - + if (jfc.showOpenDialog(getContentPane()) == JFileChooser.APPROVE_OPTION) { File selectedFile = jfc.getSelectedFile(); filepath = selectedFile.getPath(); saveDirectory = selectedFile.getParent(); + + // use GameLoader object to load game + GameLoader gameLoader = new GameLoader(); - log.debug("Loading game from file " + filepath); - String filename = filepath.replaceAll(".*[/\\\\]", ""); - - try { - ObjectInputStream ois = - new ObjectInputStream(new FileInputStream( - new File(filepath))); - - // New in 1.0.7: Rails version & save date/time. - // Allow for older saved file versions. - - Object object = ois.readObject(); - savedObjects.add(object); - if (object instanceof String) { - add((String)object+" saved file "+filename); - object = ois.readObject(); - savedObjects.add(object); - } else { - add("Reading Rails (pre-1.0.7) saved file "+filename); - } - if (object instanceof String) { - add("File was saved at "+(String)object); - object = ois.readObject(); - savedObjects.add(object); - } - - long versionID = (Long) object; - add("Saved versionID="+versionID+" (object="+object+")"); - long saveFileVersionID = GameManager.saveFileVersionID; - String name = (String) ois.readObject(); - savedObjects.add(name); - add("Saved game="+name); - - Map<String, String> selectedGameOptions = - (Map<String, String>) ois.readObject(); - savedObjects.add(selectedGameOptions); - for (String key : selectedGameOptions.keySet()) { - add("Option "+key+"="+selectedGameOptions.get(key)); - } - - List<String> playerNames = (List<String>) ois.readObject(); - savedObjects.add(playerNames); - int i=1; - for (String player : playerNames) { - add("Player "+(i++)+": "+player); - } - - Game game = new Game(name, playerNames, selectedGameOptions); - - if (!game.setup()) { - throw new ConfigurationException("Error in setting up " + name); - } - - Object firstActionObject = ois.readObject(); - if (firstActionObject instanceof List) { - // Old-style: one List of PossibleActions - executedActions = - (List<PossibleAction>) firstActionObject; - savedObjects.add(executedActions); - } else { - // New style: separate PossibleActionsObjects, since Rails 1.3.1 - executedActions = new ArrayList<PossibleAction>(); - PossibleAction action = (PossibleAction) firstActionObject; - while (true) { - savedObjects.add (action); - executedActions.add(action); - try { - action = (PossibleAction) ois.readObject(); - } catch (EOFException e) { - break; - } catch (ClassCastException e) { - log.error ("Aborting on non-action object: "+ e.getMessage()); - break; - } - } - } + gameLoader.loadGameData(filepath); + add(gameLoader.getGameData()); + try{ + gameLoader.initGame(); + gameLoader.loadActionsAndComments(); + executedActions = gameLoader.getActions(); + userComments = gameLoader.getComments(); setReportText(true); - - ois.close(); - } catch (Exception e) { - System.out.println(e.getMessage()); - e.printStackTrace(); + + } catch (ConfigurationException e) { + log.fatal("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); } } } - + public void add (String text) { if (text.length() > 0) { headerText.append(text); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2011-07-04 23:35:04
|
Revision: 1603 http://rails.svn.sourceforge.net/rails/?rev=1603&view=rev Author: wakko666 Date: 2011-07-04 23:34:57 +0000 (Mon, 04 Jul 2011) Log Message: ----------- Move more XML Parsing out of rails.game.Game and into rails.common.parser.GameFileParser Modified Paths: -------------- trunk/18xx/rails/common/parser/ComponentManager.java trunk/18xx/rails/common/parser/GameFileParser.java trunk/18xx/rails/game/Game.java Modified: trunk/18xx/rails/common/parser/ComponentManager.java =================================================================== --- trunk/18xx/rails/common/parser/ComponentManager.java 2011-07-04 22:27:18 UTC (rev 1602) +++ trunk/18xx/rails/common/parser/ComponentManager.java 2011-07-04 23:34:57 UTC (rev 1603) @@ -22,7 +22,10 @@ protected Logger log = Logger.getLogger(ComponentManager.class.getPackage().getName()); protected List<String> directories = new ArrayList<String>(); - + + private Map<String, ConfigurableComponentI> mComponentMap = + new HashMap<String, ConfigurableComponentI>(); + public ComponentManager(String gameName, Tag tag, Map<String, String> gameOptions) throws ConfigurationException { this.gameName = gameName; @@ -105,11 +108,14 @@ * @param componentName the of the component sought. * @return the component sought, or null if it has not been configured. */ - public ConfigurableComponentI findComponent(String componentName) { - return mComponentMap.get(componentName); + public ConfigurableComponentI findComponent(String componentName) throws ConfigurationException { + ConfigurableComponentI comp = mComponentMap.get(componentName); + + //FIXME: Revenue Manager is currently optional. + if (comp == null && componentName != "RevenueManager") { + throw new ConfigurationException("No XML element found for component named: " + componentName); + } + + return comp; } - - private Map<String, ConfigurableComponentI> mComponentMap = - new HashMap<String, ConfigurableComponentI>(); - } Modified: trunk/18xx/rails/common/parser/GameFileParser.java =================================================================== --- trunk/18xx/rails/common/parser/GameFileParser.java 2011-07-04 22:27:18 UTC (rev 1602) +++ trunk/18xx/rails/common/parser/GameFileParser.java 2011-07-04 23:34:57 UTC (rev 1603) @@ -1,12 +1,150 @@ package rails.common.parser; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; +import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Element; +import rails.algorithms.RevenueManager; +import rails.common.DisplayBuffer; +import rails.common.LocalText; +import rails.common.parser.ComponentManager; +import rails.game.Bank; +import rails.game.CompanyManagerI; +import rails.game.GameManager; +import rails.game.MapManager; +import rails.game.PhaseManager; +import rails.game.PlayerManager; +import rails.game.StockMarketI; +import rails.game.TileManager; +import rails.game.TrainManager; + public class GameFileParser extends XMLParser { + private static String GAME_XML_FILE = "Game.xml"; + + private Tag componentManagerTag; + private ComponentManager componentManager; + private GameManager gameManager; + private CompanyManagerI companyManager; + private PlayerManager playerManager; + private PhaseManager phaseManager; + private TrainManager trainManager; + private StockMarketI stockMarket; + private MapManager mapManager; + private TileManager tileManager; + private RevenueManager revenueManager; + private Bank bank; + + public GameFileParser(String name, Map<String, String> gameOptions) { + + directories.add("data/" + name); + + try { + componentManagerTag = Tag.findTopTagInFile(GAME_XML_FILE, directories, XMLTags.COMPONENT_MANAGER_ELEMENT_ID); + componentManagerTag.setGameOptions(gameOptions); + + //XXX: Ultimately calls everyone's configureFromXML() methods. + componentManager = new ComponentManager(name, componentManagerTag, gameOptions); + + playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); + bank = (Bank) componentManager.findComponent("Bank"); + companyManager = (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); + stockMarket = (StockMarketI) componentManager.findComponent(StockMarketI.COMPONENT_NAME); + gameManager = (GameManager) componentManager.findComponent("GameManager"); + phaseManager = (PhaseManager) componentManager.findComponent("PhaseManager"); + trainManager = (TrainManager) componentManager.findComponent("TrainManager"); + mapManager = (MapManager) componentManager.findComponent("Map"); + tileManager = (TileManager) componentManager.findComponent("TileManager"); + revenueManager = (RevenueManager) componentManager.findComponent("RevenueManager"); + } catch (Exception e) { + String message = + LocalText.getText("GameSetupFailed", GAME_XML_FILE); + log.fatal(message, e); + System.out.println(e.getMessage()); + e.printStackTrace(); + DisplayBuffer.add(message + ":\n " + e.getMessage()); + } + } + + /** + * @return the componentManager + */ + public ComponentManager getComponentManager() { + return componentManager; + } + + /** + * @return the gameManager + */ + public GameManager getGameManager() { + return gameManager; + } + + /** + * @return the companyManager + */ + public CompanyManagerI getCompanyManager() { + return companyManager; + } + + /** + * @return the playerManager + */ + public PlayerManager getPlayerManager() { + return playerManager; + } + + /** + * @return the phaseManager + */ + public PhaseManager getPhaseManager() { + return phaseManager; + } + + /** + * @return the trainManager + */ + public TrainManager getTrainManager() { + return trainManager; + } + + /** + * @return the stockMarket + */ + public StockMarketI getStockMarket() { + return stockMarket; + } + + /** + * @return the mapManager + */ + public MapManager getMapManager() { + return mapManager; + } + + /** + * @return the tileManager + */ + public TileManager getTileManager() { + return tileManager; + } + + /** + * @return the revenueManager + */ + public RevenueManager getRevenueManager() { + return revenueManager; + } + + /** + * @return the bank + */ + public Bank getBank() { + return bank; + } } + + + + Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2011-07-04 22:27:18 UTC (rev 1602) +++ trunk/18xx/rails/game/Game.java 2011-07-04 23:34:57 UTC (rev 1603) @@ -9,19 +9,15 @@ import rails.algorithms.RevenueManager; import rails.common.DisplayBuffer; import rails.common.LocalText; -import rails.common.parser.ComponentManager; import rails.common.parser.ConfigurationException; +import rails.common.parser.GameFileParser; import rails.common.parser.GameOption; -import rails.common.parser.Tag; -import rails.common.parser.XMLTags; import rails.game.action.PossibleAction; -import rails.game.special.SpecialProperty; public class Game { public static final String version = "1.4.1+"; /** The component Manager */ - protected ComponentManager componentManager; protected GameManager gameManager; protected CompanyManagerI companyManager; protected PlayerManager playerManager; @@ -33,13 +29,12 @@ protected RevenueManager revenueManager; protected Bank bank; protected String name; - protected Tag componentManagerTag; - protected static String GAME_XML_FILE = "Game.xml"; + protected List<String> directories = new ArrayList<String>(); + protected List<String> players; + protected Map<String, String> gameOptions; - protected List<String> players; - protected static Logger log = Logger.getLogger(Game.class.getPackage().getName()); @@ -59,13 +54,16 @@ log.debug("Option: " + optionName + "=" + gameOptions.get(optionName)); } - directories.add("data"); - directories.add("data/" + name); + this.players = players; + + log.info("========== Start of rails.game " + name + " =========="); + log.info("Rails version "+version); + ReportBuffer.add(LocalText.getText("GameIs", name)); } - public String start() { + public String start() { if (players.size() < playerManager.minPlayers || players.size() > playerManager.maxPlayers) { @@ -78,110 +76,28 @@ } public boolean setup() { + GameFileParser gfp = new GameFileParser(name, gameOptions); + playerManager = gfp.getPlayerManager(); + companyManager = gfp.getCompanyManager(); + trainManager = gfp.getTrainManager(); + phaseManager = gfp.getPhaseManager(); + stockMarket = gfp.getStockMarket(); + mapManager = gfp.getMapManager(); + tileManager = gfp.getTileManager(); + revenueManager = gfp.getRevenueManager(); + bank = gfp.getBank(); + gameManager = gfp.getGameManager(); - try { - componentManagerTag = - Tag.findTopTagInFile(GAME_XML_FILE, directories, - XMLTags.COMPONENT_MANAGER_ELEMENT_ID); - if (componentManagerTag == null) { - throw new ConfigurationException( - "No Game XML element found in file " + GAME_XML_FILE); - } + /* + * Initializations that involve relations between components can + * only be done after all XML has been processed. + */ + playerManager.setPlayers(players, bank); + gameManager.init(name, playerManager, companyManager, + phaseManager, trainManager, stockMarket, mapManager, + tileManager, revenueManager, bank); - componentManagerTag.setGameOptions(gameOptions); - - // Have the ComponentManager work through the other rails.game files - //XXX: Ultimately calls everyone's configureFromXML() methods. - componentManager = new ComponentManager(name, componentManagerTag, gameOptions); - - log.info("========== Start of rails.game " + name + " =========="); - log.info("Rails version "+version); - ReportBuffer.add(LocalText.getText("GameIs", name)); - - playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); - if (playerManager == null) { - throw new ConfigurationException( - "No PlayerManager XML element found in file " + GAME_XML_FILE); - } - - bank = (Bank) componentManager.findComponent("Bank"); - if (bank == null) { - throw new ConfigurationException( - "No Bank XML element found in file " + GAME_XML_FILE); - } - - companyManager = - (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); - if (companyManager == null) { - throw new ConfigurationException( - "No CompanyManager XML element found in file " - + GAME_XML_FILE); - } - stockMarket = - (StockMarketI) componentManager.findComponent(StockMarketI.COMPONENT_NAME); - if (stockMarket == null) { - throw new ConfigurationException( - "No StockMarket XML element found in file " - + GAME_XML_FILE); - } - gameManager = - (GameManager) componentManager.findComponent("GameManager"); - if (gameManager == null) { - throw new ConfigurationException( - "No GameManager XML element found in file " - + GAME_XML_FILE); - } - - phaseManager = - (PhaseManager) componentManager.findComponent("PhaseManager"); - if (phaseManager == null) { - throw new ConfigurationException( - "No PhaseManager XML element found in file " - + GAME_XML_FILE); - } - - trainManager = - (TrainManager) componentManager.findComponent("TrainManager"); - if (trainManager == null) { - throw new ConfigurationException( - "No TrainManager XML element found in file " - + GAME_XML_FILE); - } - - mapManager = - (MapManager) componentManager.findComponent("Map"); - if (mapManager == null) { - throw new ConfigurationException( - "No Map XML element found in file " - + GAME_XML_FILE); - } - - tileManager = - (TileManager) componentManager.findComponent("TileManager"); - if (tileManager == null) { - throw new ConfigurationException( - "No TileManager XML element found in file " - + GAME_XML_FILE); - } - - revenueManager = - (RevenueManager) componentManager.findComponent("RevenueManager"); - // revenueManager is optional so far -// if (revenueManager == null) { -// throw new ConfigurationException( -// "No RevenueManager XML element found in file " -// + GAME_XML_FILE); -// } - - /* - * Initialisations that involve relations between components can - * only be done after all XML has been processed. - */ - playerManager.setPlayers(players, bank); - gameManager.init(name, playerManager, companyManager, - phaseManager, trainManager, stockMarket, mapManager, - tileManager, revenueManager, bank); - + try { companyManager.finishConfiguration(gameManager); trainManager.finishConfiguration(gameManager); phaseManager.finishConfiguration(gameManager); @@ -189,18 +105,17 @@ bank.finishConfiguration(gameManager); stockMarket.finishConfiguration(gameManager); tileManager.finishConfiguration(gameManager); + if (revenueManager != null) revenueManager.finishConfiguration(gameManager); - } catch (Exception e) { - String message = - LocalText.getText("GameSetupFailed", GAME_XML_FILE); - log.fatal(message, e); + } catch (ConfigurationException e) { + log.fatal(e); System.out.println(e.getMessage()); e.printStackTrace(); - DisplayBuffer.add(message + ":\n " + e.getMessage()); + DisplayBuffer.add(e.getMessage()); return false; } - + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2011-07-04 22:27:26
|
Revision: 1602 http://rails.svn.sourceforge.net/rails/?rev=1602&view=rev Author: wakko666 Date: 2011-07-04 22:27:18 +0000 (Mon, 04 Jul 2011) Log Message: ----------- - Move ComponentManager to rails.common.parser. - Refactor ComponentManager to be less of a static singleton. - Move DisplayBuffer from rails.game to rails.common. Modified Paths: -------------- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java trunk/18xx/rails/algorithms/RevenueManager.java trunk/18xx/rails/common/parser/GameInfoParser.java trunk/18xx/rails/common/parser/XMLTags.java trunk/18xx/rails/game/Bank.java trunk/18xx/rails/game/BonusToken.java trunk/18xx/rails/game/Company.java trunk/18xx/rails/game/CompanyI.java trunk/18xx/rails/game/CompanyManager.java trunk/18xx/rails/game/CompanyManagerI.java trunk/18xx/rails/game/CompanyType.java trunk/18xx/rails/game/CompanyTypeI.java trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/game/GameManagerI.java trunk/18xx/rails/game/MapHex.java trunk/18xx/rails/game/MapManager.java trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/PhaseI.java trunk/18xx/rails/game/PhaseManager.java trunk/18xx/rails/game/PlayerManager.java trunk/18xx/rails/game/PrivateCompany.java trunk/18xx/rails/game/Round.java trunk/18xx/rails/game/ShareSellingRound.java trunk/18xx/rails/game/StartRound.java trunk/18xx/rails/game/StartRound_1830.java trunk/18xx/rails/game/StartRound_1835.java trunk/18xx/rails/game/StockMarket.java trunk/18xx/rails/game/StockMarketI.java trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/TileManager.java trunk/18xx/rails/game/Token.java trunk/18xx/rails/game/TrainManager.java trunk/18xx/rails/game/TrainType.java trunk/18xx/rails/game/TreasuryShareRound.java trunk/18xx/rails/game/correct/CashCorrectionManager.java trunk/18xx/rails/game/correct/CorrectionManager.java trunk/18xx/rails/game/correct/MapCorrectionManager.java trunk/18xx/rails/game/special/SpecialProperty.java trunk/18xx/rails/game/special/SpecialPropertyI.java trunk/18xx/rails/game/specific/_1825/StartRound_1825.java trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java trunk/18xx/rails/game/specific/_1851/StartRound_1851.java trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java trunk/18xx/rails/game/specific/_1856/StockRound_1856.java trunk/18xx/rails/game/specific/_1880/StartRound_1880.java trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java trunk/18xx/rails/game/specific/_18AL/NamedTrainToken.java trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java trunk/18xx/rails/game/specific/_18Kaas/RuhrRevenueModifier.java trunk/18xx/rails/ui/swing/GameSetupWindow.java trunk/18xx/rails/ui/swing/GameUIManager.java trunk/18xx/rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java trunk/18xx/rails/util/ListAndFixSavedFiles.java Added Paths: ----------- trunk/18xx/rails/common/DisplayBuffer.java trunk/18xx/rails/common/parser/ComponentManager.java trunk/18xx/rails/common/parser/ConfigurableComponentI.java trunk/18xx/rails/common/parser/GameFileParser.java Removed Paths: ------------- trunk/18xx/rails/game/ComponentManager.java trunk/18xx/rails/game/ConfigurableComponentI.java trunk/18xx/rails/game/DisplayBuffer.java Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -5,9 +5,9 @@ import org.apache.log4j.Logger; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; -import rails.game.ConfigurableComponentI; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.PhaseI; Modified: trunk/18xx/rails/algorithms/RevenueManager.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/algorithms/RevenueManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -8,9 +8,9 @@ import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; -import rails.game.ConfigurableComponentI; import rails.game.GameManagerI; import rails.game.state.ArrayListState; Copied: trunk/18xx/rails/common/DisplayBuffer.java (from rev 1601, trunk/18xx/rails/game/DisplayBuffer.java) =================================================================== --- trunk/18xx/rails/common/DisplayBuffer.java (rev 0) +++ trunk/18xx/rails/common/DisplayBuffer.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -0,0 +1,118 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/DisplayBuffer.java,v 1.9 2010/01/31 22:22:28 macfreek Exp $ */ +package rails.common; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +import rails.game.GameManager; +import rails.game.GameManagerI; +import rails.util.Util; + +/** + * Class to write a log, and also to maintain a log message stack for writing to + * the UI. + */ +public final class DisplayBuffer { + + /** List to catch messages before the buffer is instantiated, + * based on the supposition that never 2 games will be initialised simultaneously... + */ + protected static List<String> initialQueue = new ArrayList<String>(); + + protected static Logger log = + Logger.getLogger(DisplayBuffer.class.getPackage().getName()); + + public DisplayBuffer() { + if (!initialQueue.isEmpty()) { + for (String s : initialQueue) { + addMessage (s, true); + } + initialQueue.clear(); + } + } + + /** + * A buffer for displaying messages in a popup window after any user action. + * These include error messages and other notifications of immediate + * interest to players. + */ + private List<String> displayBuffer = new ArrayList<String>(); + + private boolean autoDisplay = true; + + /** + * Add a message to the message (display) buffer (and display it on the + * console) + */ + public static void add(String message) { + add (message, true); + } + + public static void add(String message, boolean autoDisplay) { + GameManagerI gm = GameManager.getInstance(); + DisplayBuffer instance = null; + if (gm != null) instance = gm.getDisplayBuffer(); + if (gm == null || instance == null) { + // Queue in a static buffer until the instance is created + initialQueue.add(message); + } else { + instance.addMessage(message, autoDisplay); + } + } + + private void addMessage (String message, boolean autoDisplay) { + DisplayBuffer instance = getInstance(); + instance.autoDisplay = autoDisplay; + if (Util.hasValue(message)) { + instance.displayBuffer.add(message); + /* Also log the message (don't remove this, + * otherwise the message will not be logged during a reload, + * which may hinder troubleshooting) */ + log.debug("To display: " + message); + } + } + + private static DisplayBuffer getInstance() { + GameManagerI gm = GameManager.getInstance(); + if (gm == null) { + return null; + } else { + return gm.getDisplayBuffer(); + } + } + + /** Get the current message buffer, and clear it */ + public static String[] get() { + DisplayBuffer instance = getInstance(); + if (instance == null) { + if (initialQueue.isEmpty()) { + return null; + } else { + String[] message = initialQueue.toArray(new String[0]); + initialQueue.clear(); + return message; + } + } else if (instance.displayBuffer.size() > 0) { + String[] message = instance.displayBuffer.toArray(new String[0]); + instance.displayBuffer.clear(); + return message; + } else { + return null; + } + } + + public static int getSize() { + return getInstance().displayBuffer.size(); + } + + public static boolean getAutoDisplay () { + return getInstance().autoDisplay; + } + + public static void clear() { + getInstance().displayBuffer.clear(); + } + +} Copied: trunk/18xx/rails/common/parser/ComponentManager.java (from rev 1601, trunk/18xx/rails/game/ComponentManager.java) =================================================================== --- trunk/18xx/rails/common/parser/ComponentManager.java (rev 0) +++ trunk/18xx/rails/common/parser/ComponentManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -0,0 +1,115 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/ComponentManager.java,v 1.19 2010/05/18 04:12:23 stefanfrey Exp $ */ +package rails.common.parser; + +import java.lang.reflect.Constructor; +import java.util.*; + +import org.apache.log4j.Logger; + +import rails.common.LocalText; +import rails.common.parser.XMLTags; + +/** + * ComponentManage - an implementation of ComponentManagerI, which handles the + * creation and configuration of rails.game components, and acts as a discovery + * point for other components to find them. + */ +public class ComponentManager { + + private String gameName; + + private List<Tag> componentTags; + + protected Logger log = Logger.getLogger(ComponentManager.class.getPackage().getName()); + protected List<String> directories = new ArrayList<String>(); + + public ComponentManager(String gameName, Tag tag, Map<String, String> gameOptions) + throws ConfigurationException { + this.gameName = gameName; + + componentTags = tag.getChildren(XMLTags.COMPONENT_ELEMENT_ID); + for (Tag component : componentTags) { + String compName = component.getAttributeAsString("name"); + log.debug("Found component " + compName); + configureComponent(component); + component.setGameOptions(gameOptions); + } + } + + private void configureComponent(Tag componentTag) + throws ConfigurationException { + + // Extract the attributes of the Component + String name = componentTag.getAttributeAsString(XMLTags.NAME_ATTR); + if (name == null) { + throw new ConfigurationException( + LocalText.getText("UnnamedComponent")); + } + String clazz = componentTag.getAttributeAsString(XMLTags.CLASS_ATTR); + if (clazz == null) { + throw new ConfigurationException(LocalText.getText( + "ComponentHasNoClass", name)); + } + String file = componentTag.getAttributeAsString(XMLTags.FILE_ATTR); + + // Only one component per name. + if (mComponentMap.get(name) != null) { + throw new ConfigurationException(LocalText.getText( + "ComponentConfiguredTwice", name)); + } + + // Now construct the component + ConfigurableComponentI component; + try { + Class<? extends ConfigurableComponentI> compClass; + compClass = + Class.forName(clazz).asSubclass( + ConfigurableComponentI.class); + Constructor<? extends ConfigurableComponentI> compCons = + compClass.getConstructor(new Class[0]); + component = compCons.newInstance(new Object[0]); + } catch (Exception ex) { + // There are MANY things that could go wrong here. + // They all just mean that the configuration and code + // do not combine to make a well-formed system. + // Debugging aided by chaining the caught exception. + throw new ConfigurationException(LocalText.getText( + "ComponentHasNoClass", clazz), ex); + + } + + // Configure the component, from a file, or the embedded XML. + Tag configElement = componentTag; + if (file != null) { + directories.add("data/" + gameName); + configElement = Tag.findTopTagInFile(file, directories, name); + configElement.setGameOptions(componentTag.getGameOptions()); + } + + try { + component.configureFromXML(configElement); + } catch (ConfigurationException e) { + // Temporarily allow components to be incompletely configured. + log.warn(LocalText.getText("AcceptingConfigFailure"), e); + } + + // Add it to the map of known components. + mComponentMap.put(name, component); + log.debug(LocalText.getText("ComponentInitAs", name, clazz )); + + } + + /** + * Returns the configured parameter with the given name. + * + * @param componentName the of the component sought. + * @return the component sought, or null if it has not been configured. + */ + public ConfigurableComponentI findComponent(String componentName) { + return mComponentMap.get(componentName); + } + + private Map<String, ConfigurableComponentI> mComponentMap = + new HashMap<String, ConfigurableComponentI>(); + +} Copied: trunk/18xx/rails/common/parser/ConfigurableComponentI.java (from rev 1601, trunk/18xx/rails/game/ConfigurableComponentI.java) =================================================================== --- trunk/18xx/rails/common/parser/ConfigurableComponentI.java (rev 0) +++ trunk/18xx/rails/common/parser/ConfigurableComponentI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -0,0 +1,37 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/ConfigurableComponentI.java,v 1.7 2009/10/31 17:08:26 evos Exp $ */ +package rails.common.parser; + +import rails.game.GameManagerI; + +/** + * Interface for rails.game components which can be configured from an XML + * element. + */ +public interface ConfigurableComponentI { + + /** + * Instructs the component to configure itself from the provided XML + * element. + * + * @param element the XML element containing the configuration + * @throws ConfigurationException + */ + void configureFromXML(Tag tag) throws ConfigurationException; + + /** + * This method is intended to be called for each configurable + * component, to perforn any initialisation activities that + * require any other components to be initialised first. + * This includes creating any required relationships to other + * configured components and objects. + * <p>This method should be called where necessary after all + * XML file parsing has completed, so that all objects that + * need to be related to do exist. + * @param parent The 'parent' configurable component is passed to allow + * the 'child' to access any other object without the need to resort to + * static calls where possible. + */ + void finishConfiguration (GameManagerI parent) + throws ConfigurationException; + +} Added: trunk/18xx/rails/common/parser/GameFileParser.java =================================================================== --- trunk/18xx/rails/common/parser/GameFileParser.java (rev 0) +++ trunk/18xx/rails/common/parser/GameFileParser.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -0,0 +1,12 @@ +package rails.common.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class GameFileParser extends XMLParser { + +} Modified: trunk/18xx/rails/common/parser/GameInfoParser.java =================================================================== --- trunk/18xx/rails/common/parser/GameInfoParser.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/common/parser/GameInfoParser.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,6 +1,8 @@ package rails.common.parser; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import org.w3c.dom.Document; import org.w3c.dom.Element; Modified: trunk/18xx/rails/common/parser/XMLTags.java =================================================================== --- trunk/18xx/rails/common/parser/XMLTags.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/common/parser/XMLTags.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -9,7 +9,7 @@ public static final String OPTION_TAG = "Option"; public static final String GAMES_LIST_TAG = "GamesList"; public static final String NOTE_TAG = "Note"; - + /* ATTRIBUTES */ public static final String NAME_ATTR = "name"; public static final String COMPLETE_ATTR = "complete"; @@ -20,6 +20,12 @@ public static final String TYPE_ATTR = "type"; public static final String DEFAULT_ATTR = "default"; public static final String VALUES_ATTR = "values"; + public static final String CLASS_ATTR = "class"; + public static final String FILE_ATTR = "file"; + + public static final String VALUES_DELIM = ","; - public static final String VALUES_DELIM = ","; + /* Used by ComponentManager. */ + public static final String COMPONENT_MANAGER_ELEMENT_ID = "ComponentManager"; + public static final String COMPONENT_ELEMENT_ID = "Component"; } Modified: trunk/18xx/rails/game/Bank.java =================================================================== --- trunk/18xx/rails/game/Bank.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/Bank.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import rails.common.LocalText; import rails.common.parser.Config; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.model.CashModel; @@ -63,7 +64,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/BonusToken.java =================================================================== --- trunk/18xx/rails/game/BonusToken.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/BonusToken.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -5,6 +5,7 @@ */ package rails.game; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.move.ObjectMove; Modified: trunk/18xx/rails/game/Company.java =================================================================== --- trunk/18xx/rails/game/Company.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/Company.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.move.MoveableHolder; Modified: trunk/18xx/rails/game/CompanyI.java =================================================================== --- trunk/18xx/rails/game/CompanyI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/CompanyI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.List; +import rails.common.parser.ConfigurableComponentI; import rails.game.move.MoveableHolder; import rails.game.special.SpecialPropertyI; Modified: trunk/18xx/rails/game/CompanyManager.java =================================================================== --- trunk/18xx/rails/game/CompanyManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/CompanyManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; @@ -65,7 +66,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/CompanyManagerI.java =================================================================== --- trunk/18xx/rails/game/CompanyManagerI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/CompanyManagerI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,8 @@ import java.util.List; +import rails.common.parser.ConfigurableComponentI; + /** * Interface for CompanyManager objects. A company manager is a factory which * vends Company objects. Modified: trunk/18xx/rails/game/CompanyType.java =================================================================== --- trunk/18xx/rails/game/CompanyType.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/CompanyType.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -42,7 +42,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { //No longer needed. Modified: trunk/18xx/rails/game/CompanyTypeI.java =================================================================== --- trunk/18xx/rails/game/CompanyTypeI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/CompanyTypeI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.List; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; Deleted: trunk/18xx/rails/game/ComponentManager.java =================================================================== --- trunk/18xx/rails/game/ComponentManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/ComponentManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,157 +0,0 @@ -/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/ComponentManager.java,v 1.19 2010/05/18 04:12:23 stefanfrey Exp $ */ -package rails.game; - -import java.lang.reflect.Constructor; -import java.util.*; - -import org.apache.log4j.Logger; - -import rails.common.LocalText; -import rails.common.parser.ConfigurationException; -import rails.common.parser.Tag; - -/** - * ComponentManage - an implementation of ComponentManagerI, which handles the - * creation and configuration of rails.game components, and acts as a discovery - * point for other components to find them. - */ -public class ComponentManager { - - private String gameName; - - /** The name of the XML tag used to configure the ComponentManager. */ - public static final String ELEMENT_ID = "ComponentManager"; - - /** The name of the XML tag used to configure a component. */ - public static final String COMPONENT_ELEMENT_ID = "Component"; - - /** The name of the XML attribute for the component's name. */ - public static final String COMPONENT_NAME_TAG = "name"; - - /** The name of the XML attribute for the component's class. */ - public static final String COMPONENT_CLASS_TAG = "class"; - - /** The name of the XML attribute for the component's configuration file. */ - public static final String COMPONENT_FILE_TAG = "file"; - - private List<Tag> componentTags; - private Map<String, String> gameOptions; - - protected static Logger log = - Logger.getLogger(ComponentManager.class.getPackage().getName()); -// protected static List<String> directories = new ArrayList<String>(); - protected List<String> directories = new ArrayList<String>(); - - public static synchronized ComponentManager configureInstance(String gameName, Tag tag, - Map<String, String> gameOptions) - throws ConfigurationException { - return new ComponentManager(gameName, tag, gameOptions); - } - - private ComponentManager(String gameName, Tag tag, Map<String, String> gameOptions) - throws ConfigurationException { - - this.gameOptions = gameOptions; - this.gameName = gameName; - - componentTags = tag.getChildren(COMPONENT_ELEMENT_ID); - for (Tag component : componentTags) { - String compName = component.getAttributeAsString("name"); - log.debug("Found component " + compName); - if (compName.equalsIgnoreCase(GameManager.GM_NAME)) { - configureComponent(component); - break; - } - } - } - - public synchronized void finishPreparation() throws ConfigurationException { - - for (Tag componentTag : componentTags) { - componentTag.setGameOptions(gameOptions); - String compName = componentTag.getAttributeAsString("name"); - if (compName.equalsIgnoreCase(GameManager.GM_NAME)) continue; - log.debug("Found component " + compName); - configureComponent(componentTag); - } - } - - private void configureComponent(Tag componentTag) - throws ConfigurationException { - - // Extract the attributes of the Component - String name = componentTag.getAttributeAsString(COMPONENT_NAME_TAG); - if (name == null) { - throw new ConfigurationException( - LocalText.getText("UnnamedComponent")); - } - String clazz = componentTag.getAttributeAsString(COMPONENT_CLASS_TAG); - if (clazz == null) { - throw new ConfigurationException(LocalText.getText( - "ComponentHasNoClass", name)); - } - String file = componentTag.getAttributeAsString(COMPONENT_FILE_TAG); - - // Only one component per name. - if (mComponentMap.get(name) != null) { - throw new ConfigurationException(LocalText.getText( - "ComponentConfiguredTwice", name)); - } - - // Now construct the component - ConfigurableComponentI component; - try { - Class<? extends ConfigurableComponentI> compClass; - compClass = - Class.forName(clazz).asSubclass( - ConfigurableComponentI.class); - Constructor<? extends ConfigurableComponentI> compCons = - compClass.getConstructor(new Class[0]); - component = compCons.newInstance(new Object[0]); - } catch (Exception ex) { - // Not great to catch Exception, but there are MANY things that - // could go wrong - // here, and they all just mean that the configuration and code - // do not between - // them make a well-formed system. Debugging aided by chaining - // the caught exception. - throw new ConfigurationException(LocalText.getText( - "ComponentHasNoClass", clazz), ex); - - } - - // Configure the component, from a file, or the embedded XML. - Tag configElement = componentTag; - if (file != null) { - directories.add("data/" + gameName); - configElement = Tag.findTopTagInFile(file, directories, name); - configElement.setGameOptions(componentTag.getGameOptions()); - } - - try { - component.configureFromXML(configElement); - } catch (ConfigurationException e) { - // Temporarily allow components to be incompletely configured. - log.warn(LocalText.getText("AcceptingConfigFailure"), e); - } - - // Add it to the map of known components. - mComponentMap.put(name, component); - log.debug(LocalText.getText("ComponentInitAs", name, clazz )); - - } - - /** - * Returns the configured parameter with the given name. - * - * @param componentName the of the component sought. - * @return the component sought, or null if it has not been configured. - */ - public ConfigurableComponentI findComponent(String componentName) { - return mComponentMap.get(componentName); - } - - private Map<String, ConfigurableComponentI> mComponentMap = - new HashMap<String, ConfigurableComponentI>(); - -} Deleted: trunk/18xx/rails/game/ConfigurableComponentI.java =================================================================== --- trunk/18xx/rails/game/ConfigurableComponentI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/ConfigurableComponentI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,38 +0,0 @@ -/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/ConfigurableComponentI.java,v 1.7 2009/10/31 17:08:26 evos Exp $ */ -package rails.game; - -import rails.common.parser.ConfigurationException; -import rails.common.parser.Tag; - -/** - * Interface for rails.game components which can be configured from an XML - * element. - */ -public interface ConfigurableComponentI { - - /** - * Instructs the component to configure itself from the provided XML - * element. - * - * @param element the XML element containing the configuration - * @throws ConfigurationException - */ - void configureFromXML(Tag tag) throws ConfigurationException; - - /** - * This method is intended to be called for each configurable - * component, to perforn any initialisation activities that - * require any other components to be initialised first. - * This includes creating any required relationships to other - * configured components and objects. - * <p>This method should be called where necessary after all - * XML file parsing has completed, so that all objects that - * need to be related to do exist. - * @param parent The 'parent' configurable component is passed to allow - * the 'child' to access any other object without the need to resort to - * static calls where possible. - */ - void finishConfiguration (GameManagerI parent) - throws ConfigurationException; - -} Deleted: trunk/18xx/rails/game/DisplayBuffer.java =================================================================== --- trunk/18xx/rails/game/DisplayBuffer.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/DisplayBuffer.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,116 +0,0 @@ -/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/DisplayBuffer.java,v 1.9 2010/01/31 22:22:28 macfreek Exp $ */ -package rails.game; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import rails.util.Util; - -/** - * Class to write a log, and also to maintain a log message stack for writing to - * the UI. - */ -public final class DisplayBuffer { - - /** List to catch messages before the buffer is instantiated, - * based on the supposition that never 2 games will be initialised simultaneously... - */ - protected static List<String> initialQueue = new ArrayList<String>(); - - protected static Logger log = - Logger.getLogger(DisplayBuffer.class.getPackage().getName()); - - public DisplayBuffer() { - if (!initialQueue.isEmpty()) { - for (String s : initialQueue) { - addMessage (s, true); - } - initialQueue.clear(); - } - } - - /** - * A buffer for displaying messages in a popup window after any user action. - * These include error messages and other notifications of immediate - * interest to players. - */ - private List<String> displayBuffer = new ArrayList<String>(); - - private boolean autoDisplay = true; - - /** - * Add a message to the message (display) buffer (and display it on the - * console) - */ - public static void add(String message) { - add (message, true); - } - - public static void add(String message, boolean autoDisplay) { - GameManagerI gm = GameManager.getInstance(); - DisplayBuffer instance = null; - if (gm != null) instance = gm.getDisplayBuffer(); - if (gm == null || instance == null) { - // Queue in a static buffer until the instance is created - initialQueue.add(message); - } else { - instance.addMessage(message, autoDisplay); - } - } - - private void addMessage (String message, boolean autoDisplay) { - DisplayBuffer instance = getInstance(); - instance.autoDisplay = autoDisplay; - if (Util.hasValue(message)) { - instance.displayBuffer.add(message); - /* Also log the message (don't remove this, - * otherwise the message will not be logged during a reload, - * which may hinder troubleshooting) */ - log.debug("To display: " + message); - } - } - - private static DisplayBuffer getInstance() { - GameManagerI gm = GameManager.getInstance(); - if (gm == null) { - return null; - } else { - return gm.getDisplayBuffer(); - } - } - - /** Get the current message buffer, and clear it */ - public static String[] get() { - DisplayBuffer instance = getInstance(); - if (instance == null) { - if (initialQueue.isEmpty()) { - return null; - } else { - String[] message = initialQueue.toArray(new String[0]); - initialQueue.clear(); - return message; - } - } else if (instance.displayBuffer.size() > 0) { - String[] message = instance.displayBuffer.toArray(new String[0]); - instance.displayBuffer.clear(); - return message; - } else { - return null; - } - } - - public static int getSize() { - return getInstance().displayBuffer.size(); - } - - public static boolean getAutoDisplay () { - return getInstance().autoDisplay; - } - - public static void clear() { - getInstance().displayBuffer.clear(); - } - -} Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/Game.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -7,10 +7,13 @@ import org.apache.log4j.Logger; import rails.algorithms.RevenueManager; +import rails.common.DisplayBuffer; import rails.common.LocalText; +import rails.common.parser.ComponentManager; import rails.common.parser.ConfigurationException; import rails.common.parser.GameOption; import rails.common.parser.Tag; +import rails.common.parser.XMLTags; import rails.game.action.PossibleAction; import rails.game.special.SpecialProperty; @@ -79,27 +82,22 @@ try { componentManagerTag = Tag.findTopTagInFile(GAME_XML_FILE, directories, - ComponentManager.ELEMENT_ID); + XMLTags.COMPONENT_MANAGER_ELEMENT_ID); if (componentManagerTag == null) { throw new ConfigurationException( "No Game XML element found in file " + GAME_XML_FILE); } componentManagerTag.setGameOptions(gameOptions); - componentManager = - ComponentManager.configureInstance(name, componentManagerTag, gameOptions); + + // Have the ComponentManager work through the other rails.game files + //XXX: Ultimately calls everyone's configureFromXML() methods. + componentManager = new ComponentManager(name, componentManagerTag, gameOptions); log.info("========== Start of rails.game " + name + " =========="); log.info("Rails version "+version); ReportBuffer.add(LocalText.getText("GameIs", name)); - // set special properties and token static variables - SpecialProperty.init(); - Token.init(); - - // Have the ComponentManager work through the other rails.game files - componentManager.finishPreparation(); - playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); if (playerManager == null) { throw new ConfigurationException( Modified: trunk/18xx/rails/game/GameManager.java =================================================================== --- trunk/18xx/rails/game/GameManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/GameManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -10,10 +10,12 @@ import org.apache.log4j.NDC; import rails.algorithms.RevenueManager; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.GuiHints; import rails.common.LocalText; import rails.common.parser.Config; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.GameOption; import rails.common.parser.Tag; @@ -102,9 +104,6 @@ protected EnumMap<GameDef.Parm, Object> gameParameters = new EnumMap<GameDef.Parm, Object>(GameDef.Parm.class); - // protected EnumSet<CorrectionType> activeCorrections - // = EnumSet.noneOf(CorrectionType.class); - /** * Current round should not be set here but from within the Round classes. * This is because in some cases the round has already changed to another Modified: trunk/18xx/rails/game/GameManagerI.java =================================================================== --- trunk/18xx/rails/game/GameManagerI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/GameManagerI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -4,8 +4,10 @@ import java.util.Map; import rails.algorithms.RevenueManager; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.GuiHints; +import rails.common.parser.ConfigurableComponentI; import rails.game.action.PossibleAction; import rails.game.correct.CorrectionManagerI; import rails.game.correct.CorrectionType; @@ -17,7 +19,7 @@ public interface GameManagerI extends MoveableHolder, ConfigurableComponentI { /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public abstract void init(String gameName, PlayerManager playerManager, CompanyManagerI companyManager, PhaseManager phaseManager, Modified: trunk/18xx/rails/game/MapHex.java =================================================================== --- trunk/18xx/rails/game/MapHex.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/MapHex.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -9,6 +9,7 @@ import rails.algorithms.RevenueBonusTemplate; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.action.LayTile; @@ -156,7 +157,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Pattern namePattern = Pattern.compile("(\\D+?)(-?\\d+)"); Modified: trunk/18xx/rails/game/MapManager.java =================================================================== --- trunk/18xx/rails/game/MapManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/MapManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import rails.common.parser.Config; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import tools.Util; @@ -58,7 +59,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { String attr = tag.getAttributeAsString("tileOrientation"); Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/OperatingRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.common.parser.GameOption; Modified: trunk/18xx/rails/game/PhaseI.java =================================================================== --- trunk/18xx/rails/game/PhaseI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/PhaseI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,8 @@ import java.util.Map; +import rails.common.parser.ConfigurableComponentI; + public interface PhaseI extends ConfigurableComponentI { public boolean isTileColourAllowed(String tileColour); Modified: trunk/18xx/rails/game/PhaseManager.java =================================================================== --- trunk/18xx/rails/game/PhaseManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/PhaseManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -5,6 +5,7 @@ import org.apache.log4j.Logger; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.model.ModelObject; Modified: trunk/18xx/rails/game/PlayerManager.java =================================================================== --- trunk/18xx/rails/game/PlayerManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/PlayerManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -4,6 +4,7 @@ import java.util.*; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; Modified: trunk/18xx/rails/game/PrivateCompany.java =================================================================== --- trunk/18xx/rails/game/PrivateCompany.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/PrivateCompany.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -64,7 +64,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ @Override public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/Round.java =================================================================== --- trunk/18xx/rails/game/Round.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/Round.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -9,6 +9,7 @@ import org.apache.log4j.Logger; +import rails.common.DisplayBuffer; import rails.common.GuiHints; import rails.common.LocalText; import rails.game.action.*; Modified: trunk/18xx/rails/game/ShareSellingRound.java =================================================================== --- trunk/18xx/rails/game/ShareSellingRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/ShareSellingRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -7,6 +7,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.common.parser.GameOption; Modified: trunk/18xx/rails/game/StartRound.java =================================================================== --- trunk/18xx/rails/game/StartRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StartRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.common.parser.GameOption; Modified: trunk/18xx/rails/game/StartRound_1830.java =================================================================== --- trunk/18xx/rails/game/StartRound_1830.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StartRound_1830.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,6 +1,7 @@ /* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/StartRound_1830.java,v 1.33 2010/06/21 22:57:53 stefanfrey Exp $ */ package rails.game; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.common.parser.GameOption; import rails.game.action.*; Modified: trunk/18xx/rails/game/StartRound_1835.java =================================================================== --- trunk/18xx/rails/game/StartRound_1835.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StartRound_1835.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.action.*; import rails.game.state.IntegerState; Modified: trunk/18xx/rails/game/StockMarket.java =================================================================== --- trunk/18xx/rails/game/StockMarket.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StockMarket.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -4,6 +4,7 @@ import java.util.*; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.move.PriceTokenMove; @@ -44,7 +45,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/StockMarketI.java =================================================================== --- trunk/18xx/rails/game/StockMarketI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StockMarketI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,8 @@ import java.util.List; +import rails.common.parser.ConfigurableComponentI; + public interface StockMarketI extends ConfigurableComponentI { /** Modified: trunk/18xx/rails/game/StockRound.java =================================================================== --- trunk/18xx/rails/game/StockRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/StockRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -2,6 +2,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.common.parser.GameOption; Modified: trunk/18xx/rails/game/TileManager.java =================================================================== --- trunk/18xx/rails/game/TileManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/TileManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; @@ -27,7 +28,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tileSetTop) throws ConfigurationException { /* Modified: trunk/18xx/rails/game/Token.java =================================================================== --- trunk/18xx/rails/game/Token.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/Token.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -29,18 +29,10 @@ Logger.getLogger(Token.class.getPackage().getName()); public Token() { - uniqueId = "Token_" + (index++); tokenMap.put(uniqueId, this); } - // initialize the special properties static variables - public static void init() { - tokenMap = new HashMap<String, TokenI>(); - index = 0; - log.debug("Init token static variables"); - } - public static TokenI getByUniqueId(String id) { return tokenMap.get(id); } Modified: trunk/18xx/rails/game/TrainManager.java =================================================================== --- trunk/18xx/rails/game/TrainManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/TrainManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import rails.common.LocalText; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; import rails.game.move.ObjectMove; @@ -72,7 +73,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/TrainType.java =================================================================== --- trunk/18xx/rails/game/TrainType.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/TrainType.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -54,7 +54,7 @@ } /** - * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) + * @see rails.common.parser.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { Modified: trunk/18xx/rails/game/TreasuryShareRound.java =================================================================== --- trunk/18xx/rails/game/TreasuryShareRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/TreasuryShareRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -7,6 +7,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.game.action.*; Modified: trunk/18xx/rails/game/correct/CashCorrectionManager.java =================================================================== --- trunk/18xx/rails/game/correct/CashCorrectionManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/correct/CashCorrectionManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,5 +1,6 @@ package rails.game.correct; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.*; import rails.game.move.CashMove; Modified: trunk/18xx/rails/game/correct/CorrectionManager.java =================================================================== --- trunk/18xx/rails/game/correct/CorrectionManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/correct/CorrectionManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -5,8 +5,8 @@ import org.apache.log4j.Logger; +import rails.common.DisplayBuffer; import rails.common.LocalText; -import rails.game.DisplayBuffer; import rails.game.GameManager; import rails.game.ReportBuffer; import rails.game.move.StateChange; Modified: trunk/18xx/rails/game/correct/MapCorrectionManager.java =================================================================== --- trunk/18xx/rails/game/correct/MapCorrectionManager.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/correct/MapCorrectionManager.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -4,10 +4,10 @@ import java.util.HashMap; import java.util.List; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.BaseToken; import rails.game.City; -import rails.game.DisplayBuffer; import rails.game.GameManager; import rails.game.MapHex; import rails.game.ReportBuffer; Modified: trunk/18xx/rails/game/special/SpecialProperty.java =================================================================== --- trunk/18xx/rails/game/special/SpecialProperty.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/special/SpecialProperty.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -54,20 +54,13 @@ /** To give subclasses access to the various 'managers' */ protected GameManagerI gameManager; - protected static Map<Integer, SpecialPropertyI> spMap = - new HashMap<Integer, SpecialPropertyI>(); + protected static Map<Integer, SpecialPropertyI> spMap = new HashMap<Integer, SpecialPropertyI>(); + protected static int lastIndex = 0; protected static Logger log = Logger.getLogger(SpecialProperty.class.getPackage().getName()); - // initialize the special properties static variables - public static void init() { - spMap = new HashMap<Integer, SpecialPropertyI>(); - lastIndex = 0; - log.debug("Init special property static variables"); - } - public SpecialProperty() { uniqueId = ++lastIndex; spMap.put(uniqueId, this); Modified: trunk/18xx/rails/game/special/SpecialPropertyI.java =================================================================== --- trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,6 +1,7 @@ /* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialPropertyI.java,v 1.12 2010/03/16 21:21:59 evos Exp $ */ package rails.game.special; +import rails.common.parser.ConfigurableComponentI; import rails.game.*; import rails.game.move.Moveable; import rails.game.move.MoveableHolder; Modified: trunk/18xx/rails/game/specific/_1825/StartRound_1825.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/StartRound_1825.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1825/StartRound_1825.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -2,6 +2,7 @@ import java.util.List; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.*; import rails.game.action.*; Modified: trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java =================================================================== --- trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -2,6 +2,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.common.parser.GameOption; import rails.game.*; Modified: trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java =================================================================== --- trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -2,6 +2,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.game.*; Modified: trunk/18xx/rails/game/specific/_1851/StartRound_1851.java =================================================================== --- trunk/18xx/rails/game/specific/_1851/StartRound_1851.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1851/StartRound_1851.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.List; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.*; import rails.game.action.*; Modified: trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java =================================================================== --- trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -2,6 +2,7 @@ import java.util.*; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.game.*; Modified: trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java =================================================================== --- trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import rails.common.DisplayBuffer; import rails.common.GuiDef; import rails.common.LocalText; import rails.game.*; Modified: trunk/18xx/rails/game/specific/_1856/StockRound_1856.java =================================================================== --- trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,5 +1,6 @@ package rails.game.specific._1856; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.*; import rails.game.action.BuyCertificate; Modified: trunk/18xx/rails/game/specific/_1880/StartRound_1880.java =================================================================== --- trunk/18xx/rails/game/specific/_1880/StartRound_1880.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1880/StartRound_1880.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -3,6 +3,7 @@ */ package rails.game.specific._1880; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.game.*; import rails.game.action.*; Modified: trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java =================================================================== --- trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -1,6 +1,7 @@ /* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/specific/_1889/OperatingRound_1889.java,v 1.1 2010/02/23 22:21:40 stefanfrey Exp $ */ package rails.game.specific._1889; +import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.common.parser.GameOption; import rails.game.*; Modified: trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2011-07-04 16:31:43 UTC (rev 1601) +++ trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2011-07-04 22:27:18 UTC (rev 1602) @@ -10,9 +10,9 @@ import rails.algorithms.RevenueDynamicModifier; import rails.algorithms.RevenueStaticModifier; import rails.algorithms.RevenueTrainRun; +import rails.common.parser.ConfigurableComponentI; import rails.common.parser.ConfigurationException; import rails.common.parser.Tag; -import rails.game.ConfigurableComponentI; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.TrainI; Modified: trunk/18xx/rails/game/specific/_18AL/NamedTrainToken.java =================================================================== --- trunk/18xx/rails/game/specific/_18AL/Name... [truncated message content] |
From: <ev...@us...> - 2011-07-04 16:31:50
|
Revision: 1601 http://rails.svn.sourceforge.net/rails/?rev=1601&view=rev Author: evos Date: 2011-07-04 16:31:43 +0000 (Mon, 04 Jul 2011) Log Message: ----------- Fixed bug #3289557: player worth is not immediately updated when buying a private. Modified Paths: -------------- trunk/18xx/rails/game/Portfolio.java trunk/18xx/rails/game/TokenHolder.java Modified: trunk/18xx/rails/game/Portfolio.java =================================================================== --- trunk/18xx/rails/game/Portfolio.java 2011-07-04 11:21:08 UTC (rev 1600) +++ trunk/18xx/rails/game/Portfolio.java 2011-07-04 16:31:43 UTC (rev 1601) @@ -114,6 +114,7 @@ Util.moveObjects(otherPortfolio.getCertificates(), this); } + /** Low-level method, only to be called by the local addObject() method and by initialisation code. */ public void addPrivate(PrivateCompanyI privateCompany, int position) { if (!Util.addToList(privateCompanies, privateCompany, position)) return; @@ -127,13 +128,16 @@ log.debug(privateCompany.getName() + " has no special properties"); } privatesOwnedModel.update(); + updatePlayerWorth (); } + /** Low-level method, only to be called by the local addObject() method and by initialisation code. */ public void addCertificate(PublicCertificateI certificate){ addCertificate (certificate, new int[] {-1,-1,-1}); } - public void addCertificate(PublicCertificateI certificate, int[] position) { + /** Low-level method, only to be called by the local addObject() method. */ + private void addCertificate(PublicCertificateI certificate, int[] position) { // When undoing a company start, put the President back at the top. if (certificate.isPresidentShare()) position = new int[] {0,0,0}; @@ -155,20 +159,21 @@ certificate.setPortfolio(this); getShareModel(certificate.getCompany()).addShare(certificate.getShare()); - if (owner instanceof Player) { - ((Player)owner).updateWorth(); - } + updatePlayerWorth (); } - public boolean removePrivate(PrivateCompanyI privateCompany) { + /** Low-level method, only to be called by the local addObject() method. */ + private boolean removePrivate(PrivateCompanyI privateCompany) { boolean removed = privateCompanies.remove(privateCompany); if (removed) { privatesOwnedModel.update(); + updatePlayerWorth (); } return removed; } - public void removeCertificate(PublicCertificateI certificate) { + /** Low-level method, only to be called by the local addObject() method. */ + private void removeCertificate(PublicCertificateI certificate) { certificates.remove(certificate); String companyName = certificate.getCompany().getName(); @@ -186,13 +191,17 @@ getShareModel(certificate.getCompany()).addShare( -certificate.getShare()); + updatePlayerWorth (); + } + + protected void updatePlayerWorth () { if (owner instanceof Player) { ((Player)owner).updateWorth(); } } + + public ShareModel getShareModel(PublicCompanyI company) { - public ShareModel getShareModel(PublicCompanyI company) { - if (!shareModelPerCompany.containsKey(company)) { shareModelPerCompany.put(company, new ShareModel(this, company)); } @@ -394,11 +403,13 @@ return swapped; } + /** Low-level method, only to be called by initialisation code and by the local addObject() method. */ public void addTrain (TrainI train) { addTrain (train, new int[] {-1,-1,-1}); } - public void addTrain(TrainI train, int[] position) { + /** Low-level method, only to be called by the local addObject() method. */ + private void addTrain(TrainI train, int[] position) { Util.addToList(trains, train, position[0]); @@ -418,7 +429,8 @@ trainsModel.update(); } - public void removeTrain(TrainI train) { + /** Low-level method, only to be called by Move objects */ + private void removeTrain(TrainI train) { trains.remove(train); trainsPerType.get(train.getPreviousType()).remove(train); trainsPerCertType.get(train.getCertType()).remove(train); @@ -543,11 +555,12 @@ /** * Add a special property. Used to make special properties independent of * the private company that originally held it. + * Low-level method, only to be called by Move objects. * * @param property The special property object to add. * @return True if successful. */ - public boolean addSpecialProperty(SpecialPropertyI property, int position) { + private boolean addSpecialProperty(SpecialPropertyI property, int position) { if (specialProperties == null) { @@ -579,11 +592,11 @@ /** * Remove a special property. - * + * Low-level method, only to be called by Move objects. * @param property The special property object to remove. * @return True if successful. */ - public boolean removeSpecialProperty(SpecialPropertyI property) { + private boolean removeSpecialProperty(SpecialPropertyI property) { boolean result = false; @@ -604,7 +617,7 @@ /** * Add an object. - * + * Low-level method, only to be called by Move objects. * @param object The object to add. * @return True if successful. */ @@ -631,6 +644,7 @@ /** * Remove an object. + * Low-level method, only to be called by Move objects. * * @param object The object to remove. * @return True if successful. @@ -755,11 +769,13 @@ return privatesOwnedModel; } + /** Low-level method, only to be called by the local addObject() method. */ public boolean addToken(TokenI token, int position) { return Util.addToList(tokens, token, position); } + /** Low-level method, only to be called by the local addObject() method. */ public boolean removeToken(TokenI token) { return tokens.remove(token); } Modified: trunk/18xx/rails/game/TokenHolder.java =================================================================== --- trunk/18xx/rails/game/TokenHolder.java 2011-07-04 11:21:08 UTC (rev 1600) +++ trunk/18xx/rails/game/TokenHolder.java 2011-07-04 16:31:43 UTC (rev 1601) @@ -12,7 +12,7 @@ */ public interface TokenHolder extends MoveableHolder { - /* + /** * Add a token. Subclasses may override this method to implement side * effects. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-07-04 11:21:14
|
Revision: 1600 http://rails.svn.sourceforge.net/rails/?rev=1600&view=rev Author: evos Date: 2011-07-04 11:21:08 +0000 (Mon, 04 Jul 2011) Log Message: ----------- Updated ModelObject.update() to return immediately if there are no observers. This saves unnecessary overhead in constructing unused View text. Modified Paths: -------------- trunk/18xx/rails/game/model/ModelObject.java Modified: trunk/18xx/rails/game/model/ModelObject.java =================================================================== --- trunk/18xx/rails/game/model/ModelObject.java 2011-07-04 11:12:54 UTC (rev 1599) +++ trunk/18xx/rails/game/model/ModelObject.java 2011-07-04 11:21:08 UTC (rev 1600) @@ -73,7 +73,7 @@ */ public void update() { /* Notify the observers about the change */ - notifyViewObjects(); + if (countObservers() > 0) notifyViewObjects(); /* Also update all model objects that depend on this one */ if (dependents != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-07-04 11:13:00
|
Revision: 1599 http://rails.svn.sourceforge.net/rails/?rev=1599&view=rev Author: evos Date: 2011-07-04 11:12:54 +0000 (Mon, 04 Jul 2011) Log Message: ----------- Fixed that undoing a Coalfields right by action did not reset the UI. HashMapState now extends ModelObject. MapChange and RemoveFromMap now can be passed the ModelObject it is changing, and on execute() and undo() the model update() method is now called to update the Observers; this all works the same way as ArrayListState already did. Modified Paths: -------------- trunk/18xx/rails/game/PublicCompany.java trunk/18xx/rails/game/PublicCompanyI.java trunk/18xx/rails/game/move/MapChange.java trunk/18xx/rails/game/move/RemoveFromMap.java trunk/18xx/rails/game/state/HashMapState.java Removed Paths: ------------- trunk/18xx/rails/game/model/RightsModel.java Modified: trunk/18xx/rails/game/PublicCompany.java =================================================================== --- trunk/18xx/rails/game/PublicCompany.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/PublicCompany.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -280,7 +280,7 @@ /** Rights */ protected HashMapState<String, String> rights = null; - protected RightsModel rightsModel = new RightsModel(); + //protected RightsModel rightsModel = new RightsModel(); /** @@ -765,6 +765,9 @@ for (SpecialPropertyI sp : specialProperties) { if (sp instanceof SpecialRight) { gameManager.setGuiParameter (GuiDef.Parm.HAS_ANY_RIGHTS, true); + // Initialize rights here to prevent overhead if not used, + // but if rights are used, the GUI needs it from the start. + if (rights == null) rights = new HashMapState<String, String>(name+"_Rights"); } } } @@ -1986,8 +1989,9 @@ return currentLoanValue; } - public RightsModel getRightsModel () { - return rightsModel; + public ModelObject getRightsModel () { + //return rightsModel; + return rights; } public boolean canClose() { @@ -1997,10 +2001,10 @@ public void setRight (String nameOfRight, String value) { if (rights == null) { rights = new HashMapState<String, String>(name+"_Rights"); - rightsModel.init (rights); + //rightsModel.init (rights); } rights.put(nameOfRight, value); - rightsModel.update(); + //rightsModel.update(); } public boolean hasRight (String nameOfRight) { Modified: trunk/18xx/rails/game/PublicCompanyI.java =================================================================== --- trunk/18xx/rails/game/PublicCompanyI.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/PublicCompanyI.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -342,7 +342,7 @@ public int getMaxLoansPerRound(); public int getValuePerLoan(); public MoneyModel getLoanValueModel (); - public RightsModel getRightsModel (); + public ModelObject getRightsModel (); public int sharesOwnedByPlayers(); public String getExtraShareMarks (); Deleted: trunk/18xx/rails/game/model/RightsModel.java =================================================================== --- trunk/18xx/rails/game/model/RightsModel.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/model/RightsModel.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -1,37 +0,0 @@ -/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/model/RightsModel.java,v 1.6 2008/06/04 19:00:37 evos Exp $*/ -package rails.game.model; - -import rails.game.state.HashMapState; -import tools.Util; - -public class RightsModel extends ModelObject { - - private HashMapState<String, String> rights; - - public RightsModel() { - } - - /** Split off from the constructor to allow the rights map to exist only if needed */ - public void init (HashMapState<String, String> rights) { - this.rights = rights; - } - - public String getText() { - - if (rights == null) return ""; - - StringBuilder buf = new StringBuilder("<html>"); - for (String name : rights.viewKeySet()) { - if (buf.length() > 6) buf.append("<br>"); - buf.append(name); - String value = rights.get(name); - if (Util.hasValue(value)) buf.append("=").append(value); - } - if (buf.length() > 6) { - buf.append("</html>"); - } - return buf.toString(); - - } - -} Modified: trunk/18xx/rails/game/move/MapChange.java =================================================================== --- trunk/18xx/rails/game/move/MapChange.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/move/MapChange.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -7,6 +7,8 @@ import java.util.Map; +import rails.game.model.ModelObject; + /** * This Move class handles adding an entry to a Map. * @@ -35,9 +37,22 @@ MoveSet.add(this); } + public MapChange (Map<K, V> map, K key, V newValue, ModelObject modelToUpdate) { + + this.map = map; + this.key = key; + this.newValue = newValue; + this.oldValue = map.get(key); + this.keyExisted = map.containsKey(key); + if (modelToUpdate != null) registerModelToUpdate (modelToUpdate); + + MoveSet.add(this); + } + @Override public boolean execute() { map.put(key, newValue); + updateModels(); return true; } @@ -48,6 +63,7 @@ } else { map.remove(key); } + updateModels(); return true; } Modified: trunk/18xx/rails/game/move/RemoveFromMap.java =================================================================== --- trunk/18xx/rails/game/move/RemoveFromMap.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/move/RemoveFromMap.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -7,6 +7,8 @@ import java.util.Map; +import rails.game.model.ModelObject; + /** * This Move class handles removable from a stateful map (collection) * @@ -34,10 +36,23 @@ MoveSet.add(this); } + public RemoveFromMap (Map<K, V> map, K key, ModelObject modelToUpdate) { + + keyExisted = map.containsKey(key); + if (!keyExisted) return; // Nothing to do + this.map = map; + this.key = key; + this.oldValue = map.get(key); + if (modelToUpdate != null) registerModelToUpdate (modelToUpdate); + + MoveSet.add(this); + } + @Override public boolean execute() { if (keyExisted) { map.remove(key); + updateModels(); } return true; } @@ -46,6 +61,7 @@ public boolean undo() { if (keyExisted) { map.put (key, oldValue); + updateModels(); } return true; } Modified: trunk/18xx/rails/game/state/HashMapState.java =================================================================== --- trunk/18xx/rails/game/state/HashMapState.java 2011-07-03 20:06:38 UTC (rev 1598) +++ trunk/18xx/rails/game/state/HashMapState.java 2011-07-04 11:12:54 UTC (rev 1599) @@ -8,8 +8,10 @@ import java.util.Map; import java.util.Set; +import rails.game.model.ModelObject; import rails.game.move.MapChange; import rails.game.move.RemoveFromMap; +import tools.Util; /** * State class that wraps a HashMap @@ -23,7 +25,7 @@ * */ -public class HashMapState<K,V>{ +public class HashMapState<K,V> extends ModelObject { private final HashMap<K,V> map = new HashMap<K,V>(); private String mapName; @@ -42,12 +44,12 @@ } public void put(K key, V value) { - new MapChange<K,V>(map, key, value); + new MapChange<K,V>(map, key, value, this); } public void putAll(Map<K,V> map) { for (K key:map.keySet()) { - new MapChange<K,V>(map, key, map.get(key)); + new MapChange<K,V>(map, key, map.get(key), this); } } @@ -56,7 +58,7 @@ } public void remove(K key) { - new RemoveFromMap<K,V>(map, key); + new RemoveFromMap<K,V>(map, key, this); } public boolean hasKey(K key) { @@ -72,6 +74,7 @@ for (K key : keys) { remove (key); } + update(); } /** @@ -93,6 +96,7 @@ new MapChange<K,V>(map, key, initMap.get(key)); } } + update(); } /** @@ -115,4 +119,24 @@ public boolean isEmpty() { return map.isEmpty(); } + + @Override + public String getText() { + + if (map == null) return ""; + + StringBuilder buf = new StringBuilder("<html>"); + for (K name : map.keySet()) { + if (buf.length() > 6) buf.append("<br>"); + buf.append(name.toString()); + Object value = map.get(name); + if (value != null && Util.hasValue(value.toString())) buf.append("=").append(value.toString()); + } + if (buf.length() > 6) { + buf.append("</html>"); + } + return buf.toString(); + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2011-07-03 20:06:48
|
Revision: 1598 http://rails.svn.sourceforge.net/rails/?rev=1598&view=rev Author: wakko666 Date: 2011-07-03 20:06:38 +0000 (Sun, 03 Jul 2011) Log Message: ----------- Refactor GameInfo XML parsing Modified Paths: -------------- trunk/18xx/data/GamesList.xml trunk/18xx/rails/algorithms/RevenueAdapter.java trunk/18xx/rails/algorithms/RevenueBonusTemplate.java trunk/18xx/rails/algorithms/RevenueManager.java trunk/18xx/rails/algorithms/RevenueTrainRun.java trunk/18xx/rails/game/Bank.java trunk/18xx/rails/game/BonusToken.java trunk/18xx/rails/game/Company.java trunk/18xx/rails/game/CompanyManager.java trunk/18xx/rails/game/CompanyType.java trunk/18xx/rails/game/CompanyTypeI.java trunk/18xx/rails/game/ComponentManager.java trunk/18xx/rails/game/ConfigurableComponentI.java trunk/18xx/rails/game/EndOfGameRound.java trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/game/MapHex.java trunk/18xx/rails/game/MapManager.java trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/Phase.java trunk/18xx/rails/game/PhaseManager.java trunk/18xx/rails/game/PlayerManager.java trunk/18xx/rails/game/Portfolio.java trunk/18xx/rails/game/PrivateCompany.java trunk/18xx/rails/game/PublicCertificate.java trunk/18xx/rails/game/PublicCompany.java trunk/18xx/rails/game/ReportBuffer.java trunk/18xx/rails/game/Round.java trunk/18xx/rails/game/ShareSellingRound.java trunk/18xx/rails/game/StartPacket.java trunk/18xx/rails/game/StartRound.java trunk/18xx/rails/game/StartRound_1830.java trunk/18xx/rails/game/StartRound_1835.java trunk/18xx/rails/game/StockMarket.java trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/StockSpaceType.java trunk/18xx/rails/game/Tile.java trunk/18xx/rails/game/TileI.java trunk/18xx/rails/game/TileManager.java trunk/18xx/rails/game/TrainCertificateType.java trunk/18xx/rails/game/TrainManager.java trunk/18xx/rails/game/TrainType.java trunk/18xx/rails/game/TreasuryShareRound.java trunk/18xx/rails/game/action/LayBonusToken.java trunk/18xx/rails/game/correct/CashCorrectionManager.java trunk/18xx/rails/game/correct/CorrectionManager.java trunk/18xx/rails/game/correct/CorrectionModeAction.java trunk/18xx/rails/game/correct/MapCorrectionManager.java trunk/18xx/rails/game/move/MoveStack.java trunk/18xx/rails/game/special/ExchangeForShare.java trunk/18xx/rails/game/special/LocatedBonus.java trunk/18xx/rails/game/special/SellBonusToken.java trunk/18xx/rails/game/special/SpecialProperty.java trunk/18xx/rails/game/special/SpecialRight.java trunk/18xx/rails/game/special/SpecialTileLay.java trunk/18xx/rails/game/special/SpecialTokenLay.java trunk/18xx/rails/game/special/SpecialTrainBuy.java trunk/18xx/rails/game/specific/_1825/StartRound_1825.java trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java trunk/18xx/rails/game/specific/_1835/StockRound_1835.java trunk/18xx/rails/game/specific/_1851/StartRound_1851.java trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java trunk/18xx/rails/game/specific/_1856/PublicCompany_CGR.java trunk/18xx/rails/game/specific/_1856/StockRound_1856.java trunk/18xx/rails/game/specific/_1880/StartRound_1880.java trunk/18xx/rails/game/specific/_1880/StockRound_1880.java trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java trunk/18xx/rails/game/specific/_18AL/NameTrains.java trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java trunk/18xx/rails/game/specific/_18AL/NamedTrainToken.java trunk/18xx/rails/game/specific/_18AL/OperatingRound_18AL.java trunk/18xx/rails/game/specific/_18EU/FinalMinorExchangeRound.java trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java trunk/18xx/rails/game/specific/_18EU/OperatingRound_18EU.java trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java trunk/18xx/rails/game/specific/_18Kaas/RuhrRevenueModifier.java trunk/18xx/rails/test/GameTest.java trunk/18xx/rails/ui/swing/AbstractReportWindow.java trunk/18xx/rails/ui/swing/AutoSaveLoadDialog.java trunk/18xx/rails/ui/swing/ConfigWindow.java trunk/18xx/rails/ui/swing/GameSetupWindow.java trunk/18xx/rails/ui/swing/GameStatus.java trunk/18xx/rails/ui/swing/GameUIManager.java trunk/18xx/rails/ui/swing/ImageLoader.java trunk/18xx/rails/ui/swing/ORPanel.java trunk/18xx/rails/ui/swing/ORUIManager.java trunk/18xx/rails/ui/swing/ORWindow.java trunk/18xx/rails/ui/swing/RemainingTilesWindow.java trunk/18xx/rails/ui/swing/ReportWindow.java trunk/18xx/rails/ui/swing/ReportWindowDynamic.java trunk/18xx/rails/ui/swing/Scale.java trunk/18xx/rails/ui/swing/StartRoundWindow.java trunk/18xx/rails/ui/swing/StatusWindow.java trunk/18xx/rails/ui/swing/UpgradesPanel.java trunk/18xx/rails/ui/swing/WindowSettings.java trunk/18xx/rails/ui/swing/elements/CheckBoxDialog.java trunk/18xx/rails/ui/swing/elements/ConfirmationDialog.java trunk/18xx/rails/ui/swing/elements/MessageDialog.java trunk/18xx/rails/ui/swing/elements/RadioButtonDialog.java trunk/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java trunk/18xx/rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java trunk/18xx/rails/ui/swing/gamespecific/_18AL/NameTrainsDialog.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameUIManager_18EU.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/StatusWindow_18EU.java trunk/18xx/rails/ui/swing/hexmap/HexMap.java trunk/18xx/rails/ui/swing/hexmap/HexMapImage.java trunk/18xx/rails/util/ListAndFixSavedFiles.java trunk/18xx/rails/util/RunGame.java trunk/18xx/rails/util/Util.java trunk/18xx/test/TestGame.java trunk/18xx/test/TestGameBuilder.java trunk/18xx/tools/ConvertTilesXML.java trunk/18xx/tools/MakeGameTileSets.java trunk/18xx/tools/XmlUtils.java Added Paths: ----------- trunk/18xx/rails/common/LocalText.java trunk/18xx/rails/common/MoneyFormatter.java trunk/18xx/rails/common/ResourceLoader.java trunk/18xx/rails/common/parser/ trunk/18xx/rails/common/parser/Config.java trunk/18xx/rails/common/parser/ConfigItem.java trunk/18xx/rails/common/parser/ConfigurationException.java trunk/18xx/rails/common/parser/GameInfo.java trunk/18xx/rails/common/parser/GameInfoParser.java trunk/18xx/rails/common/parser/GameOption.java trunk/18xx/rails/common/parser/Tag.java trunk/18xx/rails/common/parser/XMLParser.java trunk/18xx/rails/common/parser/XMLTags.java Removed Paths: ------------- trunk/18xx/rails/game/ConfigurationException.java trunk/18xx/rails/game/GameOption.java trunk/18xx/rails/game/GamesInfo.java trunk/18xx/rails/util/Config.java trunk/18xx/rails/util/ConfigItem.java trunk/18xx/rails/util/Format.java trunk/18xx/rails/util/LocalText.java trunk/18xx/rails/util/ResourceLoader.java trunk/18xx/rails/util/Tag.java Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/data/GamesList.xml 2011-07-03 20:06:38 UTC (rev 1598) @@ -318,17 +318,33 @@ </Game> - <Credits>Rails is a computer implementation of a number of railroad board games, -that are collectively known as the "18xx" railway game system. -Rails is a Sourceforge project. -Project founder: Brett Lentz. -Developers: Erik Vos, Stefan Frey and Brett Lentz. + <Credits>Rails is a computer implementation of a number of board games. + These games all have a railroad theme. They are collectively known as "18xx" + games due to the naming scheme used by many games in the genre. -The 18xx railway game system was originated by Francis Tresham and Hartland Trefoil Ltd. +Contributors: + Erik Vos + Stefan Frey + Freek Dijkstra + Scott Peterson + Adam Badura + Phil Davies + Bill Rosgen + Martin Brumm + Chris Shaffer + Brett Lentz All rights reserved by the respective owners of the original games (see the Game Notes per game for specific acknowledgements). -No challenge to their status is intended. + +No challenge to the original author's or publisher's rights, licensing, or status is intended. + Rails is intended as a play aid for owners of each respective boardgame. + +The Rails application and source code are distributed under +version 2 of the GNU Public License (GPL). + +A copy of the GPL should have been shipped with the game files and is also available here: + http://www.gnu.org/licenses/old-licenses/gpl-2.0.html </Credits> </GamesList> Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -17,6 +17,7 @@ import org.jgrapht.Graphs; import org.jgrapht.graph.SimpleGraph; +import rails.common.LocalText; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.PhaseI; @@ -24,7 +25,6 @@ import rails.game.TrainI; import rails.game.TrainType; import rails.ui.swing.hexmap.HexMap; -import rails.util.LocalText; public final class RevenueAdapter implements Runnable { Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -5,15 +5,15 @@ import org.apache.log4j.Logger; +import rails.common.parser.ConfigurationException; +import rails.common.parser.Tag; import rails.game.ConfigurableComponentI; -import rails.game.ConfigurationException; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.PhaseI; import rails.game.PhaseManager; import rails.game.TrainManager; import rails.game.TrainType; -import rails.util.Tag; /** * defines a template for a revenue bonus at creation time of rails objects Modified: trunk/18xx/rails/algorithms/RevenueManager.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueManager.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueManager.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -7,12 +7,12 @@ import org.apache.log4j.Logger; +import rails.common.LocalText; +import rails.common.parser.ConfigurationException; +import rails.common.parser.Tag; import rails.game.ConfigurableComponentI; -import rails.game.ConfigurationException; import rails.game.GameManagerI; import rails.game.state.ArrayListState; -import rails.util.LocalText; -import rails.util.Tag; /** * Coordinates and stores all elements related to revenue calulcation, Modified: trunk/18xx/rails/algorithms/RevenueTrainRun.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -12,8 +12,8 @@ import rails.algorithms.NetworkVertex.StationType; import rails.algorithms.NetworkVertex.VertexType; +import rails.common.LocalText; import rails.ui.swing.hexmap.HexMap; -import rails.util.LocalText; /** * Links the results from the revenue calculator to the rails program Copied: trunk/18xx/rails/common/LocalText.java (from rev 1597, trunk/18xx/rails/util/LocalText.java) =================================================================== --- trunk/18xx/rails/common/LocalText.java (rev 0) +++ trunk/18xx/rails/common/LocalText.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,153 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/LocalText.java,v 1.7 2010/03/23 18:45:16 stefanfrey Exp $*/ +package rails.common; + +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import rails.common.parser.Config; +import rails.util.Util; + +public class LocalText extends ResourceBundle { + + private static final String TEST_LOCALE = "te_ST"; + + protected static String language = "en"; + + protected static String country = ""; + + protected static String localeCode = language; + + protected static Locale locale; + + protected static ResourceBundle localisedText; + + protected static Logger log = + Logger.getLogger(LocalText.class.getPackage().getName()); + + public static String getText(String key) { + return getText(key, (Object[]) null); + } + + public static String getText(String key, Object parameter) { + return getText(key, new Object[] { parameter }); + } + + public static String getText(String key, Object... parameters) { + /* If the text is not found, return the key in brackets */ + return getTextExecute(key, "<" + key + ">", true, parameters); + } + + public static String getTextWithDefault(String key, String defaultText) { + return getTextExecute(key, defaultText, false, (Object[]) null); + } + + // actual procedure to retrieve the local text + private static String getTextExecute(String key, String defaultText, boolean errorOnMissing, Object... parameters) { + String result = ""; + + if (key == null || key.length() == 0) return ""; + + /* Load the texts */ + if (localisedText == null) { + /* + * Check what locale has been configured, if any. If not, we use the + * default assigned above. + */ + String item; + if (Util.hasValue(item = Config.get("language"))) { + language = item.toLowerCase(); + } + if (Util.hasValue(item = Config.get("country"))) { + country = item.toUpperCase(); + localeCode = language + "_" + country; + } + if (Util.hasValue(item = Config.get("locale"))) { + localeCode = item; + if (localeCode.length() >= 2) + language = localeCode.substring(0, 2); + if (localeCode.length() >= 5) + country = localeCode.substring(3, 5); + } + log.debug("Language=" + language + ", country=" + country + + ", locale=" + localeCode); + + /* Create the locale and get the resource bundle. */ + locale = new Locale(language, country); + + try { + localisedText = + ResourceBundle.getBundle("LocalisedText", locale); + } catch (MissingResourceException e) { + System.err.println("Unable to locate LocalisedText resource: " + + e); + } + } + + /* If the key contains a space, something is wrong, check who did that! */ + if (key.indexOf(" ") > -1) { + try { + throw new Exception("Invalid resource key '" + key + "'"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // special treatment for test locale + if (localeCode.equals(TEST_LOCALE)) { + StringBuffer s = new StringBuffer(key); + if (parameters != null) + for (Object o:parameters) + s.append("," + o.toString()); + return s.toString(); + } + + /* Find the text */ + try { + result = localisedText.getString(key); + } catch (Exception e) { + if (errorOnMissing) { + System.out.println("Missing text for key " + key + " in locale " + + locale.getDisplayName() + " (" + localeCode + + ")"); + } + return defaultText; + } + + if (parameters != null) { + result = MessageFormat.format(result, parameters); + } + + return result; + + } + + public static void setLocale(String localeCode) { + + LocalText.localeCode = localeCode; + String[] codes = localeCode.split("_"); + if (codes.length > 0) language = codes[0]; + if (codes.length > 1) country = codes[1]; + + // reset localised text + localisedText = null; + } + + public Enumeration<String> getKeys() { + // TODO Auto-generated method stub + return null; + } + + public Locale getLocale() { + return locale; + } + + protected Object handleGetObject(String arg0) { + // TODO Auto-generated method stub + return null; + } +} Copied: trunk/18xx/rails/common/MoneyFormatter.java (from rev 1597, trunk/18xx/rails/util/Format.java) =================================================================== --- trunk/18xx/rails/common/MoneyFormatter.java (rev 0) +++ trunk/18xx/rails/common/MoneyFormatter.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,30 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/Format.java,v 1.3 2008/06/04 19:00:39 evos Exp $*/ +package rails.common; + +import rails.common.parser.Config; +import rails.util.Util; + +public class MoneyFormatter { + + private static final String DEFAULT_MONEY_FORMAT = "$@"; + private static String moneyFormat = null; + static { + String configFormat = Config.get("money_format"); + if (Util.hasValue(configFormat) && configFormat.matches(".*@.*")) { + moneyFormat = configFormat; + } + } + + /* This class is never instantiated */ + private MoneyFormatter() {} + + public static String money(int amount) { + if (moneyFormat == null) moneyFormat = DEFAULT_MONEY_FORMAT; + return moneyFormat.replaceFirst("@", String.valueOf(amount)); + } + + public static void setMoneyFormat(String format) { + moneyFormat = format; + } + +} Copied: trunk/18xx/rails/common/ResourceLoader.java (from rev 1597, trunk/18xx/rails/util/ResourceLoader.java) =================================================================== --- trunk/18xx/rails/common/ResourceLoader.java (rev 0) +++ trunk/18xx/rails/common/ResourceLoader.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,581 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $*/ +package rails.common; + +import java.awt.Font; +import java.io.*; +import java.lang.reflect.Constructor; +import java.net.Socket; +import java.util.*; + +import javax.swing.text.*; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; + +import org.apache.log4j.Logger; + +/** + * Class ResourceLoader is an utility class to load a resource from a filename + * and a list of directory. + * + * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $ + * @author Romain Dolbeau + * @author David Ripton + */ + +public final class ResourceLoader { + + /** + * Class ColossusClassLoader allows for class loading outside the CLASSPATH, + * i.e. from the various variant directories. + * + * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $ + * @author Romain Dolbeau + */ + private static class RailsClassLoader extends ClassLoader { + List<String> directories = null; + + protected static Logger log = + Logger.getLogger(RailsClassLoader.class.getPackage().getName()); + + RailsClassLoader(ClassLoader parent) { + super(parent); + } + + RailsClassLoader() { + super(); + } + + @Override + public Class<?> findClass(String className) + throws ClassNotFoundException { + try { + int index = className.lastIndexOf("."); + String shortClassName = className.substring(index + 1); + if (index == -1) { + log.error("Loading of class \"" + className + + "\" failed (no dot in class name)"); + return null; + } + InputStream classDataIS = + getInputStream(shortClassName + ".class", directories); + if (classDataIS == null) { + log.error("Couldn't find the class file anywhere ! (" + + shortClassName + ".class)"); + throw new FileNotFoundException("missing " + shortClassName + + ".class"); + } + byte[] classDataBytes = new byte[classDataIS.available()]; + classDataIS.read(classDataBytes); + return defineClass(className, classDataBytes, 0, + classDataBytes.length); + } catch (Exception e) { + return super.findClass(className); + } + } + + void setDirectories(List<String> d) { + directories = d; + } + } + + public static final String keyContentType = "ResourceLoaderContentType"; + public static final String defaultFontName = "Lucida Sans Bold"; + public static final int defaultFontStyle = Font.PLAIN; + public static final int defaultFontSize = 12; + public static final Font defaultFont = + new Font(defaultFontName, defaultFontStyle, defaultFontSize); + + // File.separator does not work in jar files, except in Unix. + // A hardcoded '/' works in Unix, Windows, MacOS X, and jar files. + private static final String pathSeparator = "/"; + private static final ClassLoader baseCL = + rails.common.ResourceLoader.class.getClassLoader(); + private static final RailsClassLoader cl = new RailsClassLoader(baseCL); + + private static final Map<String, Object> fileCache = + Collections.synchronizedMap(new HashMap<String, Object>()); + + private final static String sep = "~"; + + protected static Logger log = + Logger.getLogger(ResourceLoader.class.getPackage().getName()); + + private static String server = null; + private static int serverPort = 0; + + public static void setDataServer(String server, int port) { + ResourceLoader.server = server; + ResourceLoader.serverPort = port; + } + + /** + * Give the String to mark directories. + * + * @return The String to mark directories. + */ + public static String getPathSeparator() { + return pathSeparator; + } + + /** empty the cache so that all files have to be reloaded */ + public synchronized static void purgeFileCache() { + log.debug("Purging File Cache."); + fileCache.clear(); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories, tell the getInputStream not to complain if not found. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStreamIgnoreFail(String filename, + List<String> directories) { + return getInputStream(filename, directories, server != null, false, + true); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStream(String filename, List<String> directories) { + return getInputStream(filename, directories, server != null, false, + false); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @param remote Ask the server for the stream. + * @param cachedOnly Only look in the cache file, do not try to load the + * file from permanent storage. + * @param ignoreFail (=don't complain) if file not found + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStream(String filename, List<String> directories, + boolean remote, boolean cachedOnly, boolean ignoreFail) { + String mapKey = getMapKey(filename, directories); + Object cached = fileCache.get(mapKey); + byte[] data = null; + + if ((cached == null) && cachedOnly) { + if (!ignoreFail) { + log.warn("Requested file " + filename + + " is requested cached-only but is not is cache."); + } + return null; + } + + if ((cached == null) && ((!remote) || (server == null))) { + synchronized (fileCache) { + InputStream stream = null; + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext() && (stream == null)) { + Object o = it.next(); + if (o instanceof String) { + String path = (String) o; + String fullPath = + path + pathSeparator + fixFilename(filename); + + log.debug("Trying to locate InputStream: " + path + + pathSeparator + filename); + try { + File tempFile = new File(fullPath); + stream = new FileInputStream(tempFile); + } catch (Exception e) { + stream = cl.getResourceAsStream(fullPath); + } + } + } + if (stream == null) { + if (!remote && ignoreFail) { + // If someone locally requests it as ignoreFail, + // let's assume a remote requester later sees it the + // same way. + // Right now, the remote-requesting is not able to + // submit the "ignore-fail" property... + // @TODO: submit that properly? + // fileCacheIgnoreFail.put(mapKey, new Boolean(true)); + } + if (!ignoreFail) { + log.warn("getInputStream:: " + + " Couldn't get InputStream for file " + + filename + " in " + directories + + (cachedOnly ? " (cached only)" : "")); + // @TODO this sounds more serious than just a warning in + // the logs + // Anyway now at least MarkersLoader does not complain + // any more... + } + } else { + data = getBytesFromInputStream(stream); + fileCache.put(mapKey, data); + } + } + } else { + synchronized (fileCache) { + if (cached != null) { + data = (byte[]) cached; + } else { + try { + Socket fileSocket = new Socket(server, serverPort); + InputStream is = fileSocket.getInputStream(); + + if (is == null) { + log.warn("getInputStream:: " + + " Couldn't get InputStream from socket" + + " for file " + filename + " in " + + directories + + (cachedOnly ? " (cached only)" : "")); + // @TODO this sounds more serious than just a + // warning in the logs + } else { + PrintWriter out = + new PrintWriter( + fileSocket.getOutputStream(), true); + + if (ignoreFail) { + // Not in this version yet (05/2007). + // New clients could not talk with old server. + // Take this into full use somewhat later. + // out.print( + // Constants.fileServerIgnoreFailSignal + sep); + } + out.print(filename); + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext()) { + out.print(sep + it.next()); + } + out.println(); + data = getBytesFromInputStream(is); + if (data != null && data.length == 0 && !ignoreFail) { + log.warn("Got empty contents for file " + + filename + " directories " + + directories.toString()); + } + fileSocket.close(); + fileCache.put(mapKey, data); + } + } catch (Exception e) { + log.error("ResourceLoader::getInputStream() : " + e); + } + } + + } + } + return (data == null ? null : getInputStreamFromBytes(data)); + } + + /** + * Return the content of the specified file as an array of byte. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @param cachedOnly Only look in the cache file, do not try to load the + * file from permanent storage. + * @return An array of byte representing the content of the file, or null if + * it fails. + */ + public static byte[] getBytesFromFile(String filename, List<String> directories, + boolean cachedOnly, boolean ignoreFail) { + InputStream is = + getInputStream(filename, directories, server != null, + cachedOnly, ignoreFail); + if (is == null) { + // right now only FileServerThread is using this method at all. + if (!ignoreFail) { + log.warn("getBytesFromFile:: " + + " Couldn't get InputStream for file " + filename + + " in " + directories + + (cachedOnly ? " (cached only)" : "")); + } + return null; + } + return getBytesFromInputStream(is); + } + + /** + * Return the content of the specified InputStream as an array of byte. + * + * @param InputStream The InputStream to use. + * @return An array of byte representing the content of the InputStream, or + * null if it fails. + */ + private static byte[] getBytesFromInputStream(InputStream is) { + byte[] all = new byte[0]; + + try { + byte[] data = new byte[1024 * 64]; + int r = is.read(data); + while (r > 0) { + byte[] temp = new byte[all.length + r]; + for (int i = 0; i < all.length; i++) { + temp[i] = all[i]; + } + for (int i = 0; i < r; i++) { + temp[i + all.length] = data[i]; + } + all = temp; + r = is.read(data); + } + } catch (Exception e) { + log.error("Can't Stringify stream " + is + " (" + e + ")"); + } + return all; + } + + /** + * Return the content of the specified byte array as an InputStream. + * + * @param data The byte array to convert. + * @return An InputStream whose content is the data byte array. + */ + private static InputStream getInputStreamFromBytes(byte[] data) { + if (data == null) { + log.warn("getInputStreamFromBytes:: " + + " Can't create InputStream from null byte array"); + return null; + } + return new ByteArrayInputStream(data); + } + + /** + * Return the first OutputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The OutputStream, or null if it was not found. + */ + public static OutputStream getOutputStream(String filename, List<String> directories) { + OutputStream stream = null; + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext() && (stream == null)) { + Object o = it.next(); + if (o instanceof String) { + String path = (String) o; + String fullPath = path + pathSeparator + fixFilename(filename); + try { + stream = new FileOutputStream(fullPath); + } catch (Exception e) { + log.debug("getOutputStream:: " + + " Couldn't get OutputStream for file " + + filename + " in " + directories + "(" + + e.getMessage() + ")"); + } + } + } + return (stream); + } + + /** + * Return the first Document from file of name filename in the list of + * directories. It also add a property of key keyContentType and of type + * String describing the content type of the Document. This can currently + * load HTML and pure text. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The Document, or null if it was not found. + */ + public static Document getDocument(String filename, List<String> directories) { + InputStream htmlIS = + getInputStreamIgnoreFail(filename + ".html", directories); + if (htmlIS != null) { + try { + HTMLEditorKit htedk = new HTMLEditorKit(); + HTMLDocument htdoc = new HTMLDocument(htedk.getStyleSheet()); + htdoc.putProperty(keyContentType, "text/html"); + htedk.read(htmlIS, htdoc, 0); + return htdoc; + } catch (Exception e) { + log.error("html document exists, but cannot be loaded (" + + filename + "): " + e); + } + return null; + } + InputStream textIS = + getInputStreamIgnoreFail(filename + ".txt", directories); + if (textIS == null) { + textIS = getInputStreamIgnoreFail(filename, directories); + } + if (textIS != null) { + try { + // Must be a StyledDocument not a PlainDocument for + // JEditorPane.setDocument() + StyledDocument txtdoc = new DefaultStyledDocument(); + char[] buffer = new char[128]; + InputStreamReader textISR = new InputStreamReader(textIS); + int read = 0; + int offset = 0; + while (read != -1) { + read = textISR.read(buffer, 0, 128); + if (read != -1) { + txtdoc.insertString(offset, + new String(buffer, 0, read), null); + offset += read; + } + } + txtdoc.putProperty(keyContentType, "text/plain"); + return txtdoc; + } catch (Exception e) { + log.error("text document exists, but cannot be loaded (" + + filename + "): " + e); + } + return null; + } + log.error("No document for basename " + filename + " found " + + "(neither .html, .txt nor without extention)!"); + return null; + } + + /** + * Return the key to use in the image and file caches. + * + * @param filename Name of the file. + * @param directories List of directories. + * @return A String to use as a key when storing/loading in a cache the + * specified file from the specified list of directories. + */ + private static String getMapKey(String filename, List<String> directories) { + String[] filenames = new String[1]; + filenames[0] = filename; + return getMapKey(filenames, directories); + } + + /** + * Return the key to use in the image cache. + * + * @param filenames Array of name of files. + * @param directories List of directories. + * @return A String to use as a key when storing/loading in a cache the + * specified array of name of files from the specified list of directories. + */ + private static String getMapKey(String[] filenames, List<String> directories) { + StringBuffer buf = new StringBuffer(filenames[0]); + for (int i = 1; i < filenames.length; i++) { + buf.append(","); + buf.append(filenames[i]); + } + Iterator<String> it = directories.iterator(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof String) { + buf.append(","); + buf.append(o); + } + } + return buf.toString(); + } + + /** + * Fix a filename by replacing space with underscore. + * + * @param filename Filename to fix. + * @return The fixed filename. + */ + private static String fixFilename(String filename) { + return filename.replace(' ', '_'); + } + + /** + * Create an instance of the class whose name is in parameter. + * + * @param className The name of the class to use. + * @param directories List of directories to search (in order). + * @return A new object, instance from the given class. + */ + public static Object getNewObject(String className, List<String> directories) { + return getNewObject(className, directories, null); + } + + /** + * Create an instance of the class whose name is in parameter, using + * parameters. + * + * If no parameters are given, the default constructor is used. + * + * @TODO this is full of catch(Exception) blocks, which all return null. + * Esp. returning null seems a rather bad idea, since it will most likely + * turn out to be NPEs somewhere later. + * + * @param className The name of the class to use, must not be null. + * @param directories List of directories to search (in order), must not be + * null. + * @param parameter Array of parameters to pass to the constructor, can be + * null. + * @return A new object, instance from the given class or null if + * instantiation failed. + */ + public static Object getNewObject(String className, List<String> directories, + Object[] parameter) { + Class<?> theClass = null; + cl.setDirectories(directories); + try { + theClass = cl.loadClass(className); + } catch (Exception e) { + log.error("Loading of class \"" + className + "\" failed (" + e + + ")"); + return null; + } + if (parameter != null) { + Class<?>[] paramClasses = new Class[parameter.length]; + for (int i = 0; i < parameter.length; i++) { + paramClasses[i] = parameter[i].getClass(); + } + try { + Constructor<?> c = theClass.getConstructor(paramClasses); + return c.newInstance(parameter); + } catch (Exception e) { + log.error("Loading or instantiating class' constructor for \"" + + className + "\" failed (" + e + ")"); + return null; + } + } else { + try { + return theClass.newInstance(); + } catch (Exception e) { + log.error("Instantiating \"" + className + "\" failed (" + e + + ")"); + return null; + } + } + } + + /** + * Force adding the given data as belonging to the given filename in the + * file cache. + * + * @param filename Name of the Image file to add. + * @param directories List of directories to search (in order). + * @param data File content to add. + */ + public static void putIntoFileCache(String filename, List<String> directories, + byte[] data) { + String mapKey = getMapKey(filename, directories); + fileCache.put(mapKey, data); + } + + /** + * Force adding the given data as belonging to the given key in the file + * cache. + * + * @see #getMapKey(String, List) + * @see #getMapKey(String[], List) + * @param mapKey Key to use in the cache. + * @param data File content to add. + */ + public static void putIntoFileCache(String mapKey, byte[] data) { + fileCache.put(mapKey, data); + } +} Copied: trunk/18xx/rails/common/parser/Config.java (from rev 1597, trunk/18xx/rails/util/Config.java) =================================================================== --- trunk/18xx/rails/common/parser/Config.java (rev 0) +++ trunk/18xx/rails/common/parser/Config.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,584 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/Config.java,v 1.13 2010/06/24 21:48:08 stefanfrey Exp $*/ +package rails.common.parser; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.log4j.Logger; + +import rails.game.GameManager; +import rails.util.Util; + +/** + * This is a simple utility class with a collection of static functions to load + * a property object from a property file, to retrieve a particular value from + * the property file etc. + * + * @author Ramiah Bala, + * @author Erik Vos + * @author Stefan Frey + * @version 2.0 + */ +public final class Config { + + protected static Logger log; + + /** Commandline options */ + private static final String CONFIGFILE_CMDLINE = "configfile"; + private static final String PROFILE_CMDLINE = "profile"; + + /** XML setup */ + private static final String CONFIG_XML_DIR = "data"; + private static final String CONFIG_XML_FILE = "Properties.xml"; + private static final String CONFIG_TAG = "Properties"; + private static final String SECTION_TAG = "Section"; + private static final String ITEM_TAG = "Property"; + + /** Log 4j configuration */ + private static final String LOG4J_CONFIG_FILE = "log4j.properties"; + + /** Rails profile configurations */ + private static String defaultProfilesFile = "data/profiles/default.profiles"; + private static Properties defaultProfiles = new Properties(); + private static String userProfilesFile = "user.profiles"; + private static Properties userProfiles = new Properties(); + private static boolean profilesLoaded = false; + private static String DEFAULT_PROFILE_SELECTION = "default"; // can be overwritten + private static final String TEST_PROFILE_SELECTION = ".test"; // used as default profile for integration tests + private static final String STANDARD_PROFILE_SELECTION = "user"; + private static final String DEFAULTPROFILE_PROPERTY = "default.profile"; + private static final String PROFILENAME_PROPERTY = "profile.name"; + + /** selected profile */ + private static String selectedProfile; + private static boolean legacyConfigFile; + + /** properties storage. */ + private static Properties defaultProperties = new Properties(); + private static Properties userProperties = new Properties(); + private static boolean propertiesLoaded = false; + + /** Map that holds the panel, which contains config items */ + private static Map<String, List<ConfigItem>> configSections = null; + + /** + * Hidden constructor, the class is never instantiated, everything is static + */ + private Config() {} + + /** + * Reads the config.xml file that defines all config items + */ + public static void readConfigSetupXML() { + List<String> directories = new ArrayList<String>(); + directories.add(CONFIG_XML_DIR); + try { + // Find the config tag inside the the config xml file + Tag configTag = + Tag.findTopTagInFile(CONFIG_XML_FILE, directories, CONFIG_TAG); + log.debug("Opened config xml, filename = " + CONFIG_XML_FILE); + + // define sections + configSections = new LinkedHashMap<String, List<ConfigItem>>(); + + // find sections + List<Tag> sectionTags = configTag.getChildren(SECTION_TAG); + if (sectionTags != null) { + for (Tag sectionTag:sectionTags) { + // find name attribute + String sectionName = sectionTag.getAttributeAsString("name"); + if (!Util.hasValue(sectionName)) continue; + + // find items + List<Tag> itemTags = sectionTag.getChildren(ITEM_TAG); + if (itemTags == null || itemTags.size() == 0) continue; + List<ConfigItem> sectionItems = new ArrayList<ConfigItem>(); + for (Tag itemTag:itemTags) { + sectionItems.add(new ConfigItem(itemTag)); + } + configSections.put(sectionName, sectionItems); + } + } + + } catch (ConfigurationException e) { + log.error("Configuration error in setup of " + CONFIG_XML_FILE + ", exception = " + e); + } + } + + public static Map<String, List<ConfigItem>> getConfigSections() { + if (configSections == null) { + readConfigSetupXML(); + } + log.debug("Configuration setup = " + configSections); + return configSections; + } + + public static int getMaxElementsInPanels() { + int maxElements = 0; + for (List<ConfigItem> panel:configSections.values()) { + maxElements = Math.max(maxElements, panel.size()); + } + log.debug("Configuration sections with maximum elements of " + maxElements); + return maxElements; + } + + /** + * updates the profile according to the changes in configitems + */ + public static void updateProfile(boolean applyInitMethods) { + for (List<ConfigItem> items:configSections.values()) { + for (ConfigItem item:items) { + if (!item.hasNewValue()) continue; + if (item.getNewValue().equals(defaultProperties.get(item.name))) { + userProperties.remove(item.name); + continue; + } + userProperties.setProperty(item.name, item.getNewValue()); + if (applyInitMethods) item.callInitMethod(); + log.debug("Changed property name = " + item.name + " to value = " + item.getNewValue()); + item.setNewValue(null); + } + } + } + + /** + * reverts all changes in configitems + */ + public static void revertProfile() { + for (List<ConfigItem> items:configSections.values()) { + for (ConfigItem item:items) { + item.setNewValue(null); + } + } + } + + /** + * First tries to return {key}.{gameName}, if undefined returns {key} + */ + public static String getGameSpecific(String key) { + return Config.getSpecific(key, GameManager.getInstance().getGameName()); + } + + /** + * First tries to return {key}.{appendix}, if undefined returns {key} + */ + public static String getSpecific(String key, String appendix) { + String value = Config.get(key + "." + appendix); + if (value == "") { + value = Config.get(key); + } + return value; + } + + public static String get(String key) { + return get(key, ""); + } + + public static String get(String key, String defaultValue) { + if (defaultProperties.isEmpty() || !propertiesLoaded) { + initialLoad(); + } + if (userProperties.containsKey(key)) return userProperties.getProperty(key).trim(); + if (defaultProperties.containsKey(key)) return defaultProperties.getProperty(key).trim(); + + return defaultValue; + } + + + /** + * save active Profile + */ + public static boolean saveActiveProfile() { + String filepath = userProfiles.getProperty(selectedProfile); + if (Util.hasValue(filepath)) { + return storePropertyFile(userProperties, filepath); + } else { + return false; + } + } + + /** + * change active Profile + */ + public static boolean changeActiveProfile(String profileName) { + readConfigSetupXML(); + loadProfile(profileName); + selectedProfile = profileName; + return true; + } + + /** + * create new profile + */ + public static boolean createUserProfile(String profileName, String defaultProfile) { + userProperties = new Properties(); + defaultProperties = new Properties(); + + // add to list of user profiles + userProfiles.setProperty(profileName, ""); + + // define and load default profile + String defaultConfigFile = defaultProfiles.getProperty(defaultProfile); + userProperties.setProperty(PROFILENAME_PROPERTY, profileName); + userProperties.setProperty(DEFAULTPROFILE_PROPERTY, defaultProfile); + loadPropertyFile(defaultProperties, defaultConfigFile, true); + setSaveDirDefaults(); + + selectedProfile = profileName; + return true; + } + + + private static Map<String, String> convertProperties(Properties properties, boolean visibleOnly) { + Map<String, String> converted = new HashMap<String, String>(); + for (Object key:properties.keySet()) { + if (visibleOnly && ((String)key).substring(0,1).equals(".")) continue; + converted.put((String) key, (String) properties.get(key)); + } + return converted; + } + + /** + * get all default profiles + */ + public static List<String> getDefaultProfiles(boolean visibleOnly) { + List<String> profiles = new ArrayList<String>(convertProperties(defaultProfiles, visibleOnly).keySet()); + Collections.sort(profiles); + return profiles; + } + + public static String getDefaultProfileSelection() { + return DEFAULT_PROFILE_SELECTION; + } + + /** + * get all user profiles + */ + public static List<String> getUserProfiles() { + List<String> profiles = new ArrayList<String>(convertProperties(userProfiles, true).keySet()); + Collections.sort(profiles); + return profiles; + } + + /** + * get all (visible default + user) profiles + */ + public static List<String> getAllProfiles() { + List<String> profiles = getDefaultProfiles(true); + profiles.addAll(getUserProfiles()); + return profiles; + } + + /** + * checks if profile is default profile + */ + public static boolean isDefaultProfile(String profileName) { + return !(defaultProfiles.get(profileName) == null); + } + + /** + * returns name of (active) default profile + */ + public static String getDefaultProfileName() { + return userProperties.getProperty(DEFAULTPROFILE_PROPERTY); + } + + /** + * returns name of active profile + */ + public static String getActiveProfileName() { + return selectedProfile; + } + + /** + * returns true if legacy configfile is used + */ + public static boolean isLegacyConfigFile() { + return legacyConfigFile; + } + + /** + * sets filename for an active profile (and store list of profiles) + * @return false if list of profiles cannot be stored + */ + public static boolean setActiveFilepath(String filepath) { + userProfiles.setProperty(selectedProfile, filepath); + return storePropertyFile(userProfiles, userProfilesFile); + } + + /** + * returns filename of active profile, (null if undefined or default profile) + */ + public static String getActiveFilepath() { + return userProfiles.getProperty(selectedProfile); + } + + /** + * @return if user location is defined + */ + public static boolean isFilePathDefined() { + return Util.hasValue(userProfiles.getProperty(selectedProfile)); + } + + + /** + * activates settings used for testing + */ + public static void setConfigTest() { + /* + * Set the system property that tells log4j to use this file. (Note: + * this MUST be done before updating Config) + */ + String log4jSelection = System.getProperty("log4j.configuration"); + if (!Util.hasValue(log4jSelection)) { + log4jSelection = LOG4J_CONFIG_FILE; + } + System.setProperty("log4j.configuration", log4jSelection); + System.out.println("log4j.configuration = " + log4jSelection); + + // delayed setting of logger + log = Logger.getLogger(Config.class.getPackage().getName()); + + // define settings for testing + legacyConfigFile = false; + DEFAULT_PROFILE_SELECTION = TEST_PROFILE_SELECTION; + selectedProfile = null; + + initialLoad(); + } + + + /** + * activates configuration settings based on default settings + */ + public static void setConfigSelection() { + /* + * Set the system property that tells log4j to use this file. (Note: + * this MUST be done before updating Config) + */ + String log4jSelection = System.getProperty("log4j.configuration"); + if (!Util.hasValue(log4jSelection)) { + log4jSelection = LOG4J_CONFIG_FILE; + } + System.setProperty("log4j.configuration", log4jSelection); + System.out.println("log4j.configuration = " + log4jSelection); + + // delayed setting of logger + log = Logger.getLogger(Config.class.getPackage().getName()); + + /* + * Check if the profile has been set from the command line + * to do this is adding an option to the java command: -Dprofile=<profile-name> + */ + String configSelection = System.getProperty(PROFILE_CMDLINE); + System.out.println("Cmdline profile selection = " + configSelection); + + legacyConfigFile = false; + if (configSelection == null) { + /* + * Check if the property file has been set on the command line. The way + * to do this is adding an option to the java command: -Dconfigfile=<property-filename> + * + * This is for legacy reasons only + */ + configSelection = System.getProperty(CONFIGFILE_CMDLINE); + + if (Util.hasValue(configSelection)) { + System.out.println("Cmdline configfile selection (legacy!) = " + configSelection); + legacyConfigFile = true; + } + } + + /* if nothing has selected so far, choose standardProfile */ + if (!Util.hasValue(configSelection)) { + configSelection = STANDARD_PROFILE_SELECTION; + } + + selectedProfile = configSelection; + if (!legacyConfigFile) { + System.out.println("Profile selection = " + selectedProfile); + } + + initialLoad(); + } + + + private static void initialLoad() { + if (legacyConfigFile) { + if (!propertiesLoaded) { + loadPropertyFile(defaultProperties, selectedProfile, false); + propertiesLoaded = true; + setSaveDirDefaults(); + } + return; + } + + if (!profilesLoaded) { + loadPropertyFile(defaultProfiles, defaultProfilesFile, true); + loadPropertyFile(userProfiles, userProfilesFile, false); + profilesLoaded = true; + } + + /* Tell the properties loader to read this file. */ + log.info("Selected profile = " + selectedProfile); + + if (!propertiesLoaded) { + loadProfile(selectedProfile); + propertiesLoaded = true; + } + } + + + /** + * loads an external user profile + * defined by the filepath + */ + public static boolean loadProfileFromFile(File file) { + String filepath = file.getPath(); + if (loadPropertyFile(userProperties, filepath, false)) { + String profile = userProperties.getProperty(PROFILENAME_PROPERTY); + if (!Util.hasValue(profile)) { + profile = STANDARD_PROFILE_SELECTION; + } + selectedProfile = profile; + setActiveFilepath(filepath); // do not set filepath on import + loadDefaultProfile(); + setSaveDirDefaults(); + return true; + } else { + return false; + } + } + + /** + * imports an external user profile into an existing profile + * defined by the filepath + */ + public static boolean importProfileFromFile(File file) { + String filepath = file.getPath(); + Properties importProperties = new Properties(); + if (loadPropertyFile(importProperties, filepath, false)) { + userProperties.putAll(importProperties); + setSaveDirDefaults(); + return true; + } else { + return false; + } + } + + + /** + * loads a user profile + * if not defined or loadable, creates a default user profile + */ + private static void loadProfile(String userProfile) { + // reset properties + userProperties = new Properties(); + defaultProperties = new Properties(); + + String userConfigFile = null; + if (Util.hasValue(userProfile)) { + // check if the profile is already defined under userProfiles + userConfigFile = userProfiles.getProperty(userProfile); + if (Util.hasValue(userConfigFile) && // load user profile + loadPropertyFile(userProperties, userConfigFile, fa... [truncated message content] |
From: <wak...@us...> - 2011-06-30 18:56:06
|
Revision: 1597 http://rails.svn.sourceforge.net/rails/?rev=1597&view=rev Author: wakko666 Date: 2011-06-30 18:56:00 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Commit Erik's changes, try #2. Modified Paths: -------------- trunk/18xx/rails/game/OperatingRound.java Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2011-06-30 18:27:52 UTC (rev 1596) +++ trunk/18xx/rails/game/OperatingRound.java 2011-06-30 18:56:00 UTC (rev 1597) @@ -33,19 +33,12 @@ protected ArrayListState<PublicCompanyI> operatingCompanies; - //protected IntegerState operatingCompanyIndexObject; - protected GenericState<PublicCompanyI> operatingCompany; // do not use a operatingCompany.getObject() as reference - // protected PublicCompanyI operatingCompany.getObject() = null; // Non-persistent lists (are recreated after each user action) protected List<SpecialPropertyI> currentSpecialProperties = null; - //protected List<LayTile> currentSpecialTileLays = new ArrayList<LayTile>(); - - //protected List<LayTile> currentNormalTileLays = new ArrayList<LayTile>(); - protected HashMapState<String, Integer> tileLaysPerColour = new HashMapState<String, Integer>("tileLaysPerColour"); @@ -241,6 +234,11 @@ } else if (selectedAction instanceof ClosePrivate) { result = executeClosePrivate((ClosePrivate)selectedAction); + + } else if (selectedAction instanceof UseSpecialProperty + && ((UseSpecialProperty)selectedAction).getSpecialProperty() instanceof SpecialRight) { + + result = buyRight ((UseSpecialProperty)selectedAction); } else if (selectedAction instanceof NullAction) { @@ -1207,7 +1205,7 @@ /** Take the next step after a given one (see nextStep()) */ protected void nextStep(GameDef.OrStep step) { - PublicCompanyI company = operatingCompany.get(); + PublicCompanyI company = operatingCompany.get(); // Cycle through the steps until we reach one where a user action is // expected. @@ -1257,24 +1255,24 @@ int poolShare = pool.getShare(company); // Expensive, do it once // Can it buy? boolean canBuy = - ownShare < getGameParameterAsInt (GameDef.Parm.TREASURY_SHARE_LIMIT) - && company.getCash() >= company.getCurrentSpace().getPrice() - && poolShare > 0; + ownShare < getGameParameterAsInt (GameDef.Parm.TREASURY_SHARE_LIMIT) + && company.getCash() >= company.getCurrentSpace().getPrice() + && poolShare > 0; // Can it sell? boolean canSell = - company.getPortfolio().getShare(company) > 0 - && poolShare < getGameParameterAsInt (GameDef.Parm.POOL_SHARE_LIMIT); + company.getPortfolio().getShare(company) > 0 + && poolShare < getGameParameterAsInt (GameDef.Parm.POOL_SHARE_LIMIT); // Above we ignore the possible existence of double shares (as in 1835). if (!canBuy && !canSell) { // XXX For BACKWARDS COMPATIBILITY only, - // register a Done skip action during reloading. - if (gameManager.isReloading()) { - gameManager.setSkipDone(GameDef.OrStep.TRADE_SHARES); + // register a Done skip action during reloading. + if (gameManager.isReloading()) { + gameManager.setSkipDone(GameDef.OrStep.TRADE_SHARES); log.debug("If the next saved action is 'Done', skip it"); - } - log.info("Skipping Treasury share trading step"); - continue; + } + log.info("Skipping Treasury share trading step"); + continue; } gameManager.startTreasuryShareTradingRound(); @@ -1613,8 +1611,8 @@ company = newOperatingCompanies.get(i); if (company != operatingCompanies.get(i)) { log.debug("Company "+company.getName() - +" replaces "+operatingCompanies.get(i).getName() - +" in operating sequence"); + +" replaces "+operatingCompanies.get(i).getName() + +" in operating sequence"); operatingCompanies.move(company, i); } } @@ -2305,6 +2303,44 @@ return numberOfLoans * operatingCompany.get().getValuePerLoan(); } + protected boolean buyRight (UseSpecialProperty action) { + + String errMsg = null; + + SpecialPropertyI sp = action.getSpecialProperty(); + if (!(sp instanceof SpecialRight)) { + errMsg = "Wrong right property class: "+sp.toString(); + } + + SpecialRight right = (SpecialRight) sp; + String rightName = right.getName(); + String rightValue = right.getValue(); + + if (errMsg != null) { + DisplayBuffer.add(LocalText.getText("CannotBuyRight", + action.getCompanyName(), + rightName, + Bank.format(right.getCost()), + errMsg)); + + return false; + } + + moveStack.start(true); + + operatingCompany.get().setRight(rightName, rightValue); + new CashMove (operatingCompany.get(), bank, right.getCost()); + + ReportBuffer.add(LocalText.getText("BuysRight", + operatingCompany.get().getName(), + rightName, + Bank.format(right.getCost()))); + + sp.setExercised(); + + return true; + } + /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ /** @@ -2486,10 +2522,13 @@ // Are there other step-independent special properties owned by the company? List<SpecialPropertyI> orsps = operatingCompany.get().getPortfolio().getAllSpecialProperties(); + List<SpecialPropertyI> compsps = operatingCompany.get().getSpecialProperties(); + if (compsps != null) orsps.addAll(compsps); + if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByCompany() - && sp.isUsableDuringOR()) { + && sp.isUsableDuringOR(step)) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); @@ -2505,7 +2544,7 @@ if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByPlayer() - && sp.isUsableDuringOR()) { + && sp.isUsableDuringOR(step)) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2011-06-30 18:27:58
|
Revision: 1596 http://rails.svn.sourceforge.net/rails/?rev=1596&view=rev Author: wakko666 Date: 2011-06-30 18:27:52 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Commit Erik's changes to OperatingRound. Modified Paths: -------------- trunk/18xx/rails/game/OperatingRound.java Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2011-06-30 15:19:12 UTC (rev 1595) +++ trunk/18xx/rails/game/OperatingRound.java 2011-06-30 18:27:52 UTC (rev 1596) @@ -241,11 +241,6 @@ } else if (selectedAction instanceof ClosePrivate) { result = executeClosePrivate((ClosePrivate)selectedAction); - - } else if (selectedAction instanceof UseSpecialProperty - && ((UseSpecialProperty)selectedAction).getSpecialProperty() instanceof SpecialRight) { - - result = buyRight ((UseSpecialProperty)selectedAction); } else if (selectedAction instanceof NullAction) { @@ -2310,44 +2305,6 @@ return numberOfLoans * operatingCompany.get().getValuePerLoan(); } - protected boolean buyRight (UseSpecialProperty action) { - - String errMsg = null; - - SpecialPropertyI sp = action.getSpecialProperty(); - if (!(sp instanceof SpecialRight)) { - errMsg = "Wrong right property class: "+sp.toString(); - } - - SpecialRight right = (SpecialRight) sp; - String rightName = right.getName(); - String rightValue = right.getValue(); - - if (errMsg != null) { - DisplayBuffer.add(LocalText.getText("CannotBuyRight", - action.getCompanyName(), - rightName, - Bank.format(right.getCost()), - errMsg)); - - return false; - } - - moveStack.start(true); - - operatingCompany.get().setRight(rightName, rightValue); - new CashMove (operatingCompany.get(), bank, right.getCost()); - - ReportBuffer.add(LocalText.getText("BuysRight", - operatingCompany.get().getName(), - rightName, - Bank.format(right.getCost()))); - - sp.setExercised(); - - return true; - } - /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ /** @@ -2529,13 +2486,10 @@ // Are there other step-independent special properties owned by the company? List<SpecialPropertyI> orsps = operatingCompany.get().getPortfolio().getAllSpecialProperties(); - List<SpecialPropertyI> compsps = operatingCompany.get().getSpecialProperties(); - if (compsps != null) orsps.addAll(compsps); - if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByCompany() - && sp.isUsableDuringOR(step)) { + && sp.isUsableDuringOR()) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); @@ -2551,7 +2505,7 @@ if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByPlayer() - && sp.isUsableDuringOR(step)) { + && sp.isUsableDuringOR()) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-30 15:19:19
|
Revision: 1595 http://rails.svn.sourceforge.net/rails/?rev=1595&view=rev Author: evos Date: 2011-06-30 15:19:12 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Implemented 1830 Coalfields right buying option. It is implemented using a new generic "rights" object. Each company can have a separate set of rights. To make this work, public company initialization had to be refactored. 'Dummy' companies per type are no longer needed. New 'Rights' columns have been added to the OR and GameStatus windows if needed. 'Coalfields' is shown for each company that has that right. Caveat: Undoing a Coalfields right by action does not reset the UI. This cannot be implemented in the usual way as long HashMapState does not extend ModelObject. Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/data/1830/CompanyManager.xml trunk/18xx/rails/common/GuiDef.java trunk/18xx/rails/game/CompanyManager.java trunk/18xx/rails/game/CompanyType.java trunk/18xx/rails/game/CompanyTypeI.java trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/game/GameManagerI.java trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/PublicCompany.java trunk/18xx/rails/game/PublicCompanyI.java trunk/18xx/rails/game/special/SpecialProperty.java trunk/18xx/rails/game/special/SpecialPropertyI.java trunk/18xx/rails/game/state/HashMapState.java trunk/18xx/rails/ui/swing/GameStatus.java trunk/18xx/rails/ui/swing/ORPanel.java trunk/18xx/rails/util/ListAndFixSavedFiles.java Added Paths: ----------- trunk/18xx/rails/game/model/RightsModel.java trunk/18xx/rails/game/special/SpecialRight.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/LocalisedText.properties 2011-06-30 15:19:12 UTC (rev 1595) @@ -40,6 +40,7 @@ BUY_WHICH_TRAIN=Buy which train? # Note: in the next item, {0} MUST be in front BuyPrivatePrompt={0} from {1} for {2} +BuyRight=Buy {0} right for {1} BankIsBrokenDisplayText=Bank is broken. Play continues until {0} BankIsBrokenReportText=Bank is broken gameOverPlaySetOfORs=the current set of operating rounds is finished. @@ -56,6 +57,7 @@ BuysBonusTokenFrom={0} buys a {1} +{2} bonus token from {3} for {4} BuysItemFor={0} buys {1} for {2} BuysPrivateFromFor={0} buys private {1} from {2} for {3} +BuysRight={0} buys the ''{1}'' right for {2} BuysTrain={0} buys a {1}-train from {2} for {3}. BuysTrainUsingSP={0} buys a {1}-train from {2} for {3} using {4}. BYFloatsAt=Bayern floats at @@ -64,6 +66,7 @@ CanOperate={0} can operate this round CannotOperate={0} cannot operate this round CannotBuyAnything={0} cannot buy anything +CannotBuyRight={1} cannot buy '{1}' right for {2}: {3} CERT_NAME={0} {1}% share CLOSE=Close CloseMinor=Close minor {0} @@ -526,6 +529,7 @@ RevenueStationsIgnoreMinors=, Cities = {0} ReceivesFor={0} receives {1} for {2}. RevenueWithNoTrains={0} owns no trains, so revenue is {1}. +RIGHTS=Rights RotateTile=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press the No Tile button. RouteAwareness=support for tile and token lays RunsWithBorrowedTrain={0} runs with a borrowed {1}-train and must withhold revenue Modified: trunk/18xx/data/1830/CompanyManager.xml =================================================================== --- trunk/18xx/data/1830/CompanyManager.xml 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/data/1830/CompanyManager.xml 2011-06-30 15:19:12 UTC (rev 1595) @@ -22,6 +22,14 @@ <Certificate shares="1" number="8"/> <Trains limit="4,4,3,2"/> <CanUseSpecialProperties/> + <IfOption name="Variant" value="Coalfields,Coalfields&Reading"> + <CanUseSpecialProperties/> + <SpecialProperties> + <SpecialProperty condition="ifOwnedByCompany" when="orTurn" class="rails.game.special.SpecialRight"> + <SpecialRight name="Coalfields" cost="140"/> + </SpecialProperty> + </SpecialProperties> + </IfOption> </CompanyType> <Company name="SVNRR" type="Private" basePrice="20" revenue="5" longname="Schuylkill Valley Navigation & Railroad Company"> Modified: trunk/18xx/rails/common/GuiDef.java =================================================================== --- trunk/18xx/rails/common/GuiDef.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/common/GuiDef.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -37,6 +37,7 @@ CAN_ANY_COMPANY_BUY_PRIVATES, DO_BONUS_TOKENS_EXIST, HAS_ANY_COMPANY_LOANS, + HAS_ANY_RIGHTS, NO_MAP_MODE, REVENUE_SUGGEST, ROUTE_HIGHLIGHT Modified: trunk/18xx/rails/game/CompanyManager.java =================================================================== --- trunk/18xx/rails/game/CompanyManager.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/CompanyManager.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -74,6 +74,9 @@ // Localised here as it has no permanent use Map<String, CompanyTypeI> mCompanyTypes = new HashMap<String, CompanyTypeI>(); + + //NEW// + Map<String, Tag> typeTags = new HashMap<String, Tag>(); for (Tag compTypeTag : tag.getChildren(CompanyTypeI.ELEMENT_ID)) { // Extract the attributes of the Component @@ -101,6 +104,8 @@ // Further parsing is done within CompanyType companyType.configureFromXML(compTypeTag); + //NEW// + typeTags.put(name, compTypeTag); } /* Read and configure the companies */ @@ -125,7 +130,9 @@ } try { - CompanyI company = cType.createCompany(name, companyTag); + //NEW//CompanyI company = cType.createCompany(name, companyTag); + Tag typeTag = typeTags.get(type); + CompanyI company = cType.createCompany(name, typeTag, companyTag); /* Private or public */ if (company instanceof PrivateCompanyI) { Modified: trunk/18xx/rails/game/CompanyType.java =================================================================== --- trunk/18xx/rails/game/CompanyType.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/CompanyType.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -24,8 +24,6 @@ protected String className; protected int capitalisation = PublicCompanyI.CAPITALISE_FULL; - private CompanyI dummyCompany; - protected List<CompanyI> companies = new ArrayList<CompanyI>(); /** @@ -46,44 +44,26 @@ * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { - - /* Create a dummy company implementing this company type */ - try { - dummyCompany = (Company) Class.forName(className).newInstance(); - } catch (Exception e) { - throw new ConfigurationException(LocalText.getText( - "ClassCannotBeInstantiated", className), e); - } - dummyCompany.init("", this); - dummyCompany.configureFromXML(tag); - - /* - * Must be rewritten to a new tag String capitalMode = - * XmlUtils.extractStringAttribute(nnp, "capitalisation", "full"); - * setCapitalisation(capitalMode); - */ - + //No longer needed. } public void finishConfiguration (GameManagerI gameManager) { } - public CompanyI createCompany(String name, Tag tag) - throws ConfigurationException { + public CompanyI createCompany(String name, Tag typeTag, Tag tag) + throws ConfigurationException { CompanyI newCompany = null; try { - newCompany = (CompanyI) dummyCompany.clone(); - if (newCompany == null) { - throw new ConfigurationException("Cannot clone company " + name); - } - newCompany.init(name, this); - newCompany.configureFromXML(tag); - companies.add(newCompany); - } catch (CloneNotSupportedException e) { - DisplayBuffer.add(LocalText.getText("CantCloneCompany", - name, this.name )); + newCompany = (Company) Class.forName(className).newInstance(); + } catch (Exception e) { + throw new ConfigurationException(LocalText.getText( + "ClassCannotBeInstantiated", className), e); } + newCompany.init(name, this); + newCompany.configureFromXML(typeTag); + newCompany.configureFromXML(tag); + companies.add(newCompany); return newCompany; } @@ -126,7 +106,4 @@ return capitalisation; } - public CompanyI getDummyCompany() { - return dummyCompany; - } } Modified: trunk/18xx/rails/game/CompanyTypeI.java =================================================================== --- trunk/18xx/rails/game/CompanyTypeI.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/CompanyTypeI.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -28,7 +28,7 @@ // public void configureFromXML(Element el) throws ConfigurationException; - public CompanyI createCompany(String name, Tag tag) + public CompanyI createCompany(String name, Tag typeTag, Tag tag) throws ConfigurationException; /** @@ -48,6 +48,4 @@ public void setCapitalisation(String mode); public int getCapitalisation(); - - public CompanyI getDummyCompany(); } \ No newline at end of file Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/Game.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -258,13 +258,14 @@ return null; } GameManagerI gameManager = game.getGameManager(); - int numberOfActions = 0; log.debug("Starting to execute loaded actions"); gameManager.setReloading(true); Object actionObject = null; + int actionIndex = 0; + while (true) { // Single-pass loop. try { actionObject = ois.readObject(); @@ -276,8 +277,8 @@ // Old-style: one List of PossibleActions List<PossibleAction> executedActions = (List<PossibleAction>) actionObject; - numberOfActions = executedActions.size(); for (PossibleAction action : executedActions) { + ++actionIndex; try { if (!gameManager.processOnReload(action)) { log.error ("Load interrupted"); @@ -285,14 +286,14 @@ break; } } catch (Exception e) { - log.fatal("Action '"+action+"' reload exception", e); + log.fatal("Action "+actionIndex+" '"+action+"' reload exception", e); throw new Exception ("Reload exception", e); } } } else if (actionObject instanceof PossibleAction) { // New style: separate PossibleActionsObjects, since Rails 1.3.1 while (actionObject instanceof PossibleAction) { - numberOfActions++; + ++actionIndex; try { if (!gameManager.processOnReload((PossibleAction)actionObject)) { log.error ("Load interrupted"); @@ -300,7 +301,7 @@ break; } } catch (Exception e) { - log.fatal("Action '"+((PossibleAction)actionObject).toString() + log.fatal("Action "+actionIndex+" '"+((PossibleAction)actionObject).toString() +"' reload exception", e); throw new Exception ("Reload exception", e); } Modified: trunk/18xx/rails/game/GameManager.java =================================================================== --- trunk/18xx/rails/game/GameManager.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/GameManager.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -1706,6 +1706,10 @@ return false; } } + + public void setGuiParameter (GuiDef.Parm key, boolean value) { + guiParameters.put (key, value); + } public void setGameParameter (GameDef.Parm key, Object value) { gameParameters.put(key, value); Modified: trunk/18xx/rails/game/GameManagerI.java =================================================================== --- trunk/18xx/rails/game/GameManagerI.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/GameManagerI.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -188,6 +188,7 @@ public abstract String getClassName(GuiDef.ClassName key); + public void setGuiParameter (GuiDef.Parm key, boolean value); public abstract Object getGuiParameter(GuiDef.Parm key); public Object getGameParameter (GameDef.Parm key); public void setGameParameter (GameDef.Parm key, Object value); Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/OperatingRound.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -241,6 +241,11 @@ } else if (selectedAction instanceof ClosePrivate) { result = executeClosePrivate((ClosePrivate)selectedAction); + + } else if (selectedAction instanceof UseSpecialProperty + && ((UseSpecialProperty)selectedAction).getSpecialProperty() instanceof SpecialRight) { + + result = buyRight ((UseSpecialProperty)selectedAction); } else if (selectedAction instanceof NullAction) { @@ -2305,6 +2310,44 @@ return numberOfLoans * operatingCompany.get().getValuePerLoan(); } + protected boolean buyRight (UseSpecialProperty action) { + + String errMsg = null; + + SpecialPropertyI sp = action.getSpecialProperty(); + if (!(sp instanceof SpecialRight)) { + errMsg = "Wrong right property class: "+sp.toString(); + } + + SpecialRight right = (SpecialRight) sp; + String rightName = right.getName(); + String rightValue = right.getValue(); + + if (errMsg != null) { + DisplayBuffer.add(LocalText.getText("CannotBuyRight", + action.getCompanyName(), + rightName, + Bank.format(right.getCost()), + errMsg)); + + return false; + } + + moveStack.start(true); + + operatingCompany.get().setRight(rightName, rightValue); + new CashMove (operatingCompany.get(), bank, right.getCost()); + + ReportBuffer.add(LocalText.getText("BuysRight", + operatingCompany.get().getName(), + rightName, + Bank.format(right.getCost()))); + + sp.setExercised(); + + return true; + } + /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ /** @@ -2486,10 +2529,13 @@ // Are there other step-independent special properties owned by the company? List<SpecialPropertyI> orsps = operatingCompany.get().getPortfolio().getAllSpecialProperties(); + List<SpecialPropertyI> compsps = operatingCompany.get().getSpecialProperties(); + if (compsps != null) orsps.addAll(compsps); + if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByCompany() - && sp.isUsableDuringOR()) { + && sp.isUsableDuringOR(step)) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); @@ -2505,7 +2551,7 @@ if (orsps != null) { for (SpecialPropertyI sp : orsps) { if (!sp.isExercised() && sp.isUsableIfOwnedByPlayer() - && sp.isUsableDuringOR()) { + && sp.isUsableDuringOR(step)) { if (sp instanceof SpecialTokenLay) { if (getStep() != GameDef.OrStep.LAY_TOKEN) { possibleActions.add(new LayBaseToken((SpecialTokenLay)sp)); Modified: trunk/18xx/rails/game/PublicCompany.java =================================================================== --- trunk/18xx/rails/game/PublicCompany.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/PublicCompany.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -4,11 +4,11 @@ import java.awt.Color; import java.util.*; +import rails.common.GuiDef; import rails.game.action.SetDividend; import rails.game.model.*; import rails.game.move.*; -import rails.game.special.SellBonusToken; -import rails.game.special.SpecialPropertyI; +import rails.game.special.*; import rails.game.state.*; import rails.util.*; @@ -274,6 +274,11 @@ protected Bank bank; protected StockMarketI stockMarket; protected MapManager mapManager; + + /** Rights */ + protected HashMapState<String, String> rights = null; + protected RightsModel rightsModel = new RightsModel(); + /** * The constructor. The way this class is instantiated does not allow @@ -607,6 +612,7 @@ ("mustTradeTrainsAtFixedPrice", mustTradeTrainsAtFixedPrice); canClose = optionsTag.getAttributeAsBoolean("canClose", canClose); } + } /** Initialisation, to be called directly after instantiation (cloning) */ @@ -652,29 +658,8 @@ canSharePriceVary = new BooleanState (name+"_CanSharePriceVary", true); } - if (turnsWithExtraTileLaysInit != null) { - turnsWithExtraTileLays = new HashMap<String, IntegerState>(); - for (String colour : turnsWithExtraTileLaysInit.keySet()) { - turnsWithExtraTileLays.put(colour, new IntegerState( - name + "_" + colour + "_ExtraTileTurns", - turnsWithExtraTileLaysInit.get(colour))); - } - } + } - PublicCompanyI dummyCompany = (PublicCompanyI) type.getDummyCompany(); - if (dummyCompany != null) { - fgHexColour = dummyCompany.getHexFgColour(); - bgHexColour = dummyCompany.getHexBgColour(); - } - - if (maxNumberOfLoans != 0) { - currentNumberOfLoans = new IntegerState (name+"_Loans", 0); - currentLoanValue = new MoneyModel (name+"_LoanValue", 0); - currentLoanValue.setOption(MoneyModel.SUPPRESS_ZERO); - } - - } - public void setIndex (int index) { publicNumber = index; } @@ -690,6 +675,21 @@ stockMarket = gameManager.getStockMarket(); mapManager = gameManager.getMapManager(); + if (turnsWithExtraTileLaysInit != null) { + turnsWithExtraTileLays = new HashMap<String, IntegerState>(); + for (String colour : turnsWithExtraTileLaysInit.keySet()) { + turnsWithExtraTileLays.put(colour, new IntegerState( + name + "_" + colour + "_ExtraTileTurns", + turnsWithExtraTileLaysInit.get(colour))); + } + } + + if (maxNumberOfLoans != 0) { + currentNumberOfLoans = new IntegerState (name+"_Loans", 0); + currentLoanValue = new MoneyModel (name+"_LoanValue", 0); + currentLoanValue.setOption(MoneyModel.SUPPRESS_ZERO); + } + if (hasStockPrice && Util.hasValue(startSpace)) { parPrice.setPrice(stockMarket.getStockSpace( startSpace)); @@ -756,6 +756,15 @@ infoText += parentInfoText; parentInfoText = ""; + + // Can companies acquire special rights (such as in 1830 Coalfields)? + if (specialProperties != null) { + for (SpecialPropertyI sp : specialProperties) { + if (sp instanceof SpecialRight) { + gameManager.setGuiParameter (GuiDef.Parm.HAS_ANY_RIGHTS, true); + } + } + } } /** Reset turn objects */ @@ -1973,11 +1982,32 @@ public MoneyModel getLoanValueModel () { return currentLoanValue; } + + public RightsModel getRightsModel () { + return rightsModel; + } public boolean canClose() { return canClose; } - + + public void setRight (String nameOfRight, String value) { + if (rights == null) { + rights = new HashMapState<String, String>(name+"_Rights"); + rightsModel.init (rights); + } + rights.put(nameOfRight, value); + rightsModel.update(); + } + + public boolean hasRight (String nameOfRight) { + return rights != null && rights.hasKey(nameOfRight); + } + + public String getRight (String nameOfRight) { + return rights != null ? rights.get(nameOfRight) : null; + } + @Override public Object clone() { @@ -1996,6 +2026,9 @@ if (certificates != null) { ((PublicCompanyI) clone).setCertificates(certificates); } + if (specialProperties != null) { + ((PublicCompany) clone).specialProperties = new ArrayList<SpecialPropertyI>(specialProperties); + } return clone; } Modified: trunk/18xx/rails/game/PublicCompanyI.java =================================================================== --- trunk/18xx/rails/game/PublicCompanyI.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/PublicCompanyI.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -342,10 +342,15 @@ public int getMaxLoansPerRound(); public int getValuePerLoan(); public MoneyModel getLoanValueModel (); + public RightsModel getRightsModel (); public int sharesOwnedByPlayers(); public String getExtraShareMarks (); + public void setRight (String nameOfRight, String value); + public boolean hasRight (String nameOfRight); + public String getRight (String nameOfRight); + public ModelObject getInGameModel (); public ModelObject getIsClosedModel (); Added: trunk/18xx/rails/game/model/RightsModel.java =================================================================== --- trunk/18xx/rails/game/model/RightsModel.java (rev 0) +++ trunk/18xx/rails/game/model/RightsModel.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -0,0 +1,37 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/model/RightsModel.java,v 1.6 2008/06/04 19:00:37 evos Exp $*/ +package rails.game.model; + +import rails.game.state.HashMapState; +import tools.Util; + +public class RightsModel extends ModelObject { + + private HashMapState<String, String> rights; + + public RightsModel() { + } + + /** Split off from the constructor to allow the rights map to exist only if needed */ + public void init (HashMapState<String, String> rights) { + this.rights = rights; + } + + public String getText() { + + if (rights == null) return ""; + + StringBuilder buf = new StringBuilder("<html>"); + for (String name : rights.viewKeySet()) { + if (buf.length() > 6) buf.append("<br>"); + buf.append(name); + String value = rights.get(name); + if (Util.hasValue(value)) buf.append("=").append(value); + } + if (buf.length() > 6) { + buf.append("</html>"); + } + return buf.toString(); + + } + +} Property changes on: trunk/18xx/rails/game/model/RightsModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/rails/game/special/SpecialProperty.java =================================================================== --- trunk/18xx/rails/game/special/SpecialProperty.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/special/SpecialProperty.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -169,8 +169,18 @@ } - public boolean isUsableDuringOR() { - return usableDuringOR; + public boolean isUsableDuringOR(GameDef.OrStep step) { + + if (usableDuringOR) return true; + + switch (step) { + case LAY_TRACK: + return usableDuringTileLayingStep; + case LAY_TOKEN: + return usableDuringTokenLayingStep; + default: + return false; + } } public void setUsableDuringOR(boolean usableDuringOR) { Modified: trunk/18xx/rails/game/special/SpecialPropertyI.java =================================================================== --- trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -1,8 +1,7 @@ /* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialPropertyI.java,v 1.12 2010/03/16 21:21:59 evos Exp $ */ package rails.game.special; -import rails.game.CompanyI; -import rails.game.ConfigurableComponentI; +import rails.game.*; import rails.game.move.Moveable; import rails.game.move.MoveableHolder; @@ -25,7 +24,7 @@ public void setUsableIfOwnedByPlayer(boolean usableIfOwnedByPlayer); - public boolean isUsableDuringOR(); + public boolean isUsableDuringOR(GameDef.OrStep step); public void setUsableDuringOR(boolean usableDuringOR); Added: trunk/18xx/rails/game/special/SpecialRight.java =================================================================== --- trunk/18xx/rails/game/special/SpecialRight.java (rev 0) +++ trunk/18xx/rails/game/special/SpecialRight.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -0,0 +1,76 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialRight.java,v 1.19 2010/05/05 21:37:18 evos Exp $ */ +package rails.game.special; + +import rails.game.*; +import rails.util.*; + +public class SpecialRight extends SpecialProperty { + + /** The public company of which a share can be obtained. */ + protected String rightName; + protected String rightDefaultValue; + protected String rightValue; + protected int cost; + + @Override + public void configureFromXML(Tag tag) throws ConfigurationException { + + super.configureFromXML(tag); + + Tag rightTag = tag.getChild("SpecialRight"); + if (rightTag == null) { + throw new ConfigurationException("<SpecialRight> tag missing"); + } + + rightName = rightTag.getAttributeAsString("name"); + if (!Util.hasValue(rightName)) + throw new ConfigurationException( + "SpecialRight: no Right name specified"); + + rightDefaultValue = rightValue = rightTag.getAttributeAsString("defaultValue", null); + + cost = rightTag.getAttributeAsInteger("cost", 0); + } + + public boolean isExecutionable() { + + return originalCompany.getPortfolio().getOwner() instanceof Player; + } + + + public String getName() { + return rightName; + } + + public String getDefaultValue() { + return rightDefaultValue; + } + + public String getValue() { + return rightValue; + } + + public void setValue(String rightValue) { + this.rightValue = rightValue; + } + + public int getCost() { + return cost; + } + + @Override + public String toString() { + return "Buy '" + rightName + "' right for " + Bank.format(cost); + } + + @Override + public String toMenu() { + return LocalText.getText("BuyRight", + rightName, + Bank.format(cost)); + } + + public String getInfo() { + return toMenu(); + } +} Property changes on: trunk/18xx/rails/game/special/SpecialRight.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/rails/game/state/HashMapState.java =================================================================== --- trunk/18xx/rails/game/state/HashMapState.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/game/state/HashMapState.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -59,6 +59,10 @@ new RemoveFromMap<K,V>(map, key); } + public boolean hasKey(K key) { + return map.containsKey(key); + } + public void clear() { // Two-step process to avoid concurrent modification exception List<K> keys = new ArrayList<K>(); Modified: trunk/18xx/rails/ui/swing/GameStatus.java =================================================================== --- trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -61,6 +61,8 @@ protected int compPrivatesXOffset, compPrivatesYOffset; protected Field compLoans[]; protected int compLoansXOffset, compLoansYOffset; + protected int rightsXOffset, rightsYOffset; + protected Field rights[]; protected Field playerCash[]; protected ClickField playerCashButton[]; protected int playerCashXOffset, playerCashYOffset; @@ -100,6 +102,7 @@ protected boolean compCanHoldOwnShares = false; protected boolean compCanHoldForeignShares = false; // NOT YET USED protected boolean hasCompanyLoans = false; + protected boolean hasRights; // Current actor. // Players: 0, 1, 2, ... @@ -148,6 +151,7 @@ compCanBuyPrivates = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); compCanHoldOwnShares = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES); hasCompanyLoans = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_COMPANY_LOANS); + hasRights = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_RIGHTS); ipo = bank.getIpo(); pool = bank.getPool(); @@ -171,6 +175,7 @@ compTokens = new Field[nc]; compPrivates = new Field[nc]; compLoans = new Field[nc]; + if (hasRights) rights = new Field[nc]; playerCash = new Field[np]; playerCashButton = new ClickField[np]; @@ -215,6 +220,10 @@ compLoansXOffset = ++lastX; compLoansYOffset = lastY; } + if (hasRights) { + rightsXOffset = ++lastX; + rightsYOffset = lastY; + } rightCompCaptionXOffset = ++lastX; playerCashXOffset = certPerPlayerXOffset; @@ -297,6 +306,10 @@ addField (new Caption (LocalText.getText("LOANS")), compLoansXOffset, 1, 1, 1, WIDE_BOTTOM, true); } + if (hasRights) { + addField (new Caption(LocalText.getText("RIGHTS")), + rightsXOffset, 1, 1, 1, WIDE_BOTTOM, true); + } addField(new Caption(LocalText.getText("COMPANY")), rightCompCaptionXOffset, 0, 1, 2, WIDE_LEFT + WIDE_BOTTOM, true); @@ -419,7 +432,13 @@ } addField (f, compLoansXOffset, compLoansYOffset+i, 1, 1, 0, visible); } + + if (hasRights) { + f = rights[i] = new Field (c.getRightsModel()); + addField (f, rightsXOffset, rightsYOffset + i, 1, 1, 0, visible); + } + f = new Caption(c.getName()); f.setForeground(c.getFgColour()); f.setBackground(c.getBgColour()); Modified: trunk/18xx/rails/ui/swing/ORPanel.java =================================================================== --- trunk/18xx/rails/ui/swing/ORPanel.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/ui/swing/ORPanel.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -90,10 +90,13 @@ private Field trains[]; private int trainsXOffset, trainsYOffset; private Field newTrainCost[]; + private int rightsXOffset, rightsYOffset; + private Field rights[]; private boolean privatesCanBeBought = false; private boolean bonusTokensExist = false; private boolean hasCompanyLoans = false; + private boolean hasRights; private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, privatesCaption, loansCaption; @@ -138,6 +141,7 @@ privatesCanBeBought = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); bonusTokensExist = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.DO_BONUS_TOKENS_EXIST); hasCompanyLoans = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_COMPANY_LOANS); + hasRights = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_RIGHTS); initButtonPanel(); gbc = new GridBagConstraints(); @@ -296,6 +300,7 @@ tokensLeft = new Field[nc]; if (bonusTokensExist) tokenBonus = new Field[nc]; if (hasCompanyLoans) compLoans = new Field[nc]; + if (hasRights) rights = new Field[nc]; revenue = new Field[nc]; revenueSelect = new Spinner[nc]; decision = new Field[nc]; @@ -343,6 +348,13 @@ addField (loansCaption = new Caption(LocalText.getText("LOANS")), loansXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT); } + + if (hasRights) { + rightsXOffset = currentXOffset += lastXWidth; + rightsYOffset = leftCompNameYOffset; + addField (new Caption(LocalText.getText("RIGHTS")), + rightsXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT); + } tilesXOffset = currentXOffset += lastXWidth; tilesYOffset = leftCompNameYOffset; @@ -441,6 +453,11 @@ } addField (f, loansXOffset, loansYOffset + i, 1, 1, WIDE_RIGHT, visible); } + + if (hasRights) { + f = rights[i] = new Field (c.getRightsModel()); + addField (f, rightsXOffset, rightsYOffset + i, 1, 1, WIDE_RIGHT, visible); + } f = tiles[i] = new Field(c.getTilesLaidThisTurnModel()); addField(f, tilesXOffset, tilesYOffset + i, 1, 1, 0, visible); Modified: trunk/18xx/rails/util/ListAndFixSavedFiles.java =================================================================== --- trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -302,10 +302,12 @@ if (Util.hasValue(result)) { try { int index = Integer.parseInt(result); - executedActions.remove(index); + PossibleAction action = executedActions.get(index); + executedActions.remove(action); + savedObjects.remove(action); setReportText(false); } catch (NumberFormatException e) { - + log.error("Number format exception for '"+result+"'", e); } } } else if ("SAVE".equalsIgnoreCase(command)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-28 17:08:35
|
Revision: 1594 http://rails.svn.sourceforge.net/rails/?rev=1594&view=rev Author: evos Date: 2011-06-28 17:08:29 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Added Phase name to Game Status panel Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/rails/game/PhaseManager.java trunk/18xx/rails/ui/swing/GameStatus.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2011-06-28 08:16:12 UTC (rev 1593) +++ trunk/18xx/LocalisedText.properties 2011-06-28 17:08:29 UTC (rev 1594) @@ -454,6 +454,7 @@ PaysTo={0} pays {1} to {2} Payout={0} receives {1} for {2} {3}% shares PaysForTokens={0} pays {1} to Bank for {2} tokens +PHASE=Phase PLAYERS=Players POOL=Pool PRES_CERT_NAME={0} {1}% president share Modified: trunk/18xx/rails/game/PhaseManager.java =================================================================== --- trunk/18xx/rails/game/PhaseManager.java 2011-06-28 08:16:12 UTC (rev 1593) +++ trunk/18xx/rails/game/PhaseManager.java 2011-06-28 17:08:29 UTC (rev 1594) @@ -5,6 +5,7 @@ import org.apache.log4j.Logger; +import rails.game.model.ModelObject; import rails.game.state.State; import rails.util.Tag; @@ -57,6 +58,10 @@ public PhaseI getCurrentPhase() { return (PhaseI) currentPhase.get(); } + + public ModelObject getCurrentPhaseModel() { + return currentPhase; + } public int getCurrentPhaseIndex() { return getCurrentPhase().getIndex(); Modified: trunk/18xx/rails/ui/swing/GameStatus.java =================================================================== --- trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 08:16:12 UTC (rev 1593) +++ trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 17:08:29 UTC (rev 1594) @@ -73,6 +73,7 @@ protected Field playerCertCount[]; protected int playerCertCountXOffset, playerCertCountYOffset; protected int certLimitXOffset, certLimitYOffset; + protected int phaseXOffset, phaseYOffset; protected Field bankCash; protected int bankCashXOffset, bankCashYOffset; protected Field poolTrains; @@ -228,6 +229,8 @@ playerCertCountYOffset = ++lastY; certLimitXOffset = certInPoolXOffset; certLimitYOffset = playerCertCountYOffset; + phaseXOffset = certInPoolXOffset + 2; + phaseYOffset = playerCertCountYOffset; bankCashXOffset = certInPoolXOffset; bankCashYOffset = playerPrivatesYOffset; poolTrainsXOffset = bankCashXOffset + 2; @@ -489,6 +492,13 @@ certLimitXOffset, certLimitYOffset, 1, 1, WIDE_TOP, true); + // Phase + addField(new Caption(LocalText.getText("PHASE")), phaseXOffset - 1, + phaseYOffset, 1, 1, WIDE_TOP + WIDE_LEFT, true); + addField(new Field(gameUIManager.getGameManager().getPhaseManager().getCurrentPhaseModel()), + phaseXOffset, + phaseYOffset, 1, 1, WIDE_TOP, true); + // Bank addField(new Caption(LocalText.getText("BANK")), bankCashXOffset - 1, bankCashYOffset - 1, 1, 2, WIDE_TOP + WIDE_LEFT, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-28 08:16:18
|
Revision: 1593 http://rails.svn.sourceforge.net/rails/?rev=1593&view=rev Author: evos Date: 2011-06-28 08:16:12 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Initial XML for 1826(2) Modified Paths: -------------- trunk/18xx/data/1826/Game.xml trunk/18xx/data/1826/TileSet.xml Modified: trunk/18xx/data/1826/Game.xml =================================================================== --- trunk/18xx/data/1826/Game.xml 2011-06-26 15:25:09 UTC (rev 1592) +++ trunk/18xx/data/1826/Game.xml 2011-06-28 08:16:12 UTC (rev 1593) @@ -66,14 +66,37 @@ cities="double" if city-revenue is doubled (e.g. 1826 TGV). --> </Defaults> - <TrainType name="2" majorStops="2" cost="80" quantity="5" obsoleting="yes"/> + <TrainType name="2H" majorStops="2" cost="100" quantity="8"/> + <TrainType name="4H" majorStops="4" cost="200" quantity="7" startPhase="4H"/> + <TrainType name="6H" majorStops="6" cost="300" quantity="6" startPhase="6H" + rustedTrain="2H"/> + <TrainType name="10H" majorStops="10" cost="600" quantity="5" startPhase="10H" + rustedTrain="4H"/> + <TrainType name="E" majorStops="6" cost="800" quantity="4" startPhase="E" + rustedTrain="6H"/> + <TrainType name="TGV" majorStops="4" cost="1000" quantity="10" startPhase="TGV"/> </Component> <Component name="PhaseManager" class="rails.game.PhaseManager"> - <Phase name="2" > + <Phase name="2H" > <Tiles colour="yellow"/> <OperatingRounds number="1"/> - <Trains onePerTurn="yes" tradingAllowed="yes"/> + <Trains tradingAllowed="yes"/> </Phase> + <Phase name="4H" > + <Tiles colour="yellow,green"/> + <OperatingRounds number="2"/> + </Phase> + <Phase name="6H" > + </Phase> + <Phase name="10H" > + <Tiles colour="yellow,green,brown"/> + <OperatingRounds number="3"/> + </Phase> + <Phase name="E" > + </Phase> + <Phase name="TGV" > + <Tiles colour="yellow,green,brown,gray"/> + </Phase> </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> </Component> Modified: trunk/18xx/data/1826/TileSet.xml =================================================================== --- trunk/18xx/data/1826/TileSet.xml 2011-06-26 15:25:09 UTC (rev 1592) +++ trunk/18xx/data/1826/TileSet.xml 2011-06-28 08:16:12 UTC (rev 1593) @@ -1,52 +1,122 @@ <TileManager tiles="Tiles.xml"> - - <Tile id="0"/> - <Tile id="-1"/> - <Tile id="-10"/> + <!-- Preprinted tiles --> + <Tile id="0"> + <Upgrade id="7,8,9" /> + </Tile> + <Tile id="-1"> + <Upgrade id="3,4,58" /> + </Tile> + <Tile id="-10"> + <Upgrade id="5,6,57" /> + </Tile> <Tile id="-901"/> <Tile id="-902"/> <Tile id="-903"/> - <Tile id="-26001"/> + <Tile id="-26001"> + <Upgrade id="514" /> + </Tile> <Tile id="-26002"/> <Tile id="-26003"/> - <Tile id="-26004"/> - <Tile id="-26005"/> - <Tile id="-26006"/> - <Tile id="-26007"/> + <Tile id="-26004"> + <Upgrade id="14,15,619" /> + </Tile> + <Tile id="-26005"> + <Upgrade id="14,15,619" /> + </Tile> + <Tile id="-26006"> + <Upgrade id="63" /> + </Tile> + <Tile id="-26007"> + <Upgrade id="63" /> + </Tile> <Tile id="-103"/> <Tile id="-105"/> - <Tile id="3" quantity="2"/> - <Tile id="4" quantity="6"/> - <Tile id="5" quantity="2"/> - <Tile id="6" quantity="2"/> - <Tile id="7" quantity="4"/> - <Tile id="8" quantity="16"/> - <Tile id="9" quantity="21"/> - <Tile id="57" quantity="4"/> - <Tile id="58" quantity="6"/> - <Tile id="14" quantity="3"/> - <Tile id="15" quantity="3"/> - <Tile id="16" quantity="1"/> - <Tile id="19" quantity="1"/> - <Tile id="20" quantity="1"/> - <Tile id="23" quantity="5"/> - <Tile id="24" quantity="5"/> - <Tile id="25" quantity="3"/> - <Tile id="26" quantity="1"/> - <Tile id="27" quantity="1"/> - <Tile id="28" quantity="1"/> - <Tile id="29" quantity="1"/> - <Tile id="87" quantity="2"/> - <Tile id="88" quantity="2"/> - <Tile id="141" quantity="1"/> - <Tile id="142" quantity="1"/> - <Tile id="143" quantity="1"/> - <Tile id="203" quantity="1"/> - <Tile id="204" quantity="2"/> - <Tile id="514" quantity="1"/> - <Tile id="619" quantity="3"/> + <!-- Yellow tiles --> + <Tile id="3" quantity="2"> + <Upgrade id="87,88,141,142,143,204" /> + </Tile> + <Tile id="4" quantity="6"> + <Upgrade id="87,88,141,142,204" /> + </Tile> + <Tile id="5" quantity="2"> + <Upgrade id="14,15,619" /> + </Tile> + <Tile id="6" quantity="2"> + <Upgrade id="14,15,619" /> + </Tile> + <Tile id="7" quantity="4"> + <Upgrade id="26,27,28,29" /> + </Tile> + <Tile id="8" quantity="18"> + <Upgrade id="16,19,23,24,25,28,29" /> + </Tile> + <Tile id="9" quantity="23"> + <Upgrade id="19,20,23,24,26,27" /> + </Tile> + <Tile id="57" quantity="4"> + <Upgrade id="14,15,619" /> + </Tile> + <Tile id="58" quantity="6"> + <Upgrade id="87,88,141,142,143,203,204" /> + </Tile> + + <!-- Green tiles --> + <Tile id="14" quantity="3"> + <Upgrade id="63" hex="-B12,-C15"/> + <Upgrade id="611" hex="B12,C15"/> + </Tile> + <Tile id="15" quantity="3"> + <Upgrade id="63" hex="-B12,-C15"/> + <Upgrade id="611" hex="B12,C15"/> + </Tile> + <Tile id="16" quantity="1"> + <Upgrade id="43,70" /> + </Tile> + <Tile id="19" quantity="1"> + <Upgrade id="45,46" /> + </Tile> + <Tile id="20" quantity="1"> + <Upgrade id="44,47" /> + </Tile> + <Tile id="23" quantity="5"> + <Upgrade id="41,43,45,47" /> + </Tile> + <Tile id="24" quantity="5"> + <Upgrade id="42,43,46,47" /> + </Tile> + <Tile id="25" quantity="3"> + <Upgrade id="40,45,46" /> + </Tile> + <Tile id="26" quantity="1"> + <Upgrade id="42,44,45" /> + </Tile> + <Tile id="27" quantity="1"> + <Upgrade id="41,44,46" /> + </Tile> + <Tile id="28" quantity="1"> + <Upgrade id="39,43,46,70" /> + </Tile> + <Tile id="29" quantity="1"> + <Upgrade id="39,43,45,70" /> + </Tile> + <Tile id="87" quantity="2" /> + <Tile id="88" quantity="2" /> + <Tile id="141" quantity="1" /> + <Tile id="142" quantity="1" /> + <Tile id="143" quantity="1" /> + <Tile id="203" quantity="1" /> + <Tile id="204" quantity="2" /> + <Tile id="514" quantity="1"> + <Upgrade id="515" /> + </Tile> + <Tile id="619" quantity="3"> + <Upgrade id="63" hex="-B12,-C15"/> + <Upgrade id="611" hex="B12,C15"/> + </Tile> + + <!-- Brown tiles --> <Tile id="39" quantity="1"/> <Tile id="40" quantity="1"/> <Tile id="41" quantity="2"/> @@ -56,10 +126,16 @@ <Tile id="45" quantity="2"/> <Tile id="46" quantity="2"/> <Tile id="47" quantity="3"/> - <Tile id="63" quantity="5"/> + <Tile id="63" quantity="5"> + <Upgrade id="513" hex="C11,C13,L14"/> + </Tile> <Tile id="70" quantity="1"/> - <Tile id="515" quantity="1"/> + <Tile id="515" quantity="1"> + <Upgrade id="516" /> + </Tile> <Tile id="611" quantity="2"/> + + <!-- Gray tiles --> <Tile id="513" quantity="3"/> <Tile id="516" quantity="1"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-26 15:25:17
|
Revision: 1592 http://rails.svn.sourceforge.net/rails/?rev=1592&view=rev Author: evos Date: 2011-06-26 15:25:09 +0000 (Sun, 26 Jun 2011) Log Message: ----------- 18GA: last fine details Added Paths: ----------- trunk/18xx/tiles/TileDictionary.18t Added: trunk/18xx/tiles/TileDictionary.18t =================================================================== --- trunk/18xx/tiles/TileDictionary.18t (rev 0) +++ trunk/18xx/tiles/TileDictionary.18t 2011-06-26 15:25:09 UTC (rev 1592) @@ -0,0 +1,17421 @@ +object TTilesWrapper + Collection = < + item + Code = -909 + LongName = 'OM straight' + Level = tlOffMap + Connections = < + item + Position1 = tp4SideC + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = -908 + LongName = 'OM wide curve' + Level = tlOffMap + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideC + end> + Junctions = <> + end + item + Code = -907 + LongName = 'OM tight curve' + Level = tlOffMap + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideC + end> + Junctions = <> + end + item + Code = -903 + LongName = 'OM 3 way' + Level = tlOffMap + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideB + end> + Junctions = < + item + JunType = jtWhistlestop + Revenue = -1 + end> + end + item + Code = -902 + LongName = 'OM 2 way' + Level = tlOffMap + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideB + end> + Junctions = < + item + JunType = jtWhistlestop + Revenue = -1 + end> + end + item + Code = -901 + LongName = 'OM 1 way' + Level = tlOffMap + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtWhistlestop + Revenue = -1 + end> + end + item + Code = -102 + LongName = '-102' + Connections = < + item + Position1 = tp1CornerD + Position2 = tp4SideB + end + item + Position1 = tp1CornerD + Position2 = tp4SideD + end + item + Position1 = tp1CornerD + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Position = tp1CornerD + Revenue = 20 + end> + end + item + Code = -101 + LongName = 'Philadelphia' + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tp2CornerD + Position2 = tp4SideB + end + item + Position1 = tp2CornerD + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Revenue = 10 + end> + end + item + Code = -21 + LongName = 'NY' + Level = tlMapUpgradableToGreen + Connections = < + item + Position1 = tp2SideC + Position2 = tp4SideC + end + item + Position1 = tp2SideF + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Position = tp2SideC + Revenue = 40 + RevenuePosition = tp3SideE + end + item + JunType = jtCity + Position = tp2SideF + Revenue = 40 + RevenuePosition = tp3SideB + end> + end + item + Code = -20 + LongName = '2 cities' + Level = tlMapUpgradableToGreen + Connections = <> + Junctions = < + item + JunType = jtCity + Position = tp2SideA + end + item + JunType = jtCity + Position = tp2SideD + end> + end + item + Code = -11 + LongName = 'B' + Level = tlMapUpgradableToGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Revenue = 30 + end> + end + item + Code = -10 + LongName = '1 city' + Level = tlMapUpgradableToYellow + Connections = <> + Junctions = < + item + JunType = jtCity + Position = tp2SideD + end> + end + item + Code = -2 + LongName = '2 villages' + Level = tlMapUpgradableToYellow + Connections = <> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2SideB + end + item + JunType = jtWhistlestop + Position = tp2SideD + end> + end + item + Code = -1 + LongName = '1 village' + Level = tlMapUpgradableToYellow + Connections = <> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2SideA + end> + end + item + Code = 0 + LongName = 'empty' + Level = tlMapUpgradableToYellow + Connections = <> + Junctions = <> + end + item + Code = 1 + LongName = '1' + Level = tlYellow + Connections = < + item + Position1 = tpCurve2LeftE + Position2 = tp4SideA + end + item + Position1 = tpCurve2LeftE + Position2 = tp4SideE + end + item + Position1 = tpCurve2LeftB + Position2 = tp4SideB + end + item + Position1 = tpCurve2LeftB + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tpCurve2LeftE + Revenue = 10 + RevenuePosition = tp3CornerE + end + item + JunType = jtWhistlestop + Position = tpCurve2LeftB + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 2 + LongName = '2' + Level = tlYellow + Connections = < + item + Position1 = tp2SideD + Position2 = tp4SideD + end + item + Position1 = tp2SideD + Position2 = tp4SideA + end + item + Position1 = tpCurve1LeftB + Position2 = tp4SideB + end + item + Position1 = tpCurve1LeftB + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2SideD + Revenue = 10 + RevenuePosition = tp3CornerE + end + item + JunType = jtWhistlestop + Position = tpCurve1LeftB + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 3 + LongName = '3' + Level = tlYellow + Connections = < + item + Position1 = tp2CornerE + Position2 = tp4SideD + end + item + Position1 = tp2CornerE + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2CornerE + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 4 + LongName = '4' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtWhistlestop + Revenue = 10 + end> + end + item + Code = 5 + LongName = '5' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Revenue = 20 + end> + end + item + Code = 1005 + LongName = '5/1832' + Category = 'Lille' + CategoryPosition = tp3SideC + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Revenue = 30 + end> + end + item + Code = 6 + LongName = '6' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Revenue = 20 + end> + end + item + Code = 1006 + LongName = '6/1832' + Category = 'Lyon' + CategoryPosition = tp3SideF + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Revenue = 30 + RevenuePosition = tp3CornerC + end> + end + item + Code = 7 + LongName = '7' + Level = tlYellow + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideE + end> + Junctions = <> + end + item + Code = 8 + LongName = '8' + Level = tlYellow + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 9 + LongName = '9' + Level = tlYellow + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideA + end> + Junctions = <> + end + item + Code = 10 + LongName = '10' + Level = tlGreen + Connections = < + item + Position1 = tp2CornerA + Position2 = tp4SideF + end + item + Position1 = tp2CornerD + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerA + Revenue = 30 + RevenuePosition = tp3CornerF + end + item + JunType = jtCity + Position = tp2CornerD + Revenue = 30 + RevenuePosition = tp3CornerC + end> + end + item + Code = 11 + LongName = '11' + Level = tlGreen + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideC + end + item + Position1 = tp4SideC + Position2 = tp4SideE + end + item + Position1 = tp1SideF + Position2 = tp4SideA + end + item + Position1 = tp1SideF + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp1SideF + Revenue = 10 + end> + end + item + Code = 12 + LongName = '12' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Revenue = 30 + end> + end + item + Code = 1012 + LongName = '12/1830nl' + Category = 'X' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 50 + end> + end + item + Code = 2012 + LongName = '12/1831' + Category = 'C' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Revenue = 40 + end> + end + item + Code = 13 + LongName = '13' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Revenue = 30 + end> + end + item + Code = 1013 + LongName = '13/1830nl' + Category = 'X' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 50 + end> + end + item + Code = 14 + LongName = '14' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 30 + RevenuePosition = tp3CornerB + end> + end + item + Code = 15 + LongName = '15' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 30 + RevenuePosition = tp3CornerB + end> + end + item + Code = 16 + LongName = '16' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideE + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 17 + LongName = '17' + Level = tlGreen + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideC + end + item + Position1 = tp4SideD + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 18 + LongName = '18' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideA + end + item + Position1 = tp4SideE + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 19 + LongName = '19' + Level = tlGreen + Connections = < + item + Position1 = tp4SideF + Position2 = tp4SideB + end + item + Position1 = tp4SideA + Position2 = tp4SideD + Layer = 2 + end> + Junctions = <> + end + item + Code = 20 + LongName = '20' + Level = tlGreen + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideE + end + item + Position1 = tp4SideD + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 21 + LongName = '21' + Level = tlGreen + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideF + end + item + Position1 = tp4SideC + Position2 = tp4SideE + end> + Junctions = <> + end + item + Code = 22 + LongName = '22' + Level = tlGreen + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideC + end + item + Position1 = tp4SideE + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 23 + LongName = '23' + Level = tlGreen + Connections = < + item + Position1 = tp4SideE + Position2 = tp4SideA + end + item + Position1 = tp4SideA + Position2 = tp4SideD + end> + Junctions = <> + end + item + Code = 24 + LongName = '24' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideD + Position2 = tp4SideA + end> + Junctions = <> + end + item + Code = 25 + LongName = '25' + Level = tlGreen + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideD + end + item + Position1 = tp4SideD + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 26 + LongName = '26' + Level = tlGreen + Connections = < + item + Position1 = tp4SideF + Position2 = tp4SideA + end + item + Position1 = tp4SideA + Position2 = tp4SideD + end> + Junctions = <> + end + item + Code = 27 + LongName = '27' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideE + end + item + Position1 = tp4SideD + Position2 = tp4SideA + end> + Junctions = <> + end + item + Code = 28 + LongName = '28' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideE + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 29 + LongName = '29' + Level = tlGreen + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideE + end + item + Position1 = tp4SideD + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 30 + LongName = '30' + Level = tlGreen + Connections = < + item + Position1 = tp4SideA + Position2 = tp4SideC + end + item + Position1 = tp4SideC + Position2 = tp4SideD + end> + Junctions = <> + end + item + Code = 31 + LongName = '31' + Level = tlGreen + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideC + end + item + Position1 = tp4SideC + Position2 = tp4SideE + end> + Junctions = <> + end + item + Code = 32 + LongName = '32' + Category = 'LND' + CategoryPosition = tp1SideC + Level = tlBrown + Connections = < + item + Position1 = tp3SideC + Position2 = tp4SideC + end + item + Position1 = tp3SideB + Position2 = tp4SideB + end + item + Position1 = tp3SideA + Position2 = tp4SideA + end + item + Position1 = tp3SideF + Position2 = tp4SideF + end + item + Position1 = tp3SideE + Position2 = tp4SideE + end + item + Position1 = tp3SideD + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Position = tp3SideD + Revenue = 70 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideE + Revenue = 70 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideF + Revenue = 70 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideA + Revenue = 70 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideB + Revenue = 70 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideC + Revenue = 70 + RevenuePosition = tpCenter + end> + end + item + Code = 33 + LongName = '33' + Category = 'L' + Level = tlBrown + Connections = < + item + Position1 = tp2SideB + Position2 = tp4SideC + end + item + Position1 = tp2SideD + Position2 = tp4SideD + end + item + Position1 = tp2SideF + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Position = tp2SideB + Revenue = 50 + RevenuePosition = tp3SideA + end + item + JunType = jtCity + Position = tp2SideD + Revenue = 50 + RevenuePosition = tp3SideA + end + item + JunType = jtCity + Position = tp2SideF + Revenue = 50 + RevenuePosition = tp3SideA + end> + end + item + Code = 34 + LongName = '34' + Category = 'BGM' + Level = tlBrown + Connections = < + item + Position1 = tp2CornerB + Position2 = tp4SideA + end + item + Position1 = tp2CornerE + Position2 = tp4SideE + end + item + Position1 = tp2SideF + Position2 = tp4SideC + end + item + Position1 = tp2SideF + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerE + Revenue = 50 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tp2CornerB + Revenue = 50 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tp2SideF + Revenue = 50 + RevenuePosition = tp3CornerC + end> + end + item + Code = 35 + LongName = '35' + Level = tlBrown + Connections = < + item + Position1 = tpCurve2LeftA + Position2 = tp4SideA + end + item + Position1 = tpCurve2LeftA + Position2 = tp4SideC + end + item + Position1 = tpCurve2RightD + Position2 = tp4SideD + end + item + Position1 = tpCurve2RightD + Position2 = tp4SideB + Layer = 2 + end> + Junctions = < + item + JunType = jtCity + Position = tpCurve2LeftA + Revenue = 40 + RevenuePosition = tp3SideF + end + item + JunType = jtCity + Position = tpCurve2RightD + Revenue = 40 + RevenuePosition = tp3SideE + end> + end + item + Code = 36 + LongName = '36' + Level = tlBrown + Connections = < + item + Position1 = tpCurve2LeftA + Position2 = tp4SideA + end + item + Position1 = tpCurve2LeftA + Position2 = tp4SideC + end + item + Position1 = tpCurve2LeftD + Position2 = tp4SideD + end + item + Position1 = tpCurve2LeftD + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Position = tpCurve2LeftA + Revenue = 40 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tpCurve2LeftD + Revenue = 40 + RevenuePosition = tp3CornerF + end> + end + item + Code = 37 + LongName = '37' + Level = tlBrown + Connections = < + item + Position1 = tp2CornerB + Position2 = tp4SideC + end + item + Position1 = tp2CornerE + Position2 = tp4SideF + end + item + Position1 = tp4SideC + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerB + Revenue = 40 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tp2CornerE + Revenue = 40 + RevenuePosition = tp3CornerF + end> + end + item + Code = 38 + LongName = '38' + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 40 + end> + end + item + Code = 1038 + LongName = '38/1830nl' + Category = 'X' + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 70 + end> + end + item + Code = 39 + LongName = '39' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideE + end + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideE + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 40 + LongName = '40' + Level = tlBrown + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideD + end + item + Position1 = tp4SideB + Position2 = tp4SideF + end + item + Position1 = tp4SideD + Position2 = tp4SideF + end> + Junctions = <> + end + item + Code = 41 + LongName = '41' + Level = tlBrown + Connections = < + item + Position1 = tp4SideE + Position2 = tp4SideA + end + item + Position1 = tp4SideE + Position2 = tp4SideD + end + item + Position1 = tp4SideA + Position2 = tp4SideD + end> + Junctions = <> + end + item + Code = 42 + LongName = '42' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideD + Position2 = tp4SideA + end + item + Position1 = tp4SideF + Position2 = tp4SideA + end> + Junctions = <> + end + item + Code = 43 + LongName = '43' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideD + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideF + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 44 + LongName = '44' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideA + end + item + Position1 = tp4SideB + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideD + Position2 = tp4SideE + Layer = 1 + end + item + Position1 = tp4SideB + Position2 = tp4SideE + Layer = 2 + end> + Junctions = <> + end + item + Code = 45 + LongName = '45' + Level = tlBrown + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideF + end + item + Position1 = tp4SideB + Position2 = tp4SideD + Layer = 1 + end + item + Position1 = tp4SideF + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideD + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 46 + LongName = '46' + Level = tlBrown + Connections = < + item + Position1 = tp4SideB + Position2 = tp4SideF + end + item + Position1 = tp4SideB + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideD + Position2 = tp4SideF + Layer = 1 + end + item + Position1 = tp4SideD + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 47 + LongName = '47' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideA + end + item + Position1 = tp4SideD + Position2 = tp4SideB + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideB + Layer = 2 + end> + Junctions = <> + end + item + Code = 48 + LongName = '48' + Category = 'LND' + CategoryPosition = tp1SideC + Level = tlGray + Connections = < + item + Position1 = tp3SideD + Position2 = tp4SideD + end + item + Position1 = tp3SideE + Position2 = tp4SideE + end + item + Position1 = tp3SideF + Position2 = tp4SideF + end + item + Position1 = tp3SideA + Position2 = tp4SideA + end + item + Position1 = tp3SideB + Position2 = tp4SideB + end + item + Position1 = tp3SideC + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Position = tp3SideD + Revenue = 100 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideE + Revenue = 100 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideF + Revenue = 100 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideA + Revenue = 100 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideB + Revenue = 100 + RevenuePosition = tpCenter + end + item + JunType = jtCity + Position = tp3SideC + Revenue = 100 + RevenuePosition = tpCenter + end> + end + item + Code = 49 + LongName = '49' + Category = 'L' + Level = tlGray + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtTripleCity + Revenue = 70 + end> + end + item + Code = 50 + LongName = '50' + Category = 'BGM' + Level = tlGray + Connections = < + item + Position1 = tp2SideF + Position2 = tp4SideC + end + item + Position1 = tp2SideF + Position2 = tp4SideF + end + item + Position1 = tp2CornerB + Position2 = tp4SideA + end + item + Position1 = tp2CornerB + Position2 = tp4SideB + end + item + Position1 = tp2CornerE + Position2 = tp4SideD + end + item + Position1 = tp2CornerE + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Position = tp2SideF + Revenue = 70 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tp2CornerB + Revenue = 70 + RevenuePosition = tp3CornerC + end + item + JunType = jtCity + Position = tp2CornerE + Revenue = 70 + RevenuePosition = tp3CornerC + end> + end + item + Code = 1050 + LongName = '50/1831' + Category = 'CC' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 50 + end> + end + item + Code = 51 + LongName = '51' + Level = tlGray + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 50 + end> + end + item + Code = 1051 + LongName = '51/1831' + Category = 'A' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 40 + end> + end + item + Code = 52 + LongName = '52' + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 30 + end> + end + item + Code = 1052 + LongName = '52/1825' + Level = tlGreen + Connections = < + item + Position1 = tp2CornerC + Position2 = tp4SideC + end + item + Position1 = tp2CornerF + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerC + Revenue = 40 + RevenuePosition = tp3CornerB + end + item + JunType = jtCity + Position = tp2CornerF + Revenue = 40 + end> + end + item + Code = 53 + LongName = '53' + Category = 'B' + CategoryPosition = tp3CornerC + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Revenue = 50 + RevenuePosition = tp3CornerB + end> + end + item + Code = 1053 + LongName = '53/1876' + Category = 'A' + CategoryPosition = tp3CornerB + Level = tlGreen + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtCity + Revenue = 50 + end> + end + item + Code = 54 + LongName = '54' + Category = 'NY' + CategoryPosition = tp3CornerC + Level = tlGreen + Connections = < + item + Position1 = tp2CornerE + Position2 = tp4SideD + end + item + Position1 = tp2CornerE + Position2 = tp4SideE + end + item + Position1 = tp2CornerA + Position2 = tp4SideF + end + item + Position1 = tp2CornerA + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerE + Revenue = 60 + RevenuePosition = tp3SideC + end + item + JunType = jtCity + Position = tp2CornerA + Revenue = 60 + RevenuePosition = tp3SideB + end> + end + item + Code = 55 + LongName = '55' + Level = tlYellow + Connections = < + item + Position1 = tp2SideC + Position2 = tp4SideC + end + item + Position1 = tp2SideC + Position2 = tp4SideF + end + item + Position1 = tp2SideD + Position2 = tp4SideD + Layer = 2 + end + item + Position1 = tp2SideD + Position2 = tp4SideA + Layer = 2 + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2SideC + Revenue = 10 + RevenuePosition = tp3CornerB + end + item + JunType = jtWhistlestop + Position = tp2SideD + Revenue = 10 + RevenuePosition = tp3CornerE + end> + end + item + Code = 56 + LongName = '56' + Level = tlYellow + Connections = < + item + Position1 = tpCurve2LeftB + Position2 = tp4SideB + end + item + Position1 = tpCurve2LeftB + Position2 = tp4SideD + end + item + Position1 = tpCurve2RightE + Position2 = tp4SideE + Layer = 2 + end + item + Position1 = tpCurve2RightE + Position2 = tp4SideC + Layer = 2 + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tpCurve2RightE + Revenue = 10 + RevenuePosition = tp3CornerE + end + item + JunType = jtWhistlestop + Position = tpCurve2LeftB + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 57 + LongName = '57' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtCity + Revenue = 20 + RevenuePosition = tp3CornerB + end> + end + item + Code = 58 + LongName = '58' + Level = tlYellow + Connections = < + item + Position1 = tp1SideE + Position2 = tp4SideF + end + item + Position1 = tp1SideE + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp1SideE + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 59 + LongName = '59' + Category = 'OO' + CategoryPosition = tp3CornerC + Level = tlGreen + Connections = < + item + Position1 = tp2CornerB + Position2 = tp4SideB + end + item + Position1 = tp2CornerE + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Position = tp2CornerB + Revenue = 40 + end + item + JunType = jtCity + Position = tp2CornerE + Revenue = 40 + RevenuePosition = tp3CornerF + end> + end + item + Code = 1059 + LongName = '59/1829' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Revenue = 20 + end> + end + item + Code = 60 + LongName = '60' + Level = tlGray + Connections = < + item + Position1 = tp4SideC + Position2 = tpCenter + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideD + end> + Junctions = <> + end + item + Code = 61 + LongName = '61' + Category = 'B' + CategoryPosition = tp3CornerC + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtCity + Revenue = 60 + RevenuePosition = tp3CornerB + end> + end + item + Code = 62 + LongName = '62' + Category = 'NY' + CategoryPosition = tp3CornerC + Level = tlBrown + Connections = < + item + Position1 = tp2SideD + Position2 = tp4SideD + end + item + Position1 = tp2SideD + Position2 = tp4SideE + end + item + Position1 = tp2SideA + Position2 = tp4SideF + end + item + Position1 = tp2SideA + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtDoubleCity + Position = tp2SideD + Revenue = 80 + RevenuePosition = tp3CornerF + end + item + JunType = jtDoubleCity + Position = tp2SideA + Revenue = 80 + RevenuePosition = tp3CornerF + end> + end + item + Code = 63 + LongName = '63' + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 40 + end> + end + item + Code = 1063 + LongName = '63/1876' + Category = 'A' + CategoryPosition = tp3CornerB + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end + item + Position1 = tpCenter + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 40 + end> + end + item + Code = 2063 + LongName = '62/1876bis' + Category = 'A' + CategoryPosition = tp3CornerB + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 60 + end> + end + item + Code = 64 + LongName = '64' + Category = 'OO' + CategoryPosition = tp3CornerC + Level = tlBrown + Connections = < + item + Position1 = tp1SideE + Position2 = tp4SideD + end + item + Position1 = tp1SideE + Position2 = tp4SideF + end + item + Position1 = tp2CornerB + Position2 = tp4SideB + end + item + Position1 = tp2CornerB + Position2 = tp4SideA + end> + Junctions = < + item + JunType = jtCity + Position = tp1SideE + Revenue = 50 + RevenuePosition = tp3CornerF + end + item + JunType = jtCity + Position = tp2CornerB + Revenue = 50 + end> + end + item + Code = 65 + LongName = '65' + Category = 'OO' + CategoryPosition = tp3CornerB + Level = tlBrown + Connections = < + item + Position1 = tp1SideF + Position2 = tp4SideE + end + item + Position1 = tp1SideF + Position2 = tp4SideA + end + item + Position1 = tp2CornerD + Position2 = tp4SideC + end + item + Position1 = tp2CornerD + Position2 = tp4SideD + end> + Junctions = < + item + JunType = jtCity + Position = tp1SideF + Revenue = 50 + end + item + JunType = jtCity + Position = tp2CornerD + Revenue = 50 + RevenuePosition = tp3CornerC + end> + end + item + Code = 66 + LongName = '66' + Category = 'OO' + CategoryPosition = tp3CornerC + Level = tlBrown + Connections = < + item + Position1 = tp2SideA + Position2 = tp4SideD + end + item + Position1 = tp2SideA + Position2 = tp4SideA + end + item + Position1 = tp2CornerF + Position2 = tp4SideE + end + item + Position1 = tp2CornerF + Position2 = tp4SideF + end> + Junctions = < + item + JunType = jtCity + Position = tp2SideA + Revenue = 50 + end + item + JunType = jtCity + Position = tp2CornerF + Revenue = 50 + RevenuePosition = tp3CornerE + end> + end + item + Code = 67 + LongName = '67' + Category = 'OO' + CategoryPosition = tp3CornerB + Level = tlBrown + Connections = < + item + Position1 = tpCurve2RightD + Position2 = tp4SideB + end + item + Position1 = tpCurve2RightD + Position2 = tp4SideD + end + item + Position1 = tp2SideF + Position2 = tp4SideF + end + item + Position1 = tp2SideF + Position2 = tp4SideC + Layer = 2 + end> + Junctions = < + item + JunType = jtCity + Position = tpCurve2RightD + Revenue = 50 + RevenuePosition = tp3CornerE + end + item + JunType = jtCity + Position = tp2SideF + Revenue = 50 + RevenuePosition = tp3CornerF + end> + end + item + Code = 1067 + LongName = '67/1825u1' + Level = tlOffMap + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end + item + Position1 = tpCenter + Position2 = tp4SideD + end + item + Position1 = tpCenter + Position2 = tp4SideE + end> + Junctions = < + item + JunType = jtDoubleCity + Revenue = 40 + end> + end + item + Code = 68 + LongName = '68' + Category = 'OO' + CategoryPosition = tp3CornerC + Level = tlBrown + Connections = < + item + Position1 = tp2SideD + Position2 = tp4SideD + end + item + Position1 = tp2SideF + Position2 = tp4SideC + end + item + Position1 = tp2SideF + Position2 = tp4SideF + end + item + Position1 = tp2SideD + Position2 = tp4SideA + Layer = 2 + end> + Junctions = < + item + JunType = jtCity + Position = tp2SideD + Revenue = 50 + RevenuePosition = tp3CornerE + end + item + JunType = jtCity + Position = tp2SideF + Revenue = 50 + end> + end + item + Code = 69 + LongName = '69' + Level = tlYellow + Connections = < + item + Position1 = tpCurve2RightE + Position2 = tp4SideC + end + item + Position1 = tpCurve2RightE + Position2 = tp4SideE + end + item + Position1 = tp2SideA + Position2 = tp4SideA + Layer = 2 + end + item + Position1 = tp2SideA + Position2 = tp4SideD + Layer = 2 + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tpCurve2RightE + Revenue = 10 + RevenuePosition = tp3CornerE + end + item + JunType = jtWhistlestop + Position = tp2SideA + Revenue = 10 + RevenuePosition = tp3CornerB + end> + end + item + Code = 1069 + LongName = '69/1853' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtCity + Revenue = 20 + end> + end + item + Code = 70 + LongName = '70' + Level = tlBrown + Connections = < + item + Position1 = tp4SideD + Position2 = tp4SideF + end + item + Position1 = tp4SideD + Position2 = tp4SideE + Layer = 1 + end + item + Position1 = tp4SideF + Position2 = tp4SideA + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideA + Layer = 2 + end> + Junctions = <> + end + item + Code = 71 + LongName = '71' + Level = tlYellow + Connections = < + item + Position1 = tpCurve2LeftC + Position2 = tpCurve2RightE + ConType = ctSmall + end + item + Position1 = tpCurve2LeftC + Position2 = tp4SideC + ConType = ctSmall + end + item + Position1 = tpCurve2RightE + Position2 = tp4SideE + ConType = ctSmall + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tpCurve2LeftC + Revenue = 10 + RevenuePosition = tp3CornerC + end + item + JunType = jtWhistlestop + Position = tpCurve2RightE + Revenue = 10 + RevenuePosition = tp3CornerF + end> + end + item + Code = 2071 + LongName = '71/1869AM' + Level = tlBrown + Connections = < + item + Position1 = tp4SideE + Position2 = tp4SideC + end + item + Position1 = tp4SideE + Position2 = tp4SideD + Layer = 1 + end + item + Position1 = tp4SideD + Position2 = tp4SideC + Layer = 1 + end + item + Position1 = tp4SideC + Position2 = tp4SideF + Layer = 1 + end + item + Position1 = tp4SideF + Position2 = tp4SideD + Layer = 2 + end> + Junctions = <> + end + item + Code = 72 + LongName = '72' + Level = tlYellow + Connections = < + item + Position1 = tp2CornerD + Position2 = tp4SideC + ConType = ctSmall + end + item + Position1 = tp2CornerD + Position2 = tp4SideD + ConType = ctSmall + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2CornerD + Revenue = 10 + RevenuePosition = tp3CornerC + end> + end + item + Code = 1072 + LongName = '72/1831' + Category = 'CC' + Level = tlBrown + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideF + end + item + Position1 = tpCenter + Position2 = tp4SideA + end + item + Position1 = tpCenter + Position2 = tp4SideB + end + item + Position1 = tpCenter + Position2 = tp4SideC + end> + Junctions = < + item + JunType = jtTripleCity + Revenue = 80 + end> + end + item + Code = 2072 + LongName = '72/1869AM' + Level = tlBrown + Connections = < + item + Position1 = tp4SideE + Position2 = tp4SideC + end + item + Position1 = tp4SideE + Position2 = tp4SideF + Layer = 1 + end + item + Position1 = tp4SideE + Position2 = tp4SideD + Layer = 1 + end + item + Position1 = tp4SideF + Position2 = tp4SideC + Layer = 1 + end + item + Position1 = tp4SideF + Position2 = tp4SideD + Layer = 2 + end> + Junctions = <> + end + item + Code = 73 + LongName = '73' + Level = tlYellow + Connections = < + item + Position1 = tp1SideD + Position2 = tp4SideC + ConType = ctSmall + end + item + Position1 = tp1SideD + Position2 = tp4SideE + ConType = ctSmall + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp1SideD + Revenue = 10 + RevenuePosition = tp3CornerF + end> + end + item + Code = 2073 + LongName = '73/1869AM' + Level = tlBrown + Connections = < + item + Position1 = tp4SideC + Position2 = tp4SideB + end + item + Position1 = tp4SideC + Position2 = tp4SideF + end + item + Position1 = tp4SideC + Position2 = tp4SideE + end> + Junctions = <> + end + item + Code = 74 + LongName = '74' + Level = tlYellow + Connections = < + item + Position1 = tp2SideF + Position2 = tp4SideC + ConType = ctSmall + end + item + Position1 = tp2SideF + Position2 = tp4SideF + ConType = ctSmall + end> + Junctions = < + item + JunType = jtWhistlestop + Position = tp2SideF + Revenue = 10 + RevenuePosition = tp3CornerF + end> + end + item + Code = 2074 + LongName = '74/1869AM' + Level = tlBrown + Connections = < + item + Position1 = tp4SideC + Position2 = tp4SideD + end + item + Position1 = tp4SideC + Position2 = tp4SideF + end + item + Position1 = tp4SideC + Position2 = tp4SideA + end> + Junctions = <> + end + item + Code = 75 + LongName = '75' + Level = tlYellow + Connections = < + item + Position1 = tpCenter + Position2 = tp4SideB + ConType = ctSmall + end + item + Position1 = tpCenter + Position2 = tp4SideC + ConType = ctSmall + end> + Junct... [truncated message content] |
From: <ev...@us...> - 2011-06-26 15:22:18
|
Revision: 1591 http://rails.svn.sourceforge.net/rails/?rev=1591&view=rev Author: evos Date: 2011-06-26 15:22:12 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Removed Paths: ------------- trunk/18xx/tiles/TileDictionary.18t Deleted: trunk/18xx/tiles/TileDictionary.18t =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-26 15:09:20
|
Revision: 1590 http://rails.svn.sourceforge.net/rails/?rev=1590&view=rev Author: evos Date: 2011-06-26 15:09:14 +0000 (Sun, 26 Jun 2011) Log Message: ----------- 18GA: last fine details Modified Paths: -------------- trunk/18xx/data/18GA/TileSet.xml trunk/18xx/data/18GA/Tiles.xml trunk/18xx/data/GamesList.xml trunk/18xx/tiles/TileDictionary.xml trunk/18xx/tiles/Tiles.xml trunk/18xx/tiles/svg/tile1455.svg Modified: trunk/18xx/data/18GA/TileSet.xml =================================================================== --- trunk/18xx/data/18GA/TileSet.xml 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/data/18GA/TileSet.xml 2011-06-26 15:09:14 UTC (rev 1590) @@ -49,14 +49,18 @@ <Tile id="5" quantity="2"> <Upgrade id="14,15" hex="-D10,G13" /> <Upgrade id="1453" hex="D10" /> - <Upgrade id="1454" hex="G13" /> + <IfOption name="Variant" value="Basegame"> + <Upgrade id="1454" hex="G13" /> + </IfOption> </Tile> <!-- Gentle-curve city (20) --> <Tile id="6" quantity="2"> <Upgrade id="14,15" hex="-D10,G13" /> <Upgrade id="1453" hex="D10" /> - <Upgrade id="1454" hex="G13" /> + <IfOption name="Variant" value="Basegame"> + <Upgrade id="1454" hex="G13" /> + </IfOption> </Tile> <!-- Sharp curve --> @@ -78,7 +82,9 @@ <Tile id="57" quantity="4"> <Upgrade id="14,15" hex="-D10,-G13" /> <Upgrade id="1453" hex="D10" /> - <Upgrade id="1454" hex="G13" /> + <IfOption name="Variant" value="Basegame"> + <Upgrade id="1454" hex="G13" /> + </IfOption> </Tile> <!-- Gentle-curve dit (10) --> @@ -181,10 +187,12 @@ <Upgrade id="1456" /> </Tile> - <!-- City (30), exits N,NW,SW, "Savannah" --> - <Tile id="1454" extId="454" quantity="1"> - <Upgrade id="1459" /> - </Tile> + <IfOption name="Variant" value="Basegame"> + <!-- City (30), exits N,NW,SW, "Savannah" --> + <Tile id="1454" extId="454" quantity="1"> + <Upgrade id="1459" /> + </Tile> + </IfOption> <!-- Brown Tiles --> @@ -233,7 +241,9 @@ <!-- 5-way city (50), "Macon" --> <Tile id="1458" extId="458" quantity="1" /> - <!-- City (60), exits N,NW,SW, "Savannah" --> - <Tile id="1459" extId="459" quantity="1" /> + <IfOption name="Variant" value="Basegame"> + <!-- City (60), exits N,NW,SW, "Savannah" --> + <Tile id="1459" extId="459" quantity="1" /> + </IfOption> </TileManager> Modified: trunk/18xx/data/18GA/Tiles.xml =================================================================== --- trunk/18xx/data/18GA/Tiles.xml 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/data/18GA/Tiles.xml 2011-06-26 15:09:14 UTC (rev 1590) @@ -13,7 +13,7 @@ <Track from="city1" gauge="normal" to="side1"/> </Tile> <Tile colour="fixed" id="-1143" name="Bham1851"> - <Station id="city1" position="0" type="City"/> + <Station id="city1" position="0" type="Town"/> <Track from="side5" gauge="normal" to="city1"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side1"/> @@ -248,9 +248,9 @@ <Track from="side4" gauge="normal" to="side0"/> </Tile> <Tile colour="brown" id="1455" name="GA455"> - <Station id="city1" position="502" slots="1" type="City" value="60"/> - <Station id="city2" position="102" slots="1" type="City" value="60"/> - <Station id="city3" position="302" slots="1" type="City" value="60"/> + <Station id="city1" position="502" slots="1" type="City" value="70"/> + <Station id="city2" position="102" slots="1" type="City" value="70"/> + <Station id="city3" position="302" slots="1" type="City" value="70"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> @@ -274,7 +274,7 @@ <Track from="city1" gauge="normal" to="side4"/> </Tile> <Tile colour="brown" id="1458" name="GA458"> - <Station id="city1" position="0" slots="1" type="City" value="50"/> + <Station id="city1" position="0" slots="2" type="City" value="50"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side3"/> Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/data/GamesList.xml 2011-06-26 15:09:14 UTC (rev 1590) @@ -128,7 +128,6 @@ Published 2004 by Deep Thought Games, LLC Not yet implemented: -- High mountain yellow to green upgrade cost ($60) - Bankruptcy rules (game currently hangs when a player goes bankrupt) </Description> <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> @@ -140,6 +139,21 @@ <Players minimum="2" maximum="6"/> </Game> + <Game name="18GA"> + <Note>Fully Playable</Note> + <Description>18GA - The Railroads Come to Georgia + Copyright 2000, 2007, Mark Derrick and John David Galt</Description> + <Option name="Variant" values="Basegame,Cotton Port" default="Basegame" /> + <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> + <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> + <Option name="NoMapMode" type="toggle" default="no" /> + <Option name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/> + <Option name="UnlimitedTiles" type="toggle" default="no"/> + <Option name="LeaveAuctionOnPass" type="toggle" default="no"/> + <Option name="TwoPlayersCertLimit70Percent" type="toggle" default="no"/> + <Players minimum="2" maximum="5"/> + </Game> + <Game name="18Kaas"> <Note>Fully playable</Note> <Description>18Kaas (Netherlands) @@ -250,7 +264,7 @@ </Game> <Game name="1826"> <Note>Prototype</Note> - <Description>1826</Description> + <Description>1826 - Railroading in France and Belgium from 1826</Description> <Players minimum="2" maximum="6" /> </Game> <Game name="18JR"> @@ -275,22 +289,10 @@ <Description>18VA</Description> <Players minimum="2" maximum="5" /> </Game> - <Game name="18GA"> - <Note>Prototype</Note> - <Description>18GA</Description> - <Option name="Variant" values="Basegame,Cotton Port" default="Basegame" /> - <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> - <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> - <Option name="NoMapMode" type="toggle" default="no" /> - <Option name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/> - <Option name="UnlimitedTiles" type="toggle" default="no"/> - <Option name="LeaveAuctionOnPass" type="toggle" default="no"/> - <Option name="TwoPlayersCertLimit70Percent" type="toggle" default="no"/> - <Players minimum="2" maximum="5"/> - </Game> + <Game name="18TN"> <Note>Prototype</Note> - <Description>18TN</Description> + <Description>18TN - The Railroads Come to Tennessee</Description> <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> <Option name="NoMapMode" type="toggle" default="no" /> Modified: trunk/18xx/tiles/TileDictionary.xml =================================================================== --- trunk/18xx/tiles/TileDictionary.xml 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/tiles/TileDictionary.xml 2011-06-26 15:09:14 UTC (rev 1590) @@ -10938,7 +10938,7 @@ <junType>jtCity</junType> <position>tp2SideF</position> <revenue> - <value>60</value> + <value>70</value> <position>tp3CornerE</position> </revenue> </junction> @@ -10946,7 +10946,7 @@ <junType>jtCity</junType> <position>tp2SideB</position> <revenue> - <value>60</value> + <value>70</value> <position>tp3CornerE</position> </revenue> </junction> @@ -10954,7 +10954,7 @@ <junType>jtCity</junType> <position>tp2SideD</position> <revenue> - <value>60</value> + <value>70</value> <position>tp3CornerE</position> </revenue> </junction> @@ -23926,7 +23926,7 @@ <ID>-26002</ID> <shape>tsHexagon</shape> <level>tlMapFixed</level> - <name>Nantes/Strasbourg</name> + <name>Nantes/Sstrasbourg</name> <junctions> <junction> <junType>jtCity</junType> @@ -23988,136 +23988,4 @@ </connection> </connections> </tile> - <tile> - <ID>-26004</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToGreen</level> - <name>Lille</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tpCenter</position> - <revenue> - <value>20</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideE</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-26005</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToGreen</level> - <name>Orleans</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tpCenter</position> - <revenue> - <value>20</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideA</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-26006</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToBrown</level> - <name>Brussels</name> - <junctions> - <junction> - <junType>jtDoubleCity</junType> - <position>tpCenter</position> - <revenue> - <value>30</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideF</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-26007</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToBrown</level> - <name>Lyon</name> - <junctions> - <junction> - <junType>jtDoubleCity</junType> - <position>tpCenter</position> - <revenue> - <value>30</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideA</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideF</position2> - </connection> - </connections> - </tile> -</tiles> \ No newline at end of file +</tiles> Modified: trunk/18xx/tiles/Tiles.xml =================================================================== --- trunk/18xx/tiles/Tiles.xml 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/tiles/Tiles.xml 2011-06-26 15:09:14 UTC (rev 1590) @@ -1912,9 +1912,9 @@ <Track from="city1" gauge="normal" to="side4"/> </Tile> <Tile colour="brown" id="1455" name="GA455"> - <Station id="city1" position="502" slots="1" type="City" value="60"/> - <Station id="city2" position="102" slots="1" type="City" value="60"/> - <Station id="city3" position="302" slots="1" type="City" value="60"/> + <Station id="city1" position="502" slots="1" type="City" value="70"/> + <Station id="city2" position="102" slots="1" type="City" value="70"/> + <Station id="city3" position="302" slots="1" type="City" value="70"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> @@ -4196,7 +4196,7 @@ <Track from="city5" gauge="normal" to="side4"/> <Track from="city6" gauge="normal" to="side5"/> </Tile> - <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg"> + <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg"> <Station id="city1" position="0" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side1"/> @@ -4208,28 +4208,4 @@ <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side3"/> </Tile> - <Tile colour="yellow" id="-26004" name="Lille"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side3"/> - </Tile> - <Tile colour="yellow" id="-26005" name="Orleans"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side3"/> - </Tile> - <Tile colour="green" id="-26006" name="Brussels"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile> - <Tile colour="green" id="-26007" name="Lyon"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile> </Tiles> \ No newline at end of file Modified: trunk/18xx/tiles/svg/tile1455.svg =================================================================== --- trunk/18xx/tiles/svg/tile1455.svg 2011-06-26 08:53:32 UTC (rev 1589) +++ trunk/18xx/tiles/svg/tile1455.svg 2011-06-26 15:09:14 UTC (rev 1590) @@ -1,2 +1,2 @@ <?xml version="1.0"?> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#B46301" stroke="#B46301" stroke-width="1" stroke-linejoin="round"/><text x="245" y="318" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Arial" font-size="34">1455</text><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 269,128 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><text x="183" y="49" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="TimpaniHeavy" font-size="51">Atla nta</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#B46301" stroke="#B46301" stroke-width="1" stroke-linejoin="round"/><text x="245" y="318" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Arial" font-size="34" font-weight="bold">1455</text><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 269,128 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><text x="183" y="49" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="TimpaniHeavy" font-size="51">Atla nta</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-26 08:53:38
|
Revision: 1589 http://rails.svn.sourceforge.net/rails/?rev=1589&view=rev Author: evos Date: 2011-06-26 08:53:32 +0000 (Sun, 26 Jun 2011) Log Message: ----------- 1826: layable tiles Modified Paths: -------------- trunk/18xx/data/1826/TileSet.xml trunk/18xx/data/1826/Tiles.xml Modified: trunk/18xx/data/1826/TileSet.xml =================================================================== --- trunk/18xx/data/1826/TileSet.xml 2011-06-25 15:42:33 UTC (rev 1588) +++ trunk/18xx/data/1826/TileSet.xml 2011-06-26 08:53:32 UTC (rev 1589) @@ -17,4 +17,50 @@ <Tile id="-103"/> <Tile id="-105"/> + <Tile id="3" quantity="2"/> + <Tile id="4" quantity="6"/> + <Tile id="5" quantity="2"/> + <Tile id="6" quantity="2"/> + <Tile id="7" quantity="4"/> + <Tile id="8" quantity="16"/> + <Tile id="9" quantity="21"/> + <Tile id="57" quantity="4"/> + <Tile id="58" quantity="6"/> + <Tile id="14" quantity="3"/> + <Tile id="15" quantity="3"/> + <Tile id="16" quantity="1"/> + <Tile id="19" quantity="1"/> + <Tile id="20" quantity="1"/> + <Tile id="23" quantity="5"/> + <Tile id="24" quantity="5"/> + <Tile id="25" quantity="3"/> + <Tile id="26" quantity="1"/> + <Tile id="27" quantity="1"/> + <Tile id="28" quantity="1"/> + <Tile id="29" quantity="1"/> + <Tile id="87" quantity="2"/> + <Tile id="88" quantity="2"/> + <Tile id="141" quantity="1"/> + <Tile id="142" quantity="1"/> + <Tile id="143" quantity="1"/> + <Tile id="203" quantity="1"/> + <Tile id="204" quantity="2"/> + <Tile id="514" quantity="1"/> + <Tile id="619" quantity="3"/> + <Tile id="39" quantity="1"/> + <Tile id="40" quantity="1"/> + <Tile id="41" quantity="2"/> + <Tile id="42" quantity="2"/> + <Tile id="43" quantity="3"/> + <Tile id="44" quantity="1"/> + <Tile id="45" quantity="2"/> + <Tile id="46" quantity="2"/> + <Tile id="47" quantity="3"/> + <Tile id="63" quantity="5"/> + <Tile id="70" quantity="1"/> + <Tile id="515" quantity="1"/> + <Tile id="611" quantity="2"/> + <Tile id="513" quantity="3"/> + <Tile id="516" quantity="1"/> + </TileManager> Modified: trunk/18xx/data/1826/Tiles.xml =================================================================== --- trunk/18xx/data/1826/Tiles.xml 2011-06-25 15:42:33 UTC (rev 1588) +++ trunk/18xx/data/1826/Tiles.xml 2011-06-26 08:53:32 UTC (rev 1589) @@ -82,4 +82,273 @@ <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side3"/> </Tile> + <Tile colour="yellow" id="3" name="3"> + <Station id="city1" position="452" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + </Tile> + <Tile colour="yellow" id="4" name="4"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="5" name="5"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="6" name="6"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="7" name="7"> + <Track from="side3" gauge="normal" to="side4"/> + </Tile> + <Tile colour="yellow" id="8" name="8"> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="yellow" id="9" name="9"> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="57" name="57"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="58" name="58"> + <Station id="city1" position="401" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="14" name="14"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="15" name="15"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="16" name="16"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="19" name="19"> + <Track from="side5" gauge="normal" to="side1"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="20" name="20"> + <Track from="side1" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="23" name="23"> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="24" name="24"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="25" name="25"> + <Track from="side1" gauge="normal" to="side3"/> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="26" name="26"> + <Track from="side5" gauge="normal" to="side0"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="27" name="27"> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="28" name="28"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="29" name="29"> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="87" name="87"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="88" name="88"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="141" name="141"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="142" name="142"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="143" name="143"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="green" id="203" name="203"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + </Tile> + <Tile colour="green" id="204" name="204"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="514" name="514"> + <Station id="city1" position="503" slots="1" type="City" value="70"/> + <Station id="city2" position="003" slots="1" type="City" value="70"/> + <Station id="city3" position="103" slots="1" type="City" value="70"/> + <Station id="city4" position="203" slots="1" type="City" value="70"/> + <Station id="city5" position="303" slots="1" type="City" value="70"/> + <Station id="city6" position="403" slots="1" type="City" value="70"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side0"/> + <Track from="city3" gauge="normal" to="side1"/> + <Track from="city4" gauge="normal" to="side2"/> + <Track from="city5" gauge="normal" to="side3"/> + <Track from="city6" gauge="normal" to="side4"/> + </Tile> + <Tile colour="green" id="619" name="619"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="39" name="39"> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="40" name="40"> + <Track from="side1" gauge="normal" to="side3"/> + <Track from="side1" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="41" name="41"> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side3"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="brown" id="42" name="42"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side5" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="43" name="43"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="44" name="44"> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side1" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side1" gauge="normal" to="side4"/> + </Tile> + <Tile colour="brown" id="45" name="45"> + <Track from="side1" gauge="normal" to="side5"/> + <Track from="side1" gauge="normal" to="side3"/> + <Track from="side5" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="46" name="46"> + <Track from="side1" gauge="normal" to="side5"/> + <Track from="side1" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="47" name="47"> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side1"/> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side1"/> + </Tile> + <Tile colour="brown" id="63" name="63"> + <Station id="city1" position="0" slots="2" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="70" name="70"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side5" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="515" name="515"> + <Station id="city1" position="503" slots="1" type="City" value="90"/> + <Station id="city2" position="003" slots="1" type="City" value="90"/> + <Station id="city3" position="103" slots="1" type="City" value="90"/> + <Station id="city4" position="203" slots="1" type="City" value="90"/> + <Station id="city5" position="303" slots="1" type="City" value="90"/> + <Station id="city6" position="403" slots="1" type="City" value="90"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side0"/> + <Track from="city3" gauge="normal" to="side1"/> + <Track from="city4" gauge="normal" to="side2"/> + <Track from="city5" gauge="normal" to="side3"/> + <Track from="city6" gauge="normal" to="side4"/> + </Tile> + <Tile colour="brown" id="611" name="611"> + <Station id="city1" position="0" slots="2" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="gray" id="513" name="513"> + <Station id="city1" position="0" slots="3" type="City" value="60"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="gray" id="516" name="516"> + <Station id="city1" position="503" slots="1" type="City" value="120"/> + <Station id="city2" position="003" slots="1" type="City" value="120"/> + <Station id="city3" position="103" slots="1" type="City" value="120"/> + <Station id="city4" position="203" slots="1" type="City" value="120"/> + <Station id="city5" position="303" slots="1" type="City" value="120"/> + <Station id="city6" position="403" slots="1" type="City" value="120"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side0"/> + <Track from="city3" gauge="normal" to="side1"/> + <Track from="city4" gauge="normal" to="side2"/> + <Track from="city5" gauge="normal" to="side3"/> + <Track from="city6" gauge="normal" to="side4"/> + </Tile> </Tiles> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-25 15:42:40
|
Revision: 1588 http://rails.svn.sourceforge.net/rails/?rev=1588&view=rev Author: evos Date: 2011-06-25 15:42:33 +0000 (Sat, 25 Jun 2011) Log Message: ----------- 1826 more preprinted tiles Added Paths: ----------- trunk/18xx/tiles/svg/tile-26004.svg trunk/18xx/tiles/svg/tile-26005.svg trunk/18xx/tiles/svg/tile-26006.svg trunk/18xx/tiles/svg/tile-26007.svg Added: trunk/18xx/tiles/svg/tile-26004.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26004.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26004.svg 2011-06-25 15:42:33 UTC (rev 1588) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">20</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> Added: trunk/18xx/tiles/svg/tile-26005.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26005.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26005.svg 2011-06-25 15:42:33 UTC (rev 1588) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">20</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> Added: trunk/18xx/tiles/svg/tile-26006.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26006.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26006.svg 2011-06-25 15:42:33 UTC (rev 1588) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#38AC00" stroke="#38AC00" stroke-width="1" stroke-linejoin="round"/><polygon points="145,119 247,119 247,221 145,221" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="145" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="247" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><polygon points="145,119 247,119 247,221 145,221" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><circle cx="145" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><circle cx="247" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> Added: trunk/18xx/tiles/svg/tile-26007.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26007.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26007.svg 2011-06-25 15:42:33 UTC (rev 1588) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#38AC00" stroke="#38AC00" stroke-width="1" stroke-linejoin="round"/><polygon points="145,119 247,119 247,221 145,221" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="145" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="247" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><polygon points="145,119 247,119 247,221 145,221" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><circle cx="145" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><circle cx="247" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-25 15:37:48
|
Revision: 1587 http://rails.svn.sourceforge.net/rails/?rev=1587&view=rev Author: evos Date: 2011-06-25 15:37:42 +0000 (Sat, 25 Jun 2011) Log Message: ----------- 1826 more preprinted tiles Modified Paths: -------------- trunk/18xx/tiles/TileDictionary.18t Modified: trunk/18xx/tiles/TileDictionary.18t =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-25 15:37:07
|
Revision: 1586 http://rails.svn.sourceforge.net/rails/?rev=1586&view=rev Author: evos Date: 2011-06-25 15:37:01 +0000 (Sat, 25 Jun 2011) Log Message: ----------- 1826 more preprinted tiles Modified Paths: -------------- trunk/18xx/data/1826/Map.xml trunk/18xx/data/1826/TileSet.xml trunk/18xx/data/1826/Tiles.xml trunk/18xx/tiles/TileDictionary.xml trunk/18xx/tiles/Tiles.xml Modified: trunk/18xx/data/1826/Map.xml =================================================================== --- trunk/18xx/data/1826/Map.xml 2011-06-25 14:14:47 UTC (rev 1585) +++ trunk/18xx/data/1826/Map.xml 2011-06-25 15:37:01 UTC (rev 1586) @@ -7,8 +7,8 @@ <Hex name="B12" tile="-10" city="Antwerp" cost="40"/> <Hex name="B14" tile="0" cost="40"/> <Hex name="C9" tile="-1" city="Calais"/> - <Hex name="C11" tile="5" city="Lille" orientation="2"/> - <Hex name="C13" tile="619" city="Brussels" orientation="3"/> + <Hex name="C11" tile="-26004" city="Lille"/> + <Hex name="C13" tile="-26006" city="Brussels"/> <Hex name="C15" tile="-10" city="Liège" cost="40"/> <Hex name="C17" tile="-902" city="Cologne" value="20,40,60,100" orientation="2"/> <Hex name="D8" tile="0"/> @@ -51,7 +51,7 @@ <Hex name="I1" tile="-26002" city="Nantes"/> <Hex name="I3" tile="-1" city="Angers" cost="40"/> <Hex name="I5" tile="0" cost="40"/> - <Hex name="I7" tile="57" city="Orléans"/> + <Hex name="I7" tile="-26005" city="Orléans"/> <Hex name="I9" tile="0"/> <Hex name="I11" tile="0"/> <Hex name="I13" tile="-10" city="Dijon"/> @@ -79,7 +79,7 @@ <Hex name="L8" tile="-1" city="Limoges"/> <Hex name="L10" tile="0" cost="60"/> <Hex name="L12" tile="0" cost="60"/> - <Hex name="L14" tile="14" city="Lyon" orientation="5"/> + <Hex name="L14" tile="-26007" city="Lyon"/> <Hex name="L16" tile="0"/> <Hex name="M3" tile="-26003" city="Bordeaux"/> <Hex name="M5" tile="0" cost="40"/> Modified: trunk/18xx/data/1826/TileSet.xml =================================================================== --- trunk/18xx/data/1826/TileSet.xml 2011-06-25 14:14:47 UTC (rev 1585) +++ trunk/18xx/data/1826/TileSet.xml 2011-06-25 15:37:01 UTC (rev 1586) @@ -4,16 +4,16 @@ <Tile id="0"/> <Tile id="-1"/> <Tile id="-10"/> - <Tile id="57"/> <Tile id="-901"/> <Tile id="-902"/> <Tile id="-903"/> - <Tile id="14"/> - <Tile id="619"/> - <Tile id="5"/> <Tile id="-26001"/> <Tile id="-26002"/> <Tile id="-26003"/> + <Tile id="-26004"/> + <Tile id="-26005"/> + <Tile id="-26006"/> + <Tile id="-26007"/> <Tile id="-103"/> <Tile id="-105"/> Modified: trunk/18xx/data/1826/Tiles.xml =================================================================== --- trunk/18xx/data/1826/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585) +++ trunk/18xx/data/1826/Tiles.xml 2011-06-25 15:37:01 UTC (rev 1586) @@ -7,11 +7,6 @@ <Tile colour="white" id="-10" name="1 city"> <Station id="city1" position="302" slots="1" type="City"/> </Tile> - <Tile colour="yellow" id="57" name="57"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile> <Tile colour="red" id="-901" name="OM 1 way"> <Station id="city1" position="0" type="OffMapCity" value="-1"/> <Track from="city1" gauge="normal" to="side2"/> @@ -27,25 +22,6 @@ <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side1"/> </Tile> - <Tile colour="green" id="14" name="14"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="619" name="619"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile> - <Tile colour="yellow" id="5" name="5"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile> <Tile colour="yellow" id="-26001" name="Paris"> <Station id="city1" position="003" slots="1" type="City" value="50"/> <Station id="city2" position="103" slots="1" type="City" value="50"/> @@ -60,7 +36,7 @@ <Track from="city5" gauge="normal" to="side4"/> <Track from="city6" gauge="normal" to="side5"/> </Tile> - <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg"> + <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg"> <Station id="city1" position="0" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side1"/> @@ -72,6 +48,30 @@ <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side3"/> </Tile> + <Tile colour="yellow" id="-26004" name="Lille"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="yellow" id="-26005" name="Orleans"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="-26006" name="Brussels"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="-26007" name="Lyon"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> <Tile colour="fixed" id="-103" name="MF 103"> <Station id="city1" position="0" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side2"/> Modified: trunk/18xx/tiles/TileDictionary.xml =================================================================== --- trunk/18xx/tiles/TileDictionary.xml 2011-06-25 14:14:47 UTC (rev 1585) +++ trunk/18xx/tiles/TileDictionary.xml 2011-06-25 15:37:01 UTC (rev 1586) @@ -23926,7 +23926,7 @@ <ID>-26002</ID> <shape>tsHexagon</shape> <level>tlMapFixed</level> - <name>Nantes/Sstrasbourg</name> + <name>Nantes/Strasbourg</name> <junctions> <junction> <junType>jtCity</junType> @@ -23988,4 +23988,136 @@ </connection> </connections> </tile> + <tile> + <ID>-26004</ID> + <shape>tsHexagon</shape> + <level>tlMapUpgradableToGreen</level> + <name>Lille</name> + <junctions> + <junction> + <junType>jtCity</junType> + <position>tpCenter</position> + <revenue> + <value>20</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideE</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideD</position2> + </connection> + </connections> + </tile> + <tile> + <ID>-26005</ID> + <shape>tsHexagon</shape> + <level>tlMapUpgradableToGreen</level> + <name>Orleans</name> + <junctions> + <junction> + <junType>jtCity</junType> + <position>tpCenter</position> + <revenue> + <value>20</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideA</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideD</position2> + </connection> + </connections> + </tile> + <tile> + <ID>-26006</ID> + <shape>tsHexagon</shape> + <level>tlMapUpgradableToBrown</level> + <name>Brussels</name> + <junctions> + <junction> + <junType>jtDoubleCity</junType> + <position>tpCenter</position> + <revenue> + <value>30</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideB</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideC</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideD</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideF</position2> + </connection> + </connections> + </tile> + <tile> + <ID>-26007</ID> + <shape>tsHexagon</shape> + <level>tlMapUpgradableToBrown</level> + <name>Lyon</name> + <junctions> + <junction> + <junType>jtDoubleCity</junType> + <position>tpCenter</position> + <revenue> + <value>30</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideA</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideC</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideD</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideF</position2> + </connection> + </connections> + </tile> </tiles> \ No newline at end of file Modified: trunk/18xx/tiles/Tiles.xml =================================================================== --- trunk/18xx/tiles/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585) +++ trunk/18xx/tiles/Tiles.xml 2011-06-25 15:37:01 UTC (rev 1586) @@ -4196,7 +4196,7 @@ <Track from="city5" gauge="normal" to="side4"/> <Track from="city6" gauge="normal" to="side5"/> </Tile> - <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg"> + <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg"> <Station id="city1" position="0" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side1"/> @@ -4208,4 +4208,28 @@ <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side3"/> </Tile> + <Tile colour="yellow" id="-26004" name="Lille"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="yellow" id="-26005" name="Orleans"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="-26006" name="Brussels"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="-26007" name="Lyon"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> </Tiles> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-25 14:14:54
|
Revision: 1585 http://rails.svn.sourceforge.net/rails/?rev=1585&view=rev Author: evos Date: 2011-06-25 14:14:47 +0000 (Sat, 25 Jun 2011) Log Message: ----------- 1826: new preprinted tiles Modified Paths: -------------- trunk/18xx/data/1826/CompanyManager.xml trunk/18xx/data/1826/Map.xml trunk/18xx/data/1826/TileSet.xml trunk/18xx/data/1826/Tiles.xml trunk/18xx/tiles/TileDictionary.18t trunk/18xx/tiles/TileDictionary.xml trunk/18xx/tiles/Tiles.xml Added Paths: ----------- trunk/18xx/tiles/svg/tile-26001.svg trunk/18xx/tiles/svg/tile-26002.svg trunk/18xx/tiles/svg/tile-26003.svg Modified: trunk/18xx/data/1826/CompanyManager.xml =================================================================== --- trunk/18xx/data/1826/CompanyManager.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/data/1826/CompanyManager.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -53,7 +53,7 @@ <Company name="Est" type="Public" tokens="4" fgColour="000000" bgColour="FF6600" longname="Chemin de Fer de L'Est"> - <Home hex="G9"/> + <Home hex="G9" city="2"/> </Company> <Company name="GC" type="Public" tokens="4" fgColour="000000" bgColour="BCD2EE" @@ -68,27 +68,27 @@ <Company name="N" type="Public" tokens="4" fgColour="FFFFFF" bgColour="EE0000" longname="Chemin de Fer du Nord"> - <Home hex="G9"/> + <Home hex="G9" city="1"/> </Company> <Company name="Ouest" type="Public" tokens="4" fgColour="000000" bgColour="FF92BB" longname="Chemin de Fer de L'Ouest"> - <Home hex="G9"/> + <Home hex="G9" city="5"/> </Company> <Company name="Paris" type="Public" tokens="4" fgColour="000000" bgColour="CECC15" longname="Chemin de Fer de Paris"> - <Home hex="G9"/> + <Home hex="G9" city="6"/> </Company> <Company name="PLM" type="Public" tokens="4" fgColour="FFFFFF" bgColour="691F01" longname="Chemin de Fer Paris-Lyon-Méditerranée"> - <Home hex="G9"/> + <Home hex="G9" city="3"/> </Company> <Company name="PO" type="Public" tokens="4" fgColour="FFFFFF" bgColour="0000CD" longname="Chemin de Fer Paris-Orléans"> - <Home hex="G9"/> + <Home hex="G9" city="4"/> </Company> <Company name="Etat" type="Public" tokens="4" fgColour="FFFFFF" bgColour="000000" Modified: trunk/18xx/data/1826/Map.xml =================================================================== --- trunk/18xx/data/1826/Map.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/data/1826/Map.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -16,7 +16,7 @@ <Hex name="D12" tile="-1" city="Mons"/> <Hex name="D14" tile="-1" city="Namur" cost="60"/> <Hex name="D16" tile="-1" city="Luxembourg" cost="60"/> - <Hex name="E5" tile="-4007" city="Le Havre"/> + <Hex name="E5" tile="-103" orientation="5" city="Le Havre"/> <Hex name="E7" tile="-1" city="Rouen" cost="40"/> <Hex name="E9" tile="0"/> <Hex name="E11" tile="0"/> @@ -33,12 +33,12 @@ <Hex name="G3" tile="0"/> <Hex name="G5" tile="0"/> <Hex name="G7" tile="0"/> - <Hex name="G9" tile="-4007" city="Paris"/> + <Hex name="G9" tile="-26001" city="Paris"/> <Hex name="G11" tile="0"/> <Hex name="G13" tile="0"/> <Hex name="G15" tile="0"/> <Hex name="G17" tile="0"/> - <Hex name="G19" tile="-4007" city="Strasbourg"/> + <Hex name="G19" tile="-26002" orientation="3" city="Strasbourg"/> <Hex name="H2" tile="-1" city="Rennes"/> <Hex name="H4" tile="0"/> <Hex name="H6" tile="-10" city="Le Mans"/> @@ -48,7 +48,7 @@ <Hex name="H14" tile="0"/> <Hex name="H16" tile="0"/> <Hex name="H18" tile="-1" city="Mulhouse"/> - <Hex name="I1" tile="-4007" city="Nantes"/> + <Hex name="I1" tile="-26002" city="Nantes"/> <Hex name="I3" tile="-1" city="Angers" cost="40"/> <Hex name="I5" tile="0" cost="40"/> <Hex name="I7" tile="57" city="Orléans"/> @@ -73,7 +73,7 @@ <Hex name="K11" tile="-1" city="Clermont-Ferrand" cost="60"/> <Hex name="K13" tile="0"/> <Hex name="K15" tile="0"/> - <Hex name="K17" tile="-4007" city="Geneva"/> + <Hex name="K17" tile="-105" orientation="2" city="Geneva"/> <Hex name="L4" tile="0"/> <Hex name="L6" tile="0"/> <Hex name="L8" tile="-1" city="Limoges"/> @@ -81,7 +81,7 @@ <Hex name="L12" tile="0" cost="60"/> <Hex name="L14" tile="14" city="Lyon" orientation="5"/> <Hex name="L16" tile="0"/> - <Hex name="M3" tile="-4007" city="Bordeaux"/> + <Hex name="M3" tile="-26003" city="Bordeaux"/> <Hex name="M5" tile="0" cost="40"/> <Hex name="M7" tile="0"/> <Hex name="M9" tile="0"/> Modified: trunk/18xx/data/1826/TileSet.xml =================================================================== --- trunk/18xx/data/1826/TileSet.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/data/1826/TileSet.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -11,6 +11,10 @@ <Tile id="14"/> <Tile id="619"/> <Tile id="5"/> - <Tile id="-4007"/> + <Tile id="-26001"/> + <Tile id="-26002"/> + <Tile id="-26003"/> + <Tile id="-103"/> + <Tile id="-105"/> </TileManager> Modified: trunk/18xx/data/1826/Tiles.xml =================================================================== --- trunk/18xx/data/1826/Tiles.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/data/1826/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -1,15 +1,85 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Tiles> <Tile colour="white" id="0" name="empty"/> - <Tile colour="white" id="-1" name="empty"/> - <Tile colour="white" id="-10" name="empty"/> - <Tile colour="white" id="57" name="empty"/> - <Tile colour="white" id="-901" name="empty"/> - <Tile colour="white" id="-902" name="empty"/> - <Tile colour="white" id="-903" name="empty"/> - <Tile colour="white" id="14" name="empty"/> - <Tile colour="white" id="619" name="empty"/> - <Tile colour="white" id="5" name="empty"/> - <Tile colour="white" id="-4007" name="empty"/> - + <Tile colour="white" id="-1" name="1 village"> + <Station id="city1" position="002" type="Town"/> + </Tile> + <Tile colour="white" id="-10" name="1 city"> + <Station id="city1" position="302" slots="1" type="City"/> + </Tile> + <Tile colour="yellow" id="57" name="57"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="red" id="-901" name="OM 1 way"> + <Station id="city1" position="0" type="OffMapCity" value="-1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="red" id="-902" name="OM 2 way"> + <Station id="city1" position="0" type="OffMapCity" value="-1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="red" id="-903" name="OM 3 way"> + <Station id="city1" position="0" type="OffMapCity" value="-1"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="green" id="14" name="14"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="619" name="619"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="yellow" id="5" name="5"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="-26001" name="Paris"> + <Station id="city1" position="003" slots="1" type="City" value="50"/> + <Station id="city2" position="103" slots="1" type="City" value="50"/> + <Station id="city3" position="203" slots="1" type="City" value="50"/> + <Station id="city4" position="303" slots="1" type="City" value="50"/> + <Station id="city5" position="403" slots="1" type="City" value="50"/> + <Station id="city6" position="503" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city3" gauge="normal" to="side2"/> + <Track from="city4" gauge="normal" to="side3"/> + <Track from="city5" gauge="normal" to="side4"/> + <Track from="city6" gauge="normal" to="side5"/> + </Tile> + <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg"> + <Station id="city1" position="0" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-26003" name="Bordeaux"> + <Station id="city1" position="0" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="fixed" id="-103" name="MF 103"> + <Station id="city1" position="0" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="fixed" id="-105" name="MF 105"> + <Station id="city1" position="0" slots="1" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> </Tiles> \ No newline at end of file Modified: trunk/18xx/tiles/TileDictionary.18t =================================================================== (Binary files differ) Modified: trunk/18xx/tiles/TileDictionary.xml =================================================================== --- trunk/18xx/tiles/TileDictionary.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/tiles/TileDictionary.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -23834,4 +23834,158 @@ </connection> </connections> </tile> -</tiles> + <tile> + <ID>-26001</ID> + <shape>tsHexagon</shape> + <level>tlMapUpgradableToGreen</level> + <name>Paris</name> + <junctions> + <junction> + <junType>jtCity</junType> + <position>tp3SideA</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + <junction> + <junType>jtCity</junType> + <position>tp3SideB</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + <junction> + <junType>jtCity</junType> + <position>tp3SideC</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + <junction> + <junType>jtCity</junType> + <position>tp3SideD</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + <junction> + <junType>jtCity</junType> + <position>tp3SideE</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + <junction> + <junType>jtCity</junType> + <position>tp3SideF</position> + <revenue> + <value>50</value> + <position>tpCenter</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideA</position1> + <position2>tp4SideA</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideB</position1> + <position2>tp4SideB</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideC</position1> + <position2>tp4SideC</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideD</position1> + <position2>tp4SideD</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideE</position1> + <position2>tp4SideE</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tp3SideF</position1> + <position2>tp4SideF</position2> + </connection> + </connections> + </tile> + <tile> + <ID>-26002</ID> + <shape>tsHexagon</shape> + <level>tlMapFixed</level> + <name>Nantes/Sstrasbourg</name> + <junctions> + <junction> + <junType>jtCity</junType> + <position>tpCenter</position> + <revenue> + <value>40</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideA</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideB</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideC</position2> + </connection> + </connections> + </tile> + <tile> + <ID>-26003</ID> + <shape>tsHexagon</shape> + <level>tlMapFixed</level> + <name>Bordeaux</name> + <junctions> + <junction> + <junType>jtCity</junType> + <position>tpCenter</position> + <revenue> + <value>40</value> + <position>tp3CornerA</position> + </revenue> + </junction> + </junctions> + <connections> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideA</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideB</position2> + </connection> + <connection> + <conType>ctNormal</conType> + <position1>tpCenter</position1> + <position2>tp4SideD</position2> + </connection> + </connections> + </tile> +</tiles> \ No newline at end of file Modified: trunk/18xx/tiles/Tiles.xml =================================================================== --- trunk/18xx/tiles/Tiles.xml 2011-06-25 09:50:26 UTC (rev 1584) +++ trunk/18xx/tiles/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585) @@ -4182,4 +4182,30 @@ <Tile colour="fixed" id="-4009" name="Ferry"> <Track from="side3" gauge="narrow" to="side0"/> </Tile> + <Tile colour="yellow" id="-26001" name="Paris"> + <Station id="city1" position="003" slots="1" type="City" value="50"/> + <Station id="city2" position="103" slots="1" type="City" value="50"/> + <Station id="city3" position="203" slots="1" type="City" value="50"/> + <Station id="city4" position="303" slots="1" type="City" value="50"/> + <Station id="city5" position="403" slots="1" type="City" value="50"/> + <Station id="city6" position="503" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city3" gauge="normal" to="side2"/> + <Track from="city4" gauge="normal" to="side3"/> + <Track from="city5" gauge="normal" to="side4"/> + <Track from="city6" gauge="normal" to="side5"/> + </Tile> + <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg"> + <Station id="city1" position="0" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-26003" name="Bordeaux"> + <Station id="city1" position="0" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> </Tiles> \ No newline at end of file Added: trunk/18xx/tiles/svg/tile-26001.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26001.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26001.svg 2011-06-25 14:14:47 UTC (rev 1585) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="43" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="306" cy="107" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="306" cy="233" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="297" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="86" cy="233" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="86" cy="107" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,43 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,107 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,233 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,297 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,233 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,107 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,43 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,107 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,233 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,297 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,233 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,107 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="43" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="306" cy="107" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="306" cy="233" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="196" cy="297" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="86" cy="233" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="86" cy="107" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> Added: trunk/18xx/tiles/svg/tile-26002.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26002.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26002.svg 2011-06-25 14:14:47 UTC (rev 1585) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#C0C0C0" stroke="#C0C0C0" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">40</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> Added: trunk/18xx/tiles/svg/tile-26003.svg =================================================================== --- trunk/18xx/tiles/svg/tile-26003.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-26003.svg 2011-06-25 14:14:47 UTC (rev 1585) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#C0C0C0" stroke="#C0C0C0" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">40</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-25 09:50:32
|
Revision: 1584 http://rails.svn.sourceforge.net/rails/?rev=1584&view=rev Author: evos Date: 2011-06-25 09:50:26 +0000 (Sat, 25 Jun 2011) Log Message: ----------- Initial XML for 1826 Modified Paths: -------------- trunk/18xx/data/GamesList.xml Added Paths: ----------- trunk/18xx/data/1826/ trunk/18xx/data/1826/CompanyManager.xml trunk/18xx/data/1826/Game.xml trunk/18xx/data/1826/Map.xml trunk/18xx/data/1826/StockMarket.xml trunk/18xx/data/1826/TileSet.xml trunk/18xx/data/1826/Tiles.xml Added: trunk/18xx/data/1826/CompanyManager.xml =================================================================== --- trunk/18xx/data/1826/CompanyManager.xml (rev 0) +++ trunk/18xx/data/1826/CompanyManager.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,117 @@ +<?xml version="1.0"?> +<CompanyManager> + <CompanyType name="Private" class="rails.game.PrivateCompany"> + <ClosingConditions> + <Phase>5</Phase> + </ClosingConditions> + <Tradeable toCompany="yes" lowerPriceFactor="0.5" upperPriceFactor="1.5"/> + <Tradeable toPlayer="yes"/> + </CompanyType> + <CompanyType name="Public" class="rails.game.PublicCompany"> + <Capitalisation type="incremental"/> + <StockPrice par="no"/> + <Float percentage="60"/> + <ShareUnit percentage="10"/> + <Certificate type="President" shares="2"/> + <Certificate shares="1" number="8"/> + <BaseTokens> + <HomeBase lay="firstOR"/> + <LayCost method="sequence" cost="0,40,100"/> + </BaseTokens> + <Trains number="4,4,3,2"/> + <CanBuyPrivates/> + <CanUseSpecialProperties/> + </CompanyType> + + <Company name="Bridge" type="Private" basePrice="20" revenue="5" + longname="Ponts et Chaussées"></Company> + + <Company name="Mail" type="Private" basePrice="40" revenue="10" + longname="Régie des Postes"></Company> + + <Company name="Algerian" type="Private" basePrice="70" revenue="15" + longname="Chemins de Fer D'Algérie"></Company> + + <Company name="Belgian" type="Private" basePrice="110" revenue="20" + longname="Grand Central Belge"></Company> + + <Company name="Parisian" type="Private" basePrice="160" revenue="25" + longname="Compagnie Paris-Rouen"></Company> + + <Company name="Alsatian" type="Private" basePrice="220" revenue="30" + longname="Ligne - Strasbourg-Bâle"></Company> + + <Company name="A" type="Public" tokens="4" fgColour="FFFFFF" bgColour="120A8F" + longname="Chemin de Fer d'Alsace"> + <Home hex="G19"/> + </Company> + + <Company name="B" type="Public" tokens="4" fgColour="FFFFFF" bgColour="2E6444" + longname="Chemin de Fer de L'Etat Belge"> + <Home hex="C13"/> + </Company> + + <Company name="Est" type="Public" tokens="4" fgColour="000000" bgColour="FF6600" + longname="Chemin de Fer de L'Est"> + <Home hex="G9"/> + </Company> + + <Company name="GC" type="Public" tokens="4" fgColour="000000" bgColour="BCD2EE" + longname="Grand Central de France"> + <Home hex="L14"/> + </Company> + + <Company name="Midi" type="Public" tokens="4" fgColour="FFFFFF" bgColour="308014" + longname="Chemin de Fer du Midi"> + <Home hex="M3"/> + </Company> + + <Company name="N" type="Public" tokens="4" fgColour="FFFFFF" bgColour="EE0000" + longname="Chemin de Fer du Nord"> + <Home hex="G9"/> + </Company> + + <Company name="Ouest" type="Public" tokens="4" fgColour="000000" bgColour="FF92BB" + longname="Chemin de Fer de L'Ouest"> + <Home hex="G9"/> + </Company> + + <Company name="Paris" type="Public" tokens="4" fgColour="000000" bgColour="CECC15" + longname="Chemin de Fer de Paris"> + <Home hex="G9"/> + </Company> + + <Company name="PLM" type="Public" tokens="4" fgColour="FFFFFF" bgColour="691F01" + longname="Chemin de Fer Paris-Lyon-Méditerranée"> + <Home hex="G9"/> + </Company> + + <Company name="PO" type="Public" tokens="4" fgColour="FFFFFF" bgColour="0000CD" + longname="Chemin de Fer Paris-Orléans"> + <Home hex="G9"/> + </Company> + + <Company name="Etat" type="Public" tokens="4" fgColour="FFFFFF" bgColour="000000" + longname="Chemin de Fer de L'Etat"> + </Company> + + <Company name="SNCF" type="Public" tokens="4" fgColour="000000" bgColour="B3B3B3" + longname="Société Nationale des Chemins de fer Français"> + </Company> + + <StartPacket roundClass="rails.game.StartRound_1830"> + <Bidding initial="5" minimum="5" increment="1"/> + <Item name="Bridge" type="Private" basePrice="20"/> + <Item name="Mail" type="Private" basePrice="40"/> + <Item name="Algerian" type="Private" basePrice="70"/> + <Item name="Belgian" type="Private" basePrice="110"> + <SubItem name="B" type="Public" /> + </Item> + <Item name="Parisian" type="Private" basePrice="160"> + <SubItem name="Paris" type="Public" /> + </Item> + <Item name="Alsatian" type="Private" basePrice="220"> + <SubItem name="A" type="Public" president="yes"/> + </Item> + </StartPacket> +</CompanyManager> \ No newline at end of file Property changes on: trunk/18xx/data/1826/CompanyManager.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/data/1826/Game.xml =================================================================== --- trunk/18xx/data/1826/Game.xml (rev 0) +++ trunk/18xx/data/1826/Game.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,80 @@ +<?xml version="1.0"?> +<ComponentManager> + <Component name="GameManager" class="rails.game.GameManager"> + <Game name="1826"/> + <GameOption name="Variant" values="Basegame" default="Basegame" /> + <GameOption name="NoMapMode" type="toggle" default="no" /> + <GameOption name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> + <GameOption name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> + <GameOption name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/> + <GameOption name="UnlimitedTiles" type="toggle" default="no"/> + <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> + <GameOption name="TwoPlayersCertLimit70Percent" type="toggle" default="yes"/> + <GameParameters> + <PlayerShareLimit percentage="60"> + <IfOption name="NumberOfPlayers" value="2"> + <IfOption name="TwoPlayersCertLimit70Percent" value="yes"> + <Attributes percentage="70"/> + </IfOption> + </IfOption> + </PlayerShareLimit> + <BankPoolLimit percentage="50"/> + <StockRound> + <NoSaleInFirstSR/> + </StockRound> + </GameParameters> + <GuiClasses> + </GuiClasses> + <EndOfGame> + <Bankruptcy/> + <BankBreaks limit="0" finish="currentOR"/> + <!-- "Runs out"; when "broken", -1 is the limit --> + <!-- Also when the share value reaches $300; this is configured in the stock market XML, + but uses the 'finish' attribute value defined above. --> + </EndOfGame> + </Component> + <Component name="PlayerManager" class="rails.game.PlayerManager"> + <Players number="2" cash="900" certLimit="28"/> + <Players number="3" cash="600" certLimit="20"/> + <Players number="4" cash="450" certLimit="16"/> + <Players number="5" cash="360" certLimit="13"/> + <Players number="6" cash="300" certLimit="11"/> + </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> + </Component> + <Component name="TileManager" class="rails.game.TileManager" + file="TileSet.xml"/> + <Component name="Map" class="rails.game.MapManager" file="Map.xml"/> + <Component name="CompanyManager" class="rails.game.CompanyManager" + file="CompanyManager.xml"/> + <Component name="StockMarket" class="rails.game.StockMarket" + file="StockMarket.xml"/> + <Component name="TrainManager" class="rails.game.TrainManager"> + <Defaults> + <Reach base="stops" countTowns="yes"/> + <!-- Alternative values: + base="hexes" for H-trains as in 1826, 1849 etc. + countTowns="no" for all trains in 1841, 18EU, etc., + where towns score but do not count against the train length. + Otherwise, towns are counted as minor or major stops, + depending on the presence or absence of a "minorStops" value. + --> + <Score towns="yes"/> + <!-- Alternative values: + towns="no" for trains that ignore towns (e.g. 1826 TGV). + cities="double" if city-revenue is doubled (e.g. 1826 TGV). + --> + </Defaults> + <TrainType name="2" majorStops="2" cost="80" quantity="5" obsoleting="yes"/> + </Component> + <Component name="PhaseManager" class="rails.game.PhaseManager"> + <Phase name="2" > + <Tiles colour="yellow"/> + <OperatingRounds number="1"/> + <Trains onePerTurn="yes" tradingAllowed="yes"/> + </Phase> + </Component> + <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> + </Component> +</ComponentManager> \ No newline at end of file Property changes on: trunk/18xx/data/1826/Game.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/data/1826/Map.xml =================================================================== --- trunk/18xx/data/1826/Map.xml (rev 0) +++ trunk/18xx/data/1826/Map.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,96 @@ +<Map tileOrientation="EW" + letterOrientation="vertical" even="B"> + + <Hex name="A13" tile="-902" city="Amsterdam" value="20,50,70" orientation="1"/> + <Hex name="B8" tile="-902" city="London" value="40,60,80,120"/> + <Hex name="B10" tile="-1" city="Ostende"/> + <Hex name="B12" tile="-10" city="Antwerp" cost="40"/> + <Hex name="B14" tile="0" cost="40"/> + <Hex name="C9" tile="-1" city="Calais"/> + <Hex name="C11" tile="5" city="Lille" orientation="2"/> + <Hex name="C13" tile="619" city="Brussels" orientation="3"/> + <Hex name="C15" tile="-10" city="Liège" cost="40"/> + <Hex name="C17" tile="-902" city="Cologne" value="20,40,60,100" orientation="2"/> + <Hex name="D8" tile="0"/> + <Hex name="D10" tile="-1" city="Amiens"/> + <Hex name="D12" tile="-1" city="Mons"/> + <Hex name="D14" tile="-1" city="Namur" cost="60"/> + <Hex name="D16" tile="-1" city="Luxembourg" cost="60"/> + <Hex name="E5" tile="-4007" city="Le Havre"/> + <Hex name="E7" tile="-1" city="Rouen" cost="40"/> + <Hex name="E9" tile="0"/> + <Hex name="E11" tile="0"/> + <Hex name="E13" tile="0"/> + <Hex name="E15" tile="-10" city="Metz"/> + <Hex name="E17" tile="0" cost="60"/> + <Hex name="F6" tile="0" cost="40"/> + <Hex name="F8" tile="0" cost="40"/> + <Hex name="F10" tile="0" cost="40"/> + <Hex name="F12" tile="-10" city="Reims" cost="40"/> + <Hex name="F14" tile="0"/> + <Hex name="F16" tile="-1" city="Nancy"/> + <Hex name="F18" tile="0"/> + <Hex name="G3" tile="0"/> + <Hex name="G5" tile="0"/> + <Hex name="G7" tile="0"/> + <Hex name="G9" tile="-4007" city="Paris"/> + <Hex name="G11" tile="0"/> + <Hex name="G13" tile="0"/> + <Hex name="G15" tile="0"/> + <Hex name="G17" tile="0"/> + <Hex name="G19" tile="-4007" city="Strasbourg"/> + <Hex name="H2" tile="-1" city="Rennes"/> + <Hex name="H4" tile="0"/> + <Hex name="H6" tile="-10" city="Le Mans"/> + <Hex name="H8" tile="0"/> + <Hex name="H10" tile="0"/> + <Hex name="H12" tile="0"/> + <Hex name="H14" tile="0"/> + <Hex name="H16" tile="0"/> + <Hex name="H18" tile="-1" city="Mulhouse"/> + <Hex name="I1" tile="-4007" city="Nantes"/> + <Hex name="I3" tile="-1" city="Angers" cost="40"/> + <Hex name="I5" tile="0" cost="40"/> + <Hex name="I7" tile="57" city="Orléans"/> + <Hex name="I9" tile="0"/> + <Hex name="I11" tile="0"/> + <Hex name="I13" tile="-10" city="Dijon"/> + <Hex name="I15" tile="0"/> + <Hex name="I17" tile="-1" city="Besançon"/> + <Hex name="I19" tile="-901" city="Basel" value="20,50,70,100" orientation="3"/> + <Hex name="J2" tile="0"/> + <Hex name="J4" tile="0"/> + <Hex name="J6" tile="-1" city="Tours"/> + <Hex name="J8" tile="0"/> + <Hex name="J10" tile="0" cost="60"/> + <Hex name="J12" tile="0"/> + <Hex name="J14" tile="0"/> + <Hex name="J16" tile="0"/> + <Hex name="K3" tile="0"/> + <Hex name="K5" tile="-1" city="Poitiers"/> + <Hex name="K7" tile="0"/> + <Hex name="K9" tile="0" cost="60"/> + <Hex name="K11" tile="-1" city="Clermont-Ferrand" cost="60"/> + <Hex name="K13" tile="0"/> + <Hex name="K15" tile="0"/> + <Hex name="K17" tile="-4007" city="Geneva"/> + <Hex name="L4" tile="0"/> + <Hex name="L6" tile="0"/> + <Hex name="L8" tile="-1" city="Limoges"/> + <Hex name="L10" tile="0" cost="60"/> + <Hex name="L12" tile="0" cost="60"/> + <Hex name="L14" tile="14" city="Lyon" orientation="5"/> + <Hex name="L16" tile="0"/> + <Hex name="M3" tile="-4007" city="Bordeaux"/> + <Hex name="M5" tile="0" cost="40"/> + <Hex name="M7" tile="0"/> + <Hex name="M9" tile="0"/> + <Hex name="M11" tile="0"/> + <Hex name="M13" tile="-10" city="Saint-Étienne"/> + <Hex name="M15" tile="0" cost="40"/> + <Hex name="M17" tile="-1" city="Grenoble" cost="60"/> + <Hex name="M19" tile="-901" city="Milan" value="30,50,90,120" orientation="2"/> + <Hex name="N2" tile="-901" city="Madrid" value="20,50,70,100" orientation="4"/> + <Hex name="N16" tile="-901" city="Marseille" value="40,60,80" orientation="3"/> + +</Map> \ No newline at end of file Property changes on: trunk/18xx/data/1826/Map.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/data/1826/StockMarket.xml =================================================================== --- trunk/18xx/data/1826/StockMarket.xml (rev 0) +++ trunk/18xx/data/1826/StockMarket.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,100 @@ +<StockMarket type="rectangular"> + <!-- Note two supported colour specification formats: + RGB decimal with commas and RGB hexadecimal without commas --> + <StockSpaceType name="yellow" colour="255,255,0"> + <NoCertLimit/> + </StockSpaceType> + + <StockSpace name="A1" price="82"/> + <StockSpace name="A2" price="75"/> + <StockSpace name="A3" price="70"/> + <StockSpace name="A4" price="65"/> + <StockSpace name="A5" price="60" type="yellow"/> + <StockSpace name="A6" price="50" type="yellow"/> + <StockSpace name="A7" price="40" type="yellow"/> + + <StockSpace name="B1" price="90"/> + <StockSpace name="B2" price="82"/> + <StockSpace name="B3" price="75"/> + <StockSpace name="B4" price="70"/> + <StockSpace name="B5" price="65"/> + <StockSpace name="B6" price="60" type="yellow"/> + <StockSpace name="B7" price="50" type="yellow"/> + + <StockSpace name="C1" price="100"/> + <StockSpace name="C2" price="90"/> + <StockSpace name="C3" price="82"/> + <StockSpace name="C4" price="75"/> + <StockSpace name="C5" price="70"/> + <StockSpace name="C6" price="65"/> + <StockSpace name="C7" price="60" type="yellow"/> + + <StockSpace name="D1" price="110"> + <StartSpace /> + </StockSpace> + <StockSpace name="D2" price="100"> + <StartSpace /> + </StockSpace> + <StockSpace name="D3" price="90"> + <StartSpace /> + </StockSpace> + <StockSpace name="D4" price="82"> + <StartSpace /> + </StockSpace> + <StockSpace name="D5" price="75"> + <StartSpace /> + </StockSpace> + <StockSpace name="D6" price="70"/> + <StockSpace name="D7" price="65"/> + + <StockSpace name="E1" price="122"/> + <StockSpace name="E2" price="110"/> + <StockSpace name="E3" price="100"/> + <StockSpace name="E4" price="90"/> + <StockSpace name="E5" price="82"/> + <StockSpace name="E6" price="75"/> + + <StockSpace name="F1" price="135"/> + <StockSpace name="F2" price="122"/> + <StockSpace name="F3" price="110"/> + <StockSpace name="F4" price="100"/> + <StockSpace name="F5" price="90"/> + + <StockSpace name="G1" price="150"/> + <StockSpace name="G2" price="135"/> + <StockSpace name="G3" price="122"/> + <StockSpace name="G4" price="110"/> + + <StockSpace name="H1" price="165"/> + <StockSpace name="H2" price="150"/> + <StockSpace name="H3" price="135"/> + <StockSpace name="H4" price="122"/> + + <StockSpace name="I1" price="180"/> + <StockSpace name="I2" price="165"/> + <StockSpace name="I3" price="150"/> + + <StockSpace name="J1" price="200"/> + <StockSpace name="J2" price="180"/> + <StockSpace name="J3" price="165"/> + + <StockSpace name="K1" price="220"/> + <StockSpace name="K2" price="200"/> + <StockSpace name="K3" price="180"/> + + <StockSpace name="L1" price="245"/> + <StockSpace name="L2" price="220"/> + + <StockSpace name="M1" price="270"/> + <StockSpace name="M2" price="245"/> + + <StockSpace name="N1" price="300"/> + <StockSpace name="N2" price="270"/> + + <StockSpace name="O1" price="330"/> + + <StockSpace name="P1" price="360"/> + + <StockSpace name="Q1" price="400"/> + +</StockMarket> \ No newline at end of file Property changes on: trunk/18xx/data/1826/StockMarket.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/data/1826/TileSet.xml =================================================================== --- trunk/18xx/data/1826/TileSet.xml (rev 0) +++ trunk/18xx/data/1826/TileSet.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,16 @@ +<TileManager tiles="Tiles.xml"> + + + <Tile id="0"/> + <Tile id="-1"/> + <Tile id="-10"/> + <Tile id="57"/> + <Tile id="-901"/> + <Tile id="-902"/> + <Tile id="-903"/> + <Tile id="14"/> + <Tile id="619"/> + <Tile id="5"/> + <Tile id="-4007"/> + +</TileManager> Property changes on: trunk/18xx/data/1826/TileSet.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/data/1826/Tiles.xml =================================================================== --- trunk/18xx/data/1826/Tiles.xml (rev 0) +++ trunk/18xx/data/1826/Tiles.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<Tiles> + <Tile colour="white" id="0" name="empty"/> + <Tile colour="white" id="-1" name="empty"/> + <Tile colour="white" id="-10" name="empty"/> + <Tile colour="white" id="57" name="empty"/> + <Tile colour="white" id="-901" name="empty"/> + <Tile colour="white" id="-902" name="empty"/> + <Tile colour="white" id="-903" name="empty"/> + <Tile colour="white" id="14" name="empty"/> + <Tile colour="white" id="619" name="empty"/> + <Tile colour="white" id="5" name="empty"/> + <Tile colour="white" id="-4007" name="empty"/> + +</Tiles> \ No newline at end of file Property changes on: trunk/18xx/data/1826/Tiles.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2011-06-24 14:23:29 UTC (rev 1583) +++ trunk/18xx/data/GamesList.xml 2011-06-25 09:50:26 UTC (rev 1584) @@ -248,6 +248,11 @@ <Option name="UnlimitedTiles" type="toggle" default="no"/> <Option name="SeparateSalesAtSamePrice" type="toggle" default="yes"/> </Game> + <Game name="1826"> + <Note>Prototype</Note> + <Description>1826</Description> + <Players minimum="2" maximum="6" /> + </Game> <Game name="18JR"> <Note>Prototype</Note> <Description>18JR</Description> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2011-06-24 14:23:35
|
Revision: 1583 http://rails.svn.sourceforge.net/rails/?rev=1583&view=rev Author: evos Date: 2011-06-24 14:23:29 +0000 (Fri, 24 Jun 2011) Log Message: ----------- 18GA: OSRR extra 2-train Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/data/18GA/CompanyManager.xml trunk/18xx/data/18GA/Game.xml trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/Train.java trunk/18xx/rails/game/TrainManager.java trunk/18xx/rails/game/action/StartCompany.java Added Paths: ----------- trunk/18xx/rails/game/specific/_18GA/ trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/LocalisedText.properties 2011-06-24 14:23:29 UTC (rev 1583) @@ -295,6 +295,7 @@ GameSetupFailed=Game setup from file {0} failed GetShareForMinor={0} gets a {1}% share of {2} from {3} in exchange for {4} GetNoShareForMinor={0} does not get a share for Minor {1}, which closes +GetsExtraTrain={0} gets an extra {1}-train Has={0} has {1} HasFirstTurn={0} has the first turn HasMergedShares={0} has exchanged {1} old shares for {2} {3} shares Modified: trunk/18xx/data/18GA/CompanyManager.xml =================================================================== --- trunk/18xx/data/18GA/CompanyManager.xml 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/data/18GA/CompanyManager.xml 2011-06-24 14:23:29 UTC (rev 1583) @@ -48,6 +48,7 @@ </Company> <Company name="OSO" type="Private" basePrice="100" revenue="20" longname="Ocilla Southern Railroad"> + <!-- Note: name "OSO" is also used in OperatingRound_18GA --> <Blocking hex="G7"/> </Company> <Company name="M&B" type="Private" basePrice="150" revenue="25" Modified: trunk/18xx/data/18GA/Game.xml =================================================================== --- trunk/18xx/data/18GA/Game.xml 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/data/18GA/Game.xml 2011-06-24 14:23:29 UTC (rev 1583) @@ -11,6 +11,7 @@ <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> <GameOption name="TwoPlayersCertLimit70Percent" type="toggle" default="yes"/> <GameParameters> + <OperatingRound class="rails.game.specific._18GA.OperatingRound_18GA"/> <PlayerShareLimit percentage="60"> <IfOption name="NumberOfPlayers" value="2"> <IfOption name="TwoPlayersCertLimit70Percent" value="yes"> Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/rails/game/OperatingRound.java 2011-06-24 14:23:29 UTC (rev 1583) @@ -1838,6 +1838,7 @@ train.setType(action.getType()); // Needed for dual trains bought from the Bank operatingCompany.get().buyTrain(train, price); + if (oldHolder == ipo) { train.getCertType().addToBoughtFromIPO(); trainManager.setAnyTrainBought(true); @@ -2772,7 +2773,7 @@ trains = pf.getUniqueTrains(); for (TrainI train : trains) { - if (train.isObsolete()) continue; + if (train.isObsolete() || !train.isTradeable()) continue; if (i != currentPlayerIndex //&& trainMgr.buyAtFaceValueBetweenDifferentPresidents() && getGameParameterAsBoolean(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS) @@ -2848,7 +2849,7 @@ } /** - * Can the company buy a train now? + * Can the operating company buy a train now? * Normally only calls isBelowTrainLimit() to get the result. * May be overridden if other considerations apply (such as * having a Pullmann in 18EU). Modified: trunk/18xx/rails/game/Train.java =================================================================== --- trunk/18xx/rails/game/Train.java 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/rails/game/Train.java 2011-06-24 14:23:29 UTC (rev 1583) @@ -123,7 +123,7 @@ } public CashHolder getOwner() { - return holder.getOwner(); + return holder != null ? holder.getOwner() : null; } public boolean isObsolete() { Modified: trunk/18xx/rails/game/TrainManager.java =================================================================== --- trunk/18xx/rails/game/TrainManager.java 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/rails/game/TrainManager.java 2011-06-24 14:23:29 UTC (rev 1583) @@ -202,7 +202,7 @@ // Train trading between different players at face value only (1851) gameManager.setGameParameter(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS, trainPriceAtFaceValueIfDifferentPresidents); -} + } /** Create train without throwing exceptions. * To be used <b>after</b> completing initialization, Modified: trunk/18xx/rails/game/action/StartCompany.java =================================================================== --- trunk/18xx/rails/game/action/StartCompany.java 2011-06-22 11:56:55 UTC (rev 1582) +++ trunk/18xx/rails/game/action/StartCompany.java 2011-06-24 14:23:29 UTC (rev 1583) @@ -47,8 +47,8 @@ @Override public String toString() { - StringBuffer text = new StringBuffer(); - text.append("StartCompany: ").append(company.getName()); + StringBuilder text = new StringBuilder(); + text.append("StartCompany: ").append(company != null ? company.getName() : null); if (price > 0) { text.append(" price=").append(Bank.format(price)); if (numberBought > 1) { Added: trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java =================================================================== --- trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java (rev 0) +++ trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java 2011-06-24 14:23:29 UTC (rev 1583) @@ -0,0 +1,40 @@ +package rails.game.specific._18GA; + +import rails.game.*; +import rails.game.action.BuyPrivate; +import rails.util.LocalText; + +public class OperatingRound_18GA extends OperatingRound { + + public final static String OS_NAME = "OSO"; + public final static String OS_EXTRA_TRAIN_TYPE = "2"; + + public OperatingRound_18GA (GameManagerI gameManager) { + super (gameManager); + } + + public boolean buyPrivate(BuyPrivate action) { + + boolean result = super.buyPrivate(action); + + // If the Ocilla Southern has been bought, the company gets an extra 2-train, if possible + if (result + && action.getPrivateCompany().getName().equalsIgnoreCase(OS_NAME) + && isBelowTrainLimit()) { + PublicCompanyI company = operatingCompany.get(); + TrainCertificateType certType = trainManager.getCertTypeByName(OS_EXTRA_TRAIN_TYPE); + if (!certType.hasRusted()) { // I.e. before phase "4" + TrainI train = trainManager.cloneTrain(certType); + company.getPortfolio().buyTrain(train, 0); + train.setTradeable(false); + ReportBuffer.add(LocalText.getText("GetsExtraTrain", + company.getName(), + OS_EXTRA_TRAIN_TYPE)); + company.getPortfolio().getTrainsModel().update(); + } + } + + return result; + } + +} Property changes on: trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |