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: Stefan F. <ste...@us...> - 2010-05-01 16:07:13
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23419/rails/algorithms Modified Files: RevenueCalculator.java RevenueAdapter.java NetworkEdge.java NetworkGraphBuilder.java Log Message: Improved display of run paths (hidden vertices are shown) Index: RevenueCalculator.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueCalculator.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RevenueCalculator.java 27 Apr 2010 23:24:50 -0000 1.8 --- RevenueCalculator.java 1 May 2010 16:07:05 -0000 1.9 *************** *** 315,319 **** // no more edges to find ! finalizeVertex(trainId, vertexId, valueStation); encounterVertex(trainId, vertexId, false); // keep them on the visited vertex list to avoid route duplication --- 315,319 ---- // no more edges to find ! finalizeVertex(trainId, vertexId); encounterVertex(trainId, vertexId, false); // keep them on the visited vertex list to avoid route duplication *************** *** 402,406 **** // 3. no more edges to visit from here => evaluate or start new train ! finalizeVertex(trainId, vertexId, valueStation); // 4. then leave that vertex --- 402,407 ---- // 3. no more edges to visit from here => evaluate or start new train ! if (valueStation) ! finalizeVertex(trainId, vertexId); // 4. then leave that vertex *************** *** 512,520 **** } ! private void finalizeVertex(int trainId, int vertexId, boolean evaluate) { log.debug("RC: No more edges found at " + vertexId + " for train " + trainId); if (trainId == finalTrain) { ! if (evaluate) evaluateResults(); } else { runTrain(trainId + 1); --- 513,521 ---- } ! private void finalizeVertex(int trainId, int vertexId) { log.debug("RC: No more edges found at " + vertexId + " for train " + trainId); if (trainId == finalTrain) { ! evaluateResults(); } else { runTrain(trainId + 1); Index: NetworkEdge.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkEdge.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NetworkEdge.java 27 Apr 2010 23:24:50 -0000 1.5 --- NetworkEdge.java 1 May 2010 16:07:05 -0000 1.6 *************** *** 5,13 **** --- 5,20 ---- import java.awt.geom.Point2D; import java.util.ArrayList; + import java.util.Collections; import java.util.List; + import org.apache.log4j.Logger; + import org.jgrapht.Graph; + import rails.ui.swing.hexmap.HexMap; public final class NetworkEdge { + + protected static Logger log = + Logger.getLogger(NetworkEdge.class.getPackage().getName()); private final NetworkVertex source; *************** *** 66,71 **** } public String getConnection() { ! return source + " - >" + target; } --- 73,87 ---- } + public String toFullInfoString() { + StringBuffer info = new StringBuffer(); + info.append("Edge " + getConnection()); + info.append(", greedy = " + greedy); + info.append(", distance = " + distance); + info.append(", hidden vertexes = " + hiddenVertexes); + return info.toString(); + } + public String getConnection() { ! return source + " -> " + target; } *************** *** 79,82 **** --- 95,166 ---- } + public static boolean mergeEdges(Graph<NetworkVertex, NetworkEdge> graph, + NetworkEdge edgeA, NetworkEdge edgeB) { + + log.info("Merge of edge " + edgeA.toFullInfoString() + " and edge " + edgeB.toFullInfoString()); + + NetworkVertex sourceA = edgeA.getSource(); + NetworkVertex targetA = edgeA.getTarget(); + NetworkVertex sourceB = edgeB.getSource(); + NetworkVertex targetB = edgeB.getTarget(); + + NetworkVertex newSource, newTarget, vertex = null; + + boolean reverseA = false, reverseB = false; + if (sourceA == sourceB) { + newSource = targetA; + newTarget = targetB; + vertex = sourceA; + reverseA = true; + } else if (sourceA == targetB) { + newSource = targetA; + newTarget = sourceB; + vertex = sourceA; + reverseA = true; + reverseB = true; + } else if (targetA == sourceB) { + newSource = sourceA; + newTarget = targetB; + vertex = targetA; + } else if (targetA == targetB) { + newSource = sourceA; + newTarget = sourceB; + vertex = targetA; + reverseB = true; + } else { + return false; + } + + log.info("Merge newSource = " + newSource + " newTarget = " + newTarget + " remove vertex = " + vertex); + + // check if graph contains the edge already + if (graph.containsEdge(newSource, newTarget)) return false; + + // define new edge + int distance = edgeA.getDistance() + edgeB.getDistance(); + + // create new hiddenVertexes + List<NetworkVertex> hiddenVertexes = new ArrayList<NetworkVertex>(); + List<NetworkVertex> hiddenA = edgeA.getHiddenVertexes(); + if (reverseA) + Collections.reverse(hiddenA); + List<NetworkVertex> hiddenB = edgeB.getHiddenVertexes(); + if (reverseB) + Collections.reverse(hiddenB); + hiddenVertexes.addAll(hiddenA); + hiddenVertexes.add(vertex); + hiddenVertexes.addAll(hiddenB); + NetworkEdge newEdge = + new NetworkEdge(newSource, newTarget, true, distance, hiddenVertexes); + graph.addEdge(newSource, newTarget, newEdge); + + log.info("New edge = " + newEdge.toFullInfoString()); + + // remove vertex + graph.removeVertex(vertex); + + return true; + } + public static Shape getEdgeShape(HexMap map, NetworkEdge edge){ Point2D source = NetworkVertex.getVertexPoint2D(map, edge.getSource()); Index: RevenueAdapter.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueAdapter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RevenueAdapter.java 29 Apr 2010 19:47:32 -0000 1.8 --- RevenueAdapter.java 1 May 2010 16:07:05 -0000 1.9 *************** *** 12,15 **** --- 12,16 ---- + import org.apache.log4j.Logger; import org.jgrapht.Graphs; import org.jgrapht.graph.SimpleGraph; *************** *** 24,27 **** --- 25,31 ---- public class RevenueAdapter implements Runnable { + protected static Logger log = + Logger.getLogger(RevenueAdapter.class.getPackage().getName()); + private SimpleGraph<NetworkVertex, NetworkEdge> graph; *************** *** 322,325 **** --- 326,330 ---- NetworkVertex previousVertex = null; for (NetworkVertex vertex:run.get(train)) { + log.debug("RA: Next vertex " + vertex); Point2D vertexPoint = NetworkVertex.getVertexPoint2D(map, vertex); if (startVertex == null) { *************** *** 334,348 **** } // draw hidden vertexes ! // NetworkEdge edge = graph.getEdge(previousVertex, vertex); ! // if (edge != null) { ! // List<NetworkVertex> hiddenVertexes = edge.getHiddenVertexes(); ! //// if (edge.getTarget() == vertex) Collections.reverse(hiddenVertexes); ! // for (NetworkVertex v:hiddenVertexes) { ! // Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); ! // if (vPoint != null) { ! // path.lineTo((float)vPoint.getX(), (float)vPoint.getY()); ! // } ! // } ! // } if (vertexPoint != null) { path.lineTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); --- 339,364 ---- } // draw hidden vertexes ! NetworkEdge edge = graph.getEdge(previousVertex, vertex); ! if (edge != null) { ! log.debug("RA: draw edge "+ edge.toFullInfoString()); ! List<NetworkVertex> hiddenVertexes = edge.getHiddenVertexes(); ! if (edge.getSource() == vertex) { ! log.debug("RA: reverse hiddenVertexes"); ! for (int i = hiddenVertexes.size() - 1; i >= 0; i--) { ! NetworkVertex v = hiddenVertexes.get(i); ! Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); ! if (vPoint != null) { ! path.lineTo((float)vPoint.getX(), (float)vPoint.getY()); ! } ! } ! } else { ! for (NetworkVertex v:hiddenVertexes) { ! Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); ! if (vPoint != null) { ! path.lineTo((float)vPoint.getX(), (float)vPoint.getY()); ! } ! } ! } ! } if (vertexPoint != null) { path.lineTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); Index: NetworkGraphBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkGraphBuilder.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NetworkGraphBuilder.java 27 Apr 2010 23:24:50 -0000 1.7 --- NetworkGraphBuilder.java 1 May 2010 16:07:05 -0000 1.8 *************** *** 292,312 **** } // greedy case: - NetworkVertex firstVertex = Graphs.getOppositeVertex(graph, edges[0], vertex); - NetworkVertex secondVertex = Graphs.getOppositeVertex(graph, edges[1], vertex); // merge greed edges if the vertexes are not already connected ! if (edges[0].isGreedy() && !graph.containsEdge(firstVertex, secondVertex)) { ! int distance = edges[0].getDistance() + edges[1].getDistance(); ! List<NetworkVertex> hiddenVertexes = new ArrayList<NetworkVertex>(); ! hiddenVertexes.addAll(edges[0].getHiddenVertexes()); ! hiddenVertexes.add(vertex); ! hiddenVertexes.addAll(edges[1].getHiddenVertexes()); ! NetworkEdge newEdge = ! new NetworkEdge(firstVertex, secondVertex, true, distance, hiddenVertexes); ! graph.addEdge(firstVertex, secondVertex, newEdge); ! log.info("NGB: Merged Edges removed Vertex = " + vertex); ! log.info("NGB: New Edge = " + newEdge.getConnection() + " with hidden Vertexes " + newEdge.getHiddenVertexes()); ! // remove vertex ! graph.removeVertex(vertex); ! removed = true; break; } --- 292,298 ---- } // greedy case: // merge greed edges if the vertexes are not already connected ! if (edges[0].isGreedy()) { ! removed = NetworkEdge.mergeEdges(graph, edges[0], edges[1]); break; } |
From: Stefan F. <ste...@us...> - 2010-05-01 16:07:12
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23419/rails/ui/swing Modified Files: ORPanel.java Log Message: Improved display of run paths (hidden vertices are shown) Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** ORPanel.java 29 Apr 2010 19:47:32 -0000 1.60 --- ORPanel.java 1 May 2010 16:07:05 -0000 1.61 *************** *** 664,667 **** --- 664,668 ---- } } + revenueAdapter = ra; } } |
From: Erik V. <ev...@us...> - 2010-04-30 15:26:41
|
Update of /cvsroot/rails/18xx/data/18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv6035/data/18EU Modified Files: Tiles.xml Log Message: Replaced XML of Goderich/Hamburg red tile #-939 by handmade XML including a City (not OffBoardCity). Index: Tiles.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Tiles.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Tiles.xml 8 Jan 2010 20:47:06 -0000 1.9 --- Tiles.xml 30 Apr 2010 15:26:32 -0000 1.10 *************** *** 1,228 **** ! <?xml version="1.0" encoding="UTF-8"?><Tiles><Tile colour="white" id="0" 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="fixed" id="-3" name="MF 3"> ! <Station id="city1" position="252" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile><Tile colour="fixed" id="-800" name="Rostock"> ! <Station id="city1" position="302" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </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="red" id="-939" name="Goderich"> ! <Track from="side3" gauge="normal" to="side1"/> ! <Track from="side3" gauge="normal" to="side2"/> ! <Track from="side2" gauge="normal" to="side1"/> ! </Tile><Tile colour="yellow" id="-3005" name="B/V"> ! <Station id="city1" position="102" slots="1" type="City" value="30"/> ! <Station id="city2" position="402" slots="1" type="City" value="30"/> ! <Track from="side3" gauge="normal" to="city2"/> ! <Track from="side0" gauge="normal" to="city1"/> ! </Tile><Tile colour="yellow" id="-3006" name="Paris"> ! <Station id="city1" position="002" slots="1" type="City" value="40"/> ! <Station id="city2" position="302" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile><Tile colour="yellow" id="3" name="3"> ! <Station id="city1" position="352" 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="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="yellow" id="201" name="201"> ! <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><Tile colour="yellow" id="202" name="202"> ! <Station id="city1" position="0" slots="1" type="City" value="30"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side2"/> ! </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="80" name="80"> ! <Track from="side1" gauge="normal" to="side2"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side2" gauge="normal" to="side3"/> ! </Tile><Tile colour="green" id="81" name="81"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side2" gauge="normal" to="side4"/> ! </Tile><Tile colour="green" id="82" name="82"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side0" gauge="normal" to="side5"/> ! <Track from="side2" gauge="normal" to="side5"/> ! </Tile><Tile colour="green" id="83" name="83"> ! <Track from="side2" gauge="normal" to="side4"/> ! <Track from="side2" gauge="normal" to="side5"/> ! <Track from="side4" 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="144" name="144"> ! <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="576" name="576"> ! <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="green" id="577" name="577"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile><Tile colour="green" id="578" name="578"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <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="579" name="579"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </Tile><Tile colour="green" id="580" name="580"> ! <Station id="city1" position="052" slots="1" type="City" value="60"/> ! <Station id="city2" position="252" slots="1" type="City" value="60"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="green" id="581" name="581"> ! <Station id="city1" position="152" slots="1" type="City" value="50"/> ! <Station id="city2" position="352" slots="1" type="City" value="50"/> ! <Station id="city3" position="552" slots="1" type="City" value="50"/> ! <Track from="city3" gauge="normal" to="side0"/> ! <Track from="city3" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="brown" id="145" name="145"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="brown" id="146" name="146"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="side5"/> ! </Tile><Tile colour="brown" id="147" name="147"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="544" name="544"> ! <Track from="side1" gauge="normal" to="side4"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side4" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side1"/> ! </Tile><Tile colour="brown" id="545" name="545"> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side4" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side5"/> ! <Track from="side5" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side4"/> ! </Tile><Tile colour="brown" id="546" name="546"> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side1"/> ! <Track from="side1" gauge="normal" to="side0"/> ! <Track from="side0" gauge="normal" to="side5"/> ! </Tile><Tile colour="brown" id="582" name="582"> ! <Station id="city1" position="0" slots="2" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </Tile><Tile colour="brown" id="583" name="583"> ! <Station id="city1" position="002" slots="2" type="City" value="80"/> ! <Station id="city2" position="302" slots="2" type="City" value="80"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile><Tile colour="brown" id="584" name="584"> ! <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="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></Tiles> \ No newline at end of file --- 1,278 ---- ! <?xml version="1.0" encoding="UTF-8"?> ! <Tiles> ! <Tile colour="white" id="0" 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="fixed" id="-3" name="MF 3"> ! <Station id="city1" position="252" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="fixed" id="-800" name="Rostock"> ! <Station id="city1" position="302" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </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="red" id="-939" name="Goderich"> ! <Station id="city1" position="0" slots="0" type="City" value="-1"/> ! <Track from="side1" gauge="normal" to="city1"/> ! <Track from="side2" gauge="normal" to="city1"/> ! <Track from="side3" gauge="normal" to="city1"/> ! </Tile> ! <Tile colour="yellow" id="-3005" name="B/V"> ! <Station id="city1" position="102" slots="1" type="City" value="30"/> ! <Station id="city2" position="402" slots="1" type="City" value="30"/> ! <Track from="side3" gauge="normal" to="city2"/> ! <Track from="side0" gauge="normal" to="city1"/> ! </Tile> ! <Tile colour="yellow" id="-3006" name="Paris"> ! <Station id="city1" position="002" slots="1" type="City" value="40"/> ! <Station id="city2" position="302" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile> ! <Tile colour="yellow" id="3" name="3"> ! <Station id="city1" position="352" 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="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="yellow" id="201" name="201"> ! <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> ! <Tile colour="yellow" id="202" name="202"> ! <Station id="city1" position="0" slots="1" type="City" value="30"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side2"/> ! </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="80" name="80"> ! <Track from="side1" gauge="normal" to="side2"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="green" id="81" name="81"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side2" gauge="normal" to="side4"/> ! </Tile> ! <Tile colour="green" id="82" name="82"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side0" gauge="normal" to="side5"/> ! <Track from="side2" gauge="normal" to="side5"/> ! </Tile> ! <Tile colour="green" id="83" name="83"> ! <Track from="side2" gauge="normal" to="side4"/> ! <Track from="side2" gauge="normal" to="side5"/> ! <Track from="side4" 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="144" name="144"> ! <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="576" name="576"> ! <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="green" id="577" name="577"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="green" id="578" name="578"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <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="579" name="579"> ! <Station id="city1" position="0" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </Tile> ! <Tile colour="green" id="580" name="580"> ! <Station id="city1" position="052" slots="1" type="City" value="60"/> ! <Station id="city2" position="252" slots="1" type="City" value="60"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="green" id="581" name="581"> ! <Station id="city1" position="152" slots="1" type="City" value="50"/> ! <Station id="city2" position="352" slots="1" type="City" value="50"/> ! <Station id="city3" position="552" slots="1" type="City" value="50"/> ! <Track from="city3" gauge="normal" to="side0"/> ! <Track from="city3" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="brown" id="145" name="145"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="brown" id="146" name="146"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="side5"/> ! </Tile> ! <Tile colour="brown" id="147" name="147"> ! <Station id="city1" position="0" type="Town" value="20"/> ! <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="544" name="544"> ! <Track from="side1" gauge="normal" to="side4"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side4" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side1"/> ! </Tile> ! <Tile colour="brown" id="545" name="545"> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side4"/> ! <Track from="side4" gauge="normal" to="side3"/> ! <Track from="side0" gauge="normal" to="side5"/> ! <Track from="side5" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side4"/> ! </Tile> ! <Tile colour="brown" id="546" name="546"> ! <Track from="side0" gauge="normal" to="side3"/> ! <Track from="side1" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side3"/> ! <Track from="side5" gauge="normal" to="side1"/> ! <Track from="side1" gauge="normal" to="side0"/> ! <Track from="side0" gauge="normal" to="side5"/> ! </Tile> ! <Tile colour="brown" id="582" name="582"> ! <Station id="city1" position="0" slots="2" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </Tile> ! <Tile colour="brown" id="583" name="583"> ! <Station id="city1" position="002" slots="2" type="City" value="80"/> ! <Station id="city2" position="302" slots="2" type="City" value="80"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile> ! <Tile colour="brown" id="584" name="584"> ! <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="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> ! </Tiles> \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-04-30 15:26:40
|
Update of /cvsroot/rails/18xx/data/1856 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv6035/data/1856 Modified Files: Tiles.xml Log Message: Replaced XML of Goderich/Hamburg red tile #-939 by handmade XML including a City (not OffBoardCity). Index: Tiles.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/Tiles.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Tiles.xml 11 Feb 2010 21:58:04 -0000 1.9 --- Tiles.xml 30 Apr 2010 15:26:32 -0000 1.10 *************** *** 1,297 **** ! <?xml version="1.0" encoding="UTF-8" standalone="no"?><Tiles><Tile colour="white" id="0" name="empty"/><Tile colour="white" id="-1" name="1 village"> ! <Station id="city1" position="002" type="Town"/> ! </Tile><Tile colour="white" id="-2" name="2 villages"> ! <Station id="city1" position="102" type="Town"/> ! <Station id="city2" position="302" 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="-11" name="B"> ! <Station id="city1" position="0" slots="1" type="City" value="30"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile><Tile colour="yellow" id="-20" name="2 cities"> ! <Station id="city1" position="002" slots="1" type="City"/> ! <Station id="city2" position="302" slots="1" type="City"/> ! </Tile><Tile colour="yellow" id="-56001" name="Toronto"> ! <Station id="city1" position="102" slots="1" type="City" value="30"/> ! <Station id="city2" position="402" slots="1" type="City" value="30"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </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="red" id="-939" name="Goderich"> ! <Track from="side3" gauge="normal" to="side1"/> ! <Track from="side3" gauge="normal" to="side2"/> ! <Track from="side2" gauge="normal" to="side1"/> ! </Tile><Tile colour="yellow" id="1" name="1"> ! <Station id="city1" position="408" type="Town" value="10"/> ! <Station id="city2" position="108" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="yellow" id="2" name="2"> ! <Station id="city1" position="302" type="Town" value="10"/> ! <Station id="city2" position="109" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile><Tile colour="yellow" id="3" name="3"> ! <Station id="city1" position="352" 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="55" name="55"> ! <Station id="city1" position="202" type="Town" value="10"/> ! <Station id="city2" position="302" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side0"/> ! </Tile><Tile colour="yellow" id="56" name="56"> ! <Station id="city1" position="407" type="Town" value="10"/> ! <Station id="city2" position="108" type="Town" value="10"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side2"/> ! </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="yellow" id="69" name="69"> ! <Station id="city1" position="407" type="Town" value="10"/> ! <Station id="city2" position="002" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side0"/> ! <Track from="city2" 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="17" name="17"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side3" gauge="normal" to="side5"/> ! </Tile><Tile colour="green" id="18" name="18"> ! <Track from="side3" gauge="normal" to="side0"/> ! <Track from="side4" gauge="normal" to="side5"/> ! </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="59" name="59"> ! <Station id="city1" position="052" slots="1" type="City" value="40"/> ! <Station id="city2" position="352" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="green" id="120" name="120"> ! <Station id="city1" position="052" slots="1" type="City" value="60"/> ! <Station id="city2" position="252" slots="1" type="City" value="60"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="green" id="121" name="121"> ! <Station id="city1" position="0" slots="2" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side4"/> ! </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="64" name="64"> ! <Station id="city1" position="401" slots="1" type="City" value="50"/> ! <Station id="city2" position="052" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side0"/> ! </Tile><Tile colour="brown" id="65" name="65"> ! <Station id="city1" position="501" slots="1" type="City" value="50"/> ! <Station id="city2" position="252" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="brown" id="66" name="66"> ! <Station id="city1" position="002" slots="1" type="City" value="50"/> ! <Station id="city2" position="452" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side5"/> ! </Tile><Tile colour="brown" id="67" name="67"> ! <Station id="city1" position="307" slots="1" type="City" value="50"/> ! <Station id="city2" position="502" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile><Tile colour="brown" id="68" name="68"> ! <Station id="city1" position="302" slots="1" type="City" value="50"/> ! <Station id="city2" position="502" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side0"/> ! </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="122" name="122"> ! <Station id="city1" position="002" slots="2" type="City" value="80"/> ! <Station id="city2" position="302" slots="2" type="City" value="80"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile><Tile colour="brown" id="125" name="125"> ! <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="side4"/> ! <Track from="city1" gauge="normal" to="side5"/> ! </Tile><Tile colour="brown" id="126" name="126"> ! <Station id="city1" position="0" slots="2" 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="brown" id="127" name="127"> ! <Station id="city1" position="0" slots="2" type="City" value="60"/> ! <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="123" name="123"> ! <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="side5"/> ! </Tile><Tile colour="gray" id="124" name="124"> ! <Station id="city1" position="0" slots="4" type="City" value="100"/> ! <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"/> ! </Tile></Tiles> \ No newline at end of file --- 1,364 ---- ! <?xml version="1.0" encoding="UTF-8" standalone="no"?> ! <Tiles> ! <Tile colour="white" id="0" name="empty"/> ! <Tile colour="white" id="-1" name="1 village"> ! <Station id="city1" position="002" type="Town"/> ! </Tile> ! <Tile colour="white" id="-2" name="2 villages"> ! <Station id="city1" position="102" type="Town"/> ! <Station id="city2" position="302" 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="-11" name="B"> ! <Station id="city1" position="0" slots="1" type="City" value="30"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="yellow" id="-20" name="2 cities"> ! <Station id="city1" position="002" slots="1" type="City"/> ! <Station id="city2" position="302" slots="1" type="City"/> ! </Tile> ! <Tile colour="yellow" id="-56001" name="Toronto"> ! <Station id="city1" position="102" slots="1" type="City" value="30"/> ! <Station id="city2" position="402" slots="1" type="City" value="30"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side1"/> ! </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="red" id="-939" name="Goderich"> ! <Station id="city1" position="0" slots="0" type="City" value="-1"/> ! <Track from="side1" gauge="normal" to="city1"/> ! <Track from="side2" gauge="normal" to="city1"/> ! <Track from="side3" gauge="normal" to="city1"/> ! </Tile> ! <Tile colour="yellow" id="1" name="1"> ! <Station id="city1" position="408" type="Town" value="10"/> ! <Station id="city2" position="108" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="yellow" id="2" name="2"> ! <Station id="city1" position="302" type="Town" value="10"/> ! <Station id="city2" position="109" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile> ! <Tile colour="yellow" id="3" name="3"> ! <Station id="city1" position="352" 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="55" name="55"> ! <Station id="city1" position="202" type="Town" value="10"/> ! <Station id="city2" position="302" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side0"/> ! </Tile> ! <Tile colour="yellow" id="56" name="56"> ! <Station id="city1" position="407" type="Town" value="10"/> ! <Station id="city2" position="108" type="Town" value="10"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side2"/> ! </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="yellow" id="69" name="69"> ! <Station id="city1" position="407" type="Town" value="10"/> ! <Station id="city2" position="002" type="Town" value="10"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side0"/> ! <Track from="city2" 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="17" name="17"> ! <Track from="side0" gauge="normal" to="side2"/> ! <Track from="side3" gauge="normal" to="side5"/> ! </Tile> ! <Tile colour="green" id="18" name="18"> ! <Track from="side3" gauge="normal" to="side0"/> ! <Track from="side4" gauge="normal" to="side5"/> ! </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="59" name="59"> ! <Station id="city1" position="052" slots="1" type="City" value="40"/> ! <Station id="city2" position="352" slots="1" type="City" value="40"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="green" id="120" name="120"> ! <Station id="city1" position="052" slots="1" type="City" value="60"/> ! <Station id="city2" position="252" slots="1" type="City" value="60"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="green" id="121" name="121"> ! <Station id="city1" position="0" slots="2" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side2"/> ! <Track from="city1" gauge="normal" to="side4"/> ! </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="64" name="64"> ! <Station id="city1" position="401" slots="1" type="City" value="50"/> ! <Station id="city2" position="052" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side0"/> ! </Tile> ! <Tile colour="brown" id="65" name="65"> ! <Station id="city1" position="501" slots="1" type="City" value="50"/> ! <Station id="city2" position="252" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side4"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="brown" id="66" name="66"> ! <Station id="city1" position="002" slots="1" type="City" value="50"/> ! <Station id="city2" position="452" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city2" gauge="normal" to="side4"/> ! <Track from="city2" gauge="normal" to="side5"/> ! </Tile> ! <Tile colour="brown" id="67" name="67"> ! <Station id="city1" position="307" slots="1" type="City" value="50"/> ! <Station id="city2" position="502" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side5"/> ! <Track from="city2" gauge="normal" to="side2"/> ! </Tile> ! <Tile colour="brown" id="68" name="68"> ! <Station id="city1" position="302" slots="1" type="City" value="50"/> ! <Station id="city2" position="502" slots="1" type="City" value="50"/> ! <Track from="city1" gauge="normal" to="side3"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side5"/> ! <Track from="city1" gauge="normal" to="side0"/> ! </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="122" name="122"> ! <Station id="city1" position="002" slots="2" type="City" value="80"/> ! <Station id="city2" position="302" slots="2" type="City" value="80"/> ! <Track from="city1" gauge="normal" to="side0"/> ! <Track from="city1" gauge="normal" to="side1"/> ! <Track from="city2" gauge="normal" to="side2"/> ! <Track from="city2" gauge="normal" to="side3"/> ! </Tile> ! <Tile colour="brown" id="125" name="125"> ! <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="side4"/> ! <Track from="city1" gauge="normal" to="side5"/> ! </Tile> ! <Tile colour="brown" id="126" name="126"> ! <Station id="city1" position="0" slots="2" 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="brown" id="127" name="127"> ! <Station id="city1" position="0" slots="2" type="City" value="60"/> ! <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="123" name="123"> ! <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="side5"/> ! </Tile> ! <Tile colour="gray" id="124" name="124"> ! <Station id="city1" position="0" slots="4" type="City" value="100"/> ! <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"/> ! </Tile> ! </Tiles> \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-04-30 15:22:50
|
Update of /cvsroot/rails/18xx/rails/util In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5010/rails/util Modified Files: Tag.java ConvertTilesXML.java Log Message: Replaced XML of Goderich/Hamburg red tile #-939 by handmade XML including a City (not OffBoardCity). Index: ConvertTilesXML.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/ConvertTilesXML.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ConvertTilesXML.java 4 Jun 2008 19:00:39 -0000 1.9 --- ConvertTilesXML.java 30 Apr 2010 15:22:42 -0000 1.10 *************** *** 26,29 **** --- 26,30 ---- private static List<String> directories = new ArrayList<String>(); private static String inputFilePath = "TileDictionary.xml"; + private static String handmadeFilePath = "HandmadeTiles.xml"; private static String outputFilePath = "Tiles.xml"; *************** *** 31,34 **** --- 32,38 ---- private static Map<String, String[]> stationMap; private static Map<String, String> junctionPosition; + + private static Map<Integer, Element> handmadeTiles + = new HashMap<Integer, Element>(); /** Maps non-edge non-station junctions to tracks ending there. */ *************** *** 162,169 **** private ConvertTilesXML() throws ConfigurationException { directories.add("tiles"); ! Element inputTopElement = ! Tag.findTopTagInFile(inputFilePath, directories, "tiles").getElement(); try { --- 166,183 ---- private ConvertTilesXML() throws ConfigurationException { + + int tileId; directories.add("tiles"); ! ! Tag handmadeTopTag = ! Tag.findTopTagInFile(handmadeFilePath, directories, "Tiles"); ! for (Tag tag : handmadeTopTag.getChildren("Tile")) { ! tileId = tag.getAttributeAsInteger("id"); ! handmadeTiles.put(tileId, tag.getElement()); ! } ! ! Tag inputTopElement = ! Tag.findTopTagInFile(inputFilePath, directories, "tiles"); try { *************** *** 187,199 **** } ! private void convertXML(Element inputElement, Document outputDoc) throws ConfigurationException { ! ! NodeList children = inputElement.getElementsByTagName("tile"); ! for (int i = 0; i < children.getLength(); i++) { ! Element inputTile = (Element) children.item(i); ! Element outputTile = outputDoc.createElement("Tile"); ! outputDoc.getDocumentElement().appendChild(outputTile); ! convertTile(inputTile, outputTile); } --- 201,220 ---- } ! private void convertXML(Tag inputTag, Document outputDoc) throws ConfigurationException { ! ! for (Tag tag : inputTag.getChildren("tile")) { ! int tileId = Integer.parseInt(tag.getChild("ID").getText()); ! if (handmadeTiles.containsKey(tileId)) { ! Element outputTile = handmadeTiles.get(tileId); ! Node dup = outputDoc.importNode(outputTile, true); ! outputDoc.getDocumentElement().appendChild(dup); ! System.out.println("Copied handmade tile #"+tileId); ! } else { ! Element inputTile = tag.getElement(); ! Element outputTile = outputDoc.createElement("Tile"); ! outputDoc.getDocumentElement().appendChild(outputTile); ! convertTile(inputTile, outputTile); ! } } Index: Tag.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/Tag.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Tag.java 31 Jan 2010 22:22:37 -0000 1.15 --- Tag.java 30 Apr 2010 15:22:42 -0000 1.16 *************** *** 383,393 **** } - /** - * @deprecated This is a stop-gap, needed until all XML parsing code has - * been converted to use Tag. This method is now only called from - * some external utilities. - * @return - */ - @Deprecated public Element getElement() { return element; --- 383,386 ---- |
From: Erik V. <ev...@us...> - 2010-04-30 15:22:50
|
Update of /cvsroot/rails/18xx/tiles In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5010/tiles Modified Files: Tiles.xml Added Files: HandmadeTiles.xml Log Message: Replaced XML of Goderich/Hamburg red tile #-939 by handmade XML including a City (not OffBoardCity). --- NEW FILE: HandmadeTiles.xml --- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Tiles> <Tile colour="red" id="-939" name="Goderich"> <Station id="city1" position="0" type="City" slots="0" value="-1"/> <Track from="side1" gauge="normal" to="city1"/> <Track from="side2" gauge="normal" to="city1"/> <Track from="side3" gauge="normal" to="city1"/> </Tile> </Tiles> Index: Tiles.xml =================================================================== RCS file: /cvsroot/rails/18xx/tiles/Tiles.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Tiles.xml 11 Mar 2010 23:16:01 -0000 1.27 --- Tiles.xml 30 Apr 2010 15:22:42 -0000 1.28 *************** *** 1,3 **** ! <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Tiles> <Tile colour="red" id="-909" name="OM straight"> --- 1,3 ---- ! <?xml version="1.0" encoding="UTF-8"?> <Tiles> <Tile colour="red" id="-909" name="OM straight"> *************** *** 1367,1372 **** <Track from="city2" gauge="normal" to="side4"/> <Track from="city2" gauge="normal" to="side3"/> - <Track from="side0" gauge="normal" to="city2"/> <Track from="city1" gauge="normal" to="side5"/> </Tile> <Tile colour="gray" id="168" name="168"> --- 1367,1372 ---- <Track from="city2" gauge="normal" to="side4"/> <Track from="city2" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side5"/> + <Track from="side0" gauge="normal" to="city2"/> </Tile> <Tile colour="gray" id="168" name="168"> *************** *** 3009,3015 **** <Tile colour="fixed" id="-9999" name="MF empty"/> <Tile colour="red" id="-939" name="Goderich"> ! <Track from="side3" gauge="normal" to="side1"/> ! <Track from="side3" gauge="normal" to="side2"/> ! <Track from="side2" gauge="normal" to="side1"/> </Tile> <Tile colour="red" id="-912" name="OMCity-2"> --- 3009,3016 ---- <Tile colour="fixed" id="-9999" name="MF empty"/> <Tile colour="red" id="-939" name="Goderich"> ! <Station id="city1" position="0" slots="0" type="City" value="-1"/> ! <Track from="side1" gauge="normal" to="city1"/> ! <Track from="side2" gauge="normal" to="city1"/> ! <Track from="side3" gauge="normal" to="city1"/> </Tile> <Tile colour="red" id="-912" name="OMCity-2"> |
From: Erik V. <ev...@us...> - 2010-04-30 09:35:43
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10874/rails/game Modified Files: OperatingRound.java Log Message: Removed use of redundant 'forcedExchange' TrainBuy attribute Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** OperatingRound.java 21 Apr 2010 19:16:44 -0000 1.123 --- OperatingRound.java 30 Apr 2010 09:35:35 -0000 1.124 *************** *** 1465,1469 **** // Does the company have room for another train? int trainLimit = operatingCompany.getCurrentTrainLimit(); ! if (!canBuyTrainNow() && !action.isForcedExchange()) { errMsg = LocalText.getText("WouldExceedTrainLimit", --- 1465,1469 ---- // Does the company have room for another train? int trainLimit = operatingCompany.getCurrentTrainLimit(); ! if (!canBuyTrainNow() && !action.isForExchange()) { errMsg = LocalText.getText("WouldExceedTrainLimit", *************** *** 2341,2346 **** boolean hasTrains = operatingCompany.getPortfolio().getNumberOfTrains() > 0; - boolean atTrainLimit = - operatingCompany.getNumberOfTrains() >= operatingCompany.getCurrentTrainLimit(); boolean canBuyTrainNow = canBuyTrainNow(); boolean presidentMayHelp = !hasTrains && operatingCompany.mustOwnATrain(); --- 2341,2344 ---- *************** *** 2383,2387 **** BuyTrain action = new BuyTrain(train, ipo, cost); action.setTrainsForExchange(exchangeableTrains); ! if (atTrainLimit) action.setForcedExchange(true); possibleActions.add(action); canBuyTrainNow = true; --- 2381,2385 ---- BuyTrain action = new BuyTrain(train, ipo, cost); action.setTrainsForExchange(exchangeableTrains); ! //if (atTrainLimit) action.setForcedExchange(true); possibleActions.add(action); canBuyTrainNow = true; |
From: Erik V. <ev...@us...> - 2010-04-30 09:35:43
|
Update of /cvsroot/rails/18xx/rails/game/action In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10874/rails/game/action Modified Files: BuyTrain.java Log Message: Removed use of redundant 'forcedExchange' TrainBuy attribute Index: BuyTrain.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/BuyTrain.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** BuyTrain.java 5 Mar 2010 20:49:41 -0000 1.19 --- BuyTrain.java 30 Apr 2010 09:35:36 -0000 1.20 *************** *** 30,34 **** --- 30,37 ---- transient private List<TrainI> trainsForExchange = null; private String[] trainsForExchangeUniqueIds; + + /** Obsolete, but left in for backwards compatibility of saved files */ private boolean forcedExchange = false; + private boolean presidentMustAddCash = false; private boolean presidentMayAddCash = false; *************** *** 81,88 **** } ! public BuyTrain setForcedExchange(boolean value) { ! forcedExchange = value; ! return this; ! } public void setForcedBuyIfNoRoute(boolean hasNoTrains) { --- 84,91 ---- } ! //public BuyTrain setForcedExchange(boolean value) { ! // forcedExchange = value; ! // return this; ! //} public void setForcedBuyIfNoRoute(boolean hasNoTrains) { *************** *** 148,154 **** } ! public boolean isForcedExchange() { ! return forcedExchange; ! } public boolean mustPresidentAddCash() { --- 151,157 ---- } ! //public boolean isForcedExchange() { ! // return forcedExchange; ! //} public boolean mustPresidentAddCash() { |
From: Erik V. <ev...@us...> - 2010-04-30 09:30:50
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10372/rails/ui/swing Modified Files: ORUIManager.java Log Message: Removed 'None' option on the "which train to exchange" question. Question suppressed if only one train available for exchange. Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ORUIManager.java 29 Apr 2010 22:15:11 -0000 1.69 --- ORUIManager.java 30 Apr 2010 09:30:40 -0000 1.70 *************** *** 1080,1105 **** if (train != null && buyAction.isForExchange()) { List<TrainI> oldTrains = buyAction.getTrainsForExchange(); ! List<String> oldTrainOptions = ! new ArrayList<String>(oldTrains.size()); ! String[] options = new String[oldTrains.size() + 1]; ! int jj = 0; ! if (!buyAction.isForcedExchange()) { ! options[jj++] = LocalText.getText("None"); ! } ! for (int j = 0; j < oldTrains.size(); j++) { ! options[jj + j] = ! LocalText.getText("N_Train", oldTrains.get(j).getName()); ! oldTrainOptions.add(options[jj + j]); ! } ! String exchangedTrainName = ! (String) JOptionPane.showInputDialog(orWindow, ! LocalText.getText("WHICH_TRAIN_EXCHANGE_FOR", ! Bank.format(price)), ! LocalText.getText("WHICH_TRAIN_EXCHANGE"), ! JOptionPane.QUESTION_MESSAGE, null, options, ! options[0]); ! int index = oldTrainOptions.indexOf(exchangedTrainName); ! if (index >= 0) { ! exchangedTrain = oldTrains.get(index); } } --- 1080,1106 ---- if (train != null && buyAction.isForExchange()) { List<TrainI> oldTrains = buyAction.getTrainsForExchange(); ! if (oldTrains.size() == 1) { ! exchangedTrain = oldTrains.get(0); ! } else { ! List<String> oldTrainOptions = ! new ArrayList<String>(oldTrains.size()); ! String[] options = new String[oldTrains.size() + 1]; ! int jj = 0; ! for (int j = 0; j < oldTrains.size(); j++) { ! options[jj + j] = ! LocalText.getText("N_Train", oldTrains.get(j).getName()); ! oldTrainOptions.add(options[jj + j]); ! } ! String exchangedTrainName = ! (String) JOptionPane.showInputDialog(orWindow, ! LocalText.getText("WHICH_TRAIN_EXCHANGE_FOR", ! Bank.format(price)), ! LocalText.getText("WHICH_TRAIN_TO_EXCHANGE"), ! JOptionPane.QUESTION_MESSAGE, null, options, ! options[0]); ! int index = oldTrainOptions.indexOf(exchangedTrainName); ! if (index >= 0) { ! exchangedTrain = oldTrains.get(index); ! } } } |
From: Erik V. <ev...@us...> - 2010-04-29 22:15:19
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv13687/rails/ui/swing Modified Files: ORUIManager.java Log Message: Fixed station numbering effect on token laying in multi-city tiles Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ORUIManager.java 29 Apr 2010 19:47:32 -0000 1.68 --- ORUIManager.java 29 Apr 2010 22:15:11 -0000 1.69 *************** *** 9,15 **** import org.jgrapht.graph.SimpleGraph; ! import rails.algorithms.NetworkEdge; ! import rails.algorithms.NetworkGraphBuilder; ! import rails.algorithms.NetworkVertex; import rails.game.*; import rails.game.action.*; --- 9,13 ---- import org.jgrapht.graph.SimpleGraph; ! import rails.algorithms.*; import rails.game.*; import rails.game.action.*; *************** *** 60,64 **** private boolean mapCorrectionEnabled = false; private MapCorrectionAction mapCorrectionAction = null; ! /** * Will be set true if a cancelled action does not need to be reported to --- 58,62 ---- private boolean mapCorrectionEnabled = false; private MapCorrectionAction mapCorrectionAction = null; ! /** * Will be set true if a cancelled action does not need to be reported to *************** *** 125,129 **** } } ! private SimpleGraph<NetworkVertex, NetworkEdge> getCompanyGraph(){ MapManager mapManager = gameUIManager.getGameManager().getMapManager(); --- 123,127 ---- } } ! private SimpleGraph<NetworkVertex, NetworkEdge> getCompanyGraph(){ MapManager mapManager = gameUIManager.getGameManager().getMapManager(); *************** *** 134,138 **** return graph; } ! public <T extends PossibleAction> void setMapRelatedActions(List<T> actions) { --- 132,136 ---- return graph; } ! public <T extends PossibleAction> void setMapRelatedActions(List<T> actions) { *************** *** 142,146 **** allowedTileLays.clear(); allowedTokenLays.clear(); ! for (T action : actions) { if (action instanceof LayTile) { --- 140,144 ---- allowedTileLays.clear(); allowedTokenLays.clear(); ! for (T action : actions) { if (action instanceof LayTile) { *************** *** 168,172 **** hexUpgrades = null; } ! if (allowedTokenLays.size() == 0 && tokenLayingEnabled) { /* Finish token laying step */ --- 166,170 ---- hexUpgrades = null; } ! if (allowedTokenLays.size() == 0 && tokenLayingEnabled) { /* Finish token laying step */ *************** *** 185,189 **** hexUpgrades = null; } ! if (allowedTileLays.size() > 0) { nextSubStep = ORUIManager.SELECT_HEX_FOR_TILE; --- 183,187 ---- hexUpgrades = null; } ! if (allowedTileLays.size() > 0) { nextSubStep = ORUIManager.SELECT_HEX_FOR_TILE; *************** *** 207,212 **** case (LayTile.SPECIAL_PROPERTY): SpecialPropertyI sp = layTile.getSpecialProperty(); ! if (sp == null || !(sp instanceof SpecialTileLay) || ! ((SpecialTileLay)sp).requiresConnection()) break; case (LayTile.LOCATION_SPECIFIC): --- 205,210 ---- case (LayTile.SPECIAL_PROPERTY): SpecialPropertyI sp = layTile.getSpecialProperty(); ! if (sp == null || !(sp instanceof SpecialTileLay) || ! ((SpecialTileLay)sp).requiresConnection()) break; case (LayTile.LOCATION_SPECIFIC): *************** *** 215,219 **** } } ! // standard upgrades if (mapHexes) { --- 213,217 ---- } } ! // standard upgrades if (mapHexes) { *************** *** 225,229 **** } } ! // activate upgrades for (MapHex hex:hexUpgrades) { --- 223,227 ---- } } ! // activate upgrades for (MapHex hex:hexUpgrades) { *************** *** 232,236 **** } } ! if (allowedTokenLays.size() > 0) { nextSubStep = ORUIManager.SELECT_HEX_FOR_TOKEN; --- 230,234 ---- } } ! if (allowedTokenLays.size() > 0) { nextSubStep = ORUIManager.SELECT_HEX_FOR_TOKEN; *************** *** 254,258 **** hexUpgrades.addAll(layToken.getLocations()); } ! // standard tokens if (mapHexes) { --- 252,256 ---- hexUpgrades.addAll(layToken.getLocations()); } ! // standard tokens if (mapHexes) { *************** *** 268,273 **** } } ! } ! setLocalStep(nextSubStep); tileLayingEnabled = allowedTileLays.size() > 0; --- 266,271 ---- } } ! } ! setLocalStep(nextSubStep); tileLayingEnabled = allowedTileLays.size() > 0; *************** *** 299,303 **** extraMessage = LocalText.getText("CorrectMap" + mapCorrectionAction.getStep().name()); } ! if (localStep == ORUIManager.SELECT_HEX_FOR_TILE) { /* Compose prompt for tile laying */ --- 297,301 ---- extraMessage = LocalText.getText("CorrectMap" + mapCorrectionAction.getStep().name()); } ! if (localStep == ORUIManager.SELECT_HEX_FOR_TILE) { /* Compose prompt for tile laying */ *************** *** 400,406 **** prepareBonusToken((LayBonusToken) actions.get(0)); ! } else if (actionType == LayBaseToken.class) { ! /* Only used outside the token laying step */ // Can currently handle only one location! --- 398,404 ---- prepareBonusToken((LayBonusToken) actions.get(0)); ! } else if (actionType == LayBaseToken.class) { ! /* Only used outside the token laying step */ // Can currently handle only one location! *************** *** 429,441 **** repayLoans ((RepayLoans)actions.get(0)); ! } else if (actionType == UseSpecialProperty.class) { ! useSpecialProperty ((UseSpecialProperty)actions.get(0)); ! } else if (actions.get(0) instanceof CorrectionAction) { ! processCorrectionAction((CorrectionAction)actions.get(0)); ! } --- 427,439 ---- repayLoans ((RepayLoans)actions.get(0)); ! } else if (actionType == UseSpecialProperty.class) { ! useSpecialProperty ((UseSpecialProperty)actions.get(0)); ! } else if (actions.get(0) instanceof CorrectionAction) { ! processCorrectionAction((CorrectionAction)actions.get(0)); ! } *************** *** 595,604 **** selectedHex.forcedRotateTile(); map.repaint(selectedHex.getBounds()); ! } else checkClickedHex = true; break; } if (checkClickedHex && clickedHex !=null && clickedHex != selectedHex) { ! map.selectHex(clickedHex); mapCorrectionAction.selectHex(clickedHex.getHexModel()); orWindow.process(mapCorrectionAction); --- 593,602 ---- selectedHex.forcedRotateTile(); map.repaint(selectedHex.getBounds()); ! } else checkClickedHex = true; break; } if (checkClickedHex && clickedHex !=null && clickedHex != selectedHex) { ! map.selectHex(clickedHex); mapCorrectionAction.selectHex(clickedHex.getHexModel()); orWindow.process(mapCorrectionAction); *************** *** 783,789 **** city.getNumber(), ((MapHex) selectedHex.getModel()).getConnectionString( ! selectedHex.getCurrentTile(), ! ((MapHex) selectedHex.getModel()).getCurrentTileRotation(), ! city.getNumber())) ; prompts.add(prompt); promptToCityMap.put(prompt, city); --- 781,787 ---- city.getNumber(), ((MapHex) selectedHex.getModel()).getConnectionString( ! selectedHex.getCurrentTile(), ! ((MapHex) selectedHex.getModel()).getCurrentTileRotation(), ! city.getRelatedStation().getNumber())) ; prompts.add(prompt); promptToCityMap.put(prompt, city); *************** *** 905,914 **** public void operatingCosts(){ ! List<String> textOC = new ArrayList<String>(); List<OperatingCost> actionOC = possibleActions.getType(OperatingCost.class); ! for (OperatingCost ac:actionOC) { ! String suggestedCostText; if (ac.isFreeEntryAllowed()) --- 903,912 ---- public void operatingCosts(){ ! List<String> textOC = new ArrayList<String>(); List<OperatingCost> actionOC = possibleActions.getType(OperatingCost.class); ! for (OperatingCost ac:actionOC) { ! String suggestedCostText; if (ac.isFreeEntryAllowed()) *************** *** 916,932 **** else suggestedCostText = Bank.format(ac.getAmount()); ! OperatingCost.OCType t = ac.getOCType(); ! if (t == OperatingCost.OCType.LAY_TILE) ! textOC.add(LocalText.getText("OCLayTile", suggestedCostText )); ! ! if (t == OperatingCost.OCType.LAY_BASE_TOKEN) ! textOC.add(LocalText.getText("OCLayBaseToken", suggestedCostText )); } ! if (!textOC.isEmpty()) { ! String chosenOption = (String) JOptionPane.showInputDialog(orWindow, LocalText.getText("OCSelectMessage"), LocalText.getText("OCSelectTitle"), --- 914,930 ---- else suggestedCostText = Bank.format(ac.getAmount()); ! OperatingCost.OCType t = ac.getOCType(); ! if (t == OperatingCost.OCType.LAY_TILE) ! textOC.add(LocalText.getText("OCLayTile", suggestedCostText )); ! ! if (t == OperatingCost.OCType.LAY_BASE_TOKEN) ! textOC.add(LocalText.getText("OCLayBaseToken", suggestedCostText )); } ! if (!textOC.isEmpty()) { ! String chosenOption = (String) JOptionPane.showInputDialog(orWindow, LocalText.getText("OCSelectMessage"), LocalText.getText("OCSelectTitle"), *************** *** 952,956 **** chosenAction.setAmount(chosenAction.getAmount()); } ! if (orWindow.process(chosenAction)) { updateMessage(); --- 950,954 ---- chosenAction.setAmount(chosenAction.getAmount()); } ! if (orWindow.process(chosenAction)) { updateMessage(); *************** *** 959,963 **** } } ! public void buyTrain() { --- 957,961 ---- } } ! public void buyTrain() { *************** *** 1212,1216 **** return; } ! if (tileLayingEnabled) { if (selectedHex == null) { --- 1210,1214 ---- return; } ! if (tileLayingEnabled) { if (selectedHex == null) { *************** *** 1321,1331 **** } } ! /** Used to process some special properties from the 'Special' menu */ /* In fact currently not used */ protected void useSpecialProperty (UseSpecialProperty action) { ! gameUIManager.processOnServer(action); ! } --- 1319,1329 ---- } } ! /** Used to process some special properties from the 'Special' menu */ /* In fact currently not used */ protected void useSpecialProperty (UseSpecialProperty action) { ! gameUIManager.processOnServer(action); ! } *************** *** 1333,1340 **** gameUIManager.processOnServer(action); ! } ! ! public void updateStatus() { --- 1331,1338 ---- gameUIManager.processOnServer(action); ! } ! ! public void updateStatus() { *************** *** 1372,1376 **** // initialize operating costs actions orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! // initial deactivation of MapTileCorrection Actions mapCorrectionEnabled = false; --- 1370,1374 ---- // initialize operating costs actions orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! // initial deactivation of MapTileCorrection Actions mapCorrectionEnabled = false; *************** *** 1388,1392 **** MapCorrectionAction action = (MapCorrectionAction) (possibleActions.getType(MapCorrectionAction.class)).get(0); ! mapCorrectionEnabled = true; mapCorrectionAction = action; --- 1386,1390 ---- MapCorrectionAction action = (MapCorrectionAction) (possibleActions.getType(MapCorrectionAction.class)).get(0); ! mapCorrectionEnabled = true; mapCorrectionAction = action; *************** *** 1486,1490 **** orPanel.enableLoanTaking (possibleActions.getType(TakeLoans.class).get(0)); } ! if (!mapCorrectionEnabled) setMapRelatedActions(mapRelatedActions); --- 1484,1488 ---- orPanel.enableLoanTaking (possibleActions.getType(TakeLoans.class).get(0)); } ! if (!mapCorrectionEnabled) setMapRelatedActions(mapRelatedActions); *************** *** 1526,1530 **** orPanel.initSpecialActions(); ! // Bonus tokens (and sometimes base tokens) can be laid anytime, // so we must also handle these outside the token laying step. if (possibleActions.contains(LayToken.class) --- 1524,1528 ---- orPanel.initSpecialActions(); ! // Bonus tokens (and sometimes base tokens) can be laid anytime, // so we must also handle these outside the token laying step. if (possibleActions.contains(LayToken.class) *************** *** 1534,1539 **** possibleActions.getType(LayToken.class); for (LayToken tAction : tokenActions) { ! ! if (tAction instanceof LayBaseToken && ((LayBaseToken)tAction).getType() == LayBaseToken.HOME_CITY) { // Forced action: select home city --- 1532,1537 ---- possibleActions.getType(LayToken.class); for (LayToken tAction : tokenActions) { ! ! if (tAction instanceof LayBaseToken && ((LayBaseToken)tAction).getType() == LayBaseToken.HOME_CITY) { // Forced action: select home city *************** *** 1542,1546 **** layBaseToken (lbt); return; ! } SpecialTokenLay stl = tAction.getSpecialProperty(); --- 1540,1544 ---- layBaseToken (lbt); return; ! } SpecialTokenLay stl = tAction.getSpecialProperty(); *************** *** 1569,1573 **** LocalText.getText("DestinationsReached")); } ! // Any other special properties, to be shown in the "Special" menu. // Example: 18AL AssignNamedTrains --- 1567,1571 ---- LocalText.getText("DestinationsReached")); } ! // Any other special properties, to be shown in the "Special" menu. // Example: 18AL AssignNamedTrains *************** *** 1578,1582 **** } } ! // Close Private if (possibleActions.contains(ClosePrivate.class)) { --- 1576,1580 ---- } } ! // Close Private if (possibleActions.contains(ClosePrivate.class)) { *************** *** 1585,1589 **** } } ! checkForGameSpecificActions(); --- 1583,1587 ---- } } ! checkForGameSpecificActions(); *************** *** 1683,1690 **** } ! public void updateUpgradesPanel(MapCorrectionAction action) { setLocalStep(MAP_CORRECTION); ! switch (action.getStep()) { case SELECT_HEX: --- 1681,1688 ---- } ! public void updateUpgradesPanel(MapCorrectionAction action) { setLocalStep(MAP_CORRECTION); ! switch (action.getStep()) { case SELECT_HEX: *************** *** 1724,1728 **** break; } ! log.debug("Active map tile correction"); upgradePanel.showCorrectionUpgrades(); --- 1722,1726 ---- break; } ! log.debug("Active map tile correction"); upgradePanel.showCorrectionUpgrades(); |
From: Stefan F. <ste...@us...> - 2010-04-29 19:48:25
|
Update of /cvsroot/rails/18xx/rails/util In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11547/rails/util Modified Files: ListAndFixSavedFiles.java Log Message: Added deletion of single rows of save files Displays updated version of save files after changes Index: ListAndFixSavedFiles.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/ListAndFixSavedFiles.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ListAndFixSavedFiles.java 22 Jan 2010 21:30:10 -0000 1.4 --- ListAndFixSavedFiles.java 29 Apr 2010 19:48:17 -0000 1.5 *************** *** 27,35 **** private JMenu fileMenu, editMenu; private JMenuItem saveItem, loadItem; ! private JMenuItem trimItem; private List<Object> savedObjects = new ArrayList<Object>(512); private List<PossibleAction> executedActions; ! private static String saveDirectory; private String filepath; --- 27,39 ---- private JMenu fileMenu, editMenu; private JMenuItem saveItem, loadItem; ! private JMenuItem trimItem, deleteItem; + private StringBuffer headerText = new StringBuffer(); + private List<Object> savedObjects = new ArrayList<Object>(512); private List<PossibleAction> executedActions; ! ! private int vbarPos; ! private static String saveDirectory; private String filepath; *************** *** 127,130 **** --- 131,143 ---- editMenu.add(trimItem); + deleteItem = new ActionMenuItem("Delete"); + deleteItem.setActionCommand("DELETE"); + deleteItem.setMnemonic(KeyEvent.VK_D); + deleteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, + ActionEvent.ALT_MASK)); + deleteItem.addActionListener(this); + deleteItem.setEnabled(true); + editMenu.add(deleteItem); + menuBar.add(fileMenu); menuBar.add(editMenu); *************** *** 144,147 **** --- 157,161 ---- saveDirectory = Config.get("save.directory"); + load(); *************** *** 215,222 **** (List<PossibleAction>) ois.readObject(); savedObjects.add(executedActions); ! i=0; ! for (PossibleAction action : executedActions) { ! add("Action "+(i++)+": "+action.toString()); ! } ois.close(); } catch (Exception e) { --- 229,235 ---- (List<PossibleAction>) ois.readObject(); savedObjects.add(executedActions); ! ! setReportText(true); ! ois.close(); } catch (Exception e) { *************** *** 230,243 **** public void add (String text) { if (text.length() > 0) { ! reportText.append(text); reportText.append("\n"); - scrollDown(); } } ! public void scrollDown () { SwingUtilities.invokeLater(new Runnable() { public void run() { ! messageWindow.vbar.setValue(messageWindow.vbar.getMaximum()); } }); --- 243,275 ---- public void add (String text) { if (text.length() > 0) { ! headerText.append(text); ! headerText.append("\n"); ! } ! } ! ! private void setReportText(boolean initial) { ! if (initial) ! vbarPos = -1; ! else ! vbarPos = this.vbar.getValue(); ! ! reportText.setText(headerText.toString()); ! // append actionText ! int i=0; ! for (PossibleAction action : executedActions) { ! reportText.append("Action "+(i++)+": "+action.toString()); reportText.append("\n"); } + scrollDown(vbarPos); } + ! public void scrollDown (int pos) { SwingUtilities.invokeLater(new Runnable() { public void run() { ! if (vbarPos == -1) ! messageWindow.vbar.setValue(messageWindow.vbar.getMaximum()); ! else ! messageWindow.vbar.setValue(vbarPos); } }); *************** *** 255,259 **** --- 287,302 ---- List<PossibleAction> toRemove = executedActions.subList(index, executedActions.size()); toRemove.clear(); + setReportText(false); + } catch (NumberFormatException e) { + } + } + } else if ("DELETE".equalsIgnoreCase(command)) { + String result = JOptionPane.showInputDialog("Enter action number to be deleted"); + if (Util.hasValue(result)) { + try { + int index = Integer.parseInt(result); + executedActions.remove(index); + setReportText(false); } catch (NumberFormatException e) { |
From: Stefan F. <ste...@us...> - 2010-04-29 19:47:40
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11444/rails/algorithms Modified Files: RevenueAdapter.java Log Message: Improved graphic support for revenue paths (undo, scaling). Index: RevenueAdapter.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueAdapter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RevenueAdapter.java 27 Apr 2010 23:24:50 -0000 1.7 --- RevenueAdapter.java 29 Apr 2010 19:47:32 -0000 1.8 *************** *** 336,343 **** // NetworkEdge edge = graph.getEdge(previousVertex, vertex); // if (edge != null) { - // edge = graph.getEdge(vertex, previousVertex); - // } - // if (edge != null) { // List<NetworkVertex> hiddenVertexes = edge.getHiddenVertexes(); // for (NetworkVertex v:hiddenVertexes) { // Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); --- 336,341 ---- // NetworkEdge edge = graph.getEdge(previousVertex, vertex); // if (edge != null) { // List<NetworkVertex> hiddenVertexes = edge.getHiddenVertexes(); + //// if (edge.getTarget() == vertex) Collections.reverse(hiddenVertexes); // for (NetworkVertex v:hiddenVertexes) { // Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); *************** *** 350,353 **** --- 348,352 ---- path.lineTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); } + previousVertex = vertex; } pathList.add(path); |
From: Stefan F. <ste...@us...> - 2010-04-29 19:47:40
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11444/rails/ui/swing/hexmap Modified Files: HexMap.java Log Message: Improved graphic support for revenue paths (undo, scaling). Index: HexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/HexMap.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** HexMap.java 20 Apr 2010 19:45:40 -0000 1.24 --- HexMap.java 29 Apr 2010 19:47:32 -0000 1.25 *************** *** 70,74 **** protected List<GeneralPath> trainPaths; protected Color[] trainColors = new Color[]{Color.CYAN, Color.PINK, Color.ORANGE, Color.GRAY}; ! protected Stroke trainStroke = new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); public void init(ORUIManager orUIManager, MapManager mapManager) { --- 70,76 ---- protected List<GeneralPath> trainPaths; protected Color[] trainColors = new Color[]{Color.CYAN, Color.PINK, Color.ORANGE, Color.GRAY}; ! protected int strokeWidth = 5; ! protected int strokeCap = BasicStroke.CAP_ROUND; ! protected int strokeJoin = BasicStroke.JOIN_BEVEL; public void init(ORUIManager orUIManager, MapManager mapManager) { *************** *** 151,154 **** --- 153,158 ---- // paint train paths Graphics2D g2 = (Graphics2D) g; + Stroke trainStroke = + new BasicStroke((int)(strokeWidth * zoomFactor), strokeCap, strokeJoin); g2.setStroke(trainStroke); int color = 0; |
From: Stefan F. <ste...@us...> - 2010-04-29 19:47:40
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11444/rails/ui/swing Modified Files: ORUIManager.java ORPanel.java Log Message: Improved graphic support for revenue paths (undo, scaling). Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** ORUIManager.java 16 Apr 2010 16:38:21 -0000 1.67 --- ORUIManager.java 29 Apr 2010 19:47:32 -0000 1.68 *************** *** 1370,1379 **** orPanel.initPrivateBuying(privatesCanBeBoughtNow); ! // sfy operating costs orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! // MapTileCorrection Actions mapCorrectionEnabled = false; mapCorrectionAction = null; if (possibleActions.contains(MapCorrectionAction.class)) { orPanel.initTileLayingStep(); --- 1370,1385 ---- orPanel.initPrivateBuying(privatesCanBeBoughtNow); ! // initialize operating costs actions orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! // initial deactivation of MapTileCorrection Actions mapCorrectionEnabled = false; mapCorrectionAction = null; + + // initial deactivation of revenue calculation + if (!possibleActions.contains(SetDividend.class)) { + orPanel.stopRevenueUpdate(); + } + if (possibleActions.contains(MapCorrectionAction.class)) { orPanel.initTileLayingStep(); Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ORPanel.java 27 Apr 2010 23:24:50 -0000 1.59 --- ORPanel.java 29 Apr 2010 19:47:32 -0000 1.60 *************** *** 712,717 **** --- 712,725 ---- } else if (source == zoomIn) { orWindow.getMapPanel().zoomIn(); + if (revenueAdapter != null) { + revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap()); + orUIManager.getMap().repaint(); + } } else if (source == zoomOut) { orWindow.getMapPanel().zoomOut(); + if (revenueAdapter != null) { + revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap()); + orUIManager.getMap().repaint(); + } } else if (command == NETWORK_INFO_CMD) { JMenuItem item = (JMenuItem)actor.getSource(); *************** *** 814,834 **** NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); ! ! mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); ! ! // revenue calculation example ! mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); ! RevenueAdapter ra = new RevenueAdapter(mapGraph); ! ! // set tokens ! List<TokenI> tokens = company.getTokens(); ! for (TokenI token:tokens){ ! NetworkVertex vertex = nwGraph.getVertex(token); ! if (vertex != null) ra.addStartVertex(vertex); ! } // run on railroad graph, does not work so far, thus use map graph ! // RevenueAdapter ra = new RevenueAdapter(graph); // get trains --- 822,845 ---- NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! // run on mapgraph ! // SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); ! // ! // mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); ! // ! // // revenue calculation example ! // mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); ! // RevenueAdapter ra = new RevenueAdapter(mapGraph); ! // ! // // set tokens ! // List<TokenI> tokens = company.getTokens(); ! // for (TokenI token:tokens){ ! // NetworkVertex vertex = nwGraph.getVertex(token); ! // if (vertex != null) ra.addStartVertex(vertex); ! // } // run on railroad graph, does not work so far, thus use map graph ! SimpleGraph<NetworkVertex, NetworkEdge> graph = nwGraph.getRailRoadGraph(company); ! graph = NetworkGraphBuilder.optimizeGraph(graph); ! RevenueAdapter ra = new RevenueAdapter(graph); // get trains *************** *** 856,863 **** public void stopRevenueUpdate() { orUIManager.getMap().setTrainPaths(null); ! revenueAdapter.removeRevenueListener(); ! revenueAdapter = null; ! revenueThread.interrupt(); ! revenueThread = null; } --- 867,878 ---- public void stopRevenueUpdate() { orUIManager.getMap().setTrainPaths(null); ! if (revenueThread != null) { ! revenueThread.interrupt(); ! revenueThread = null; ! } ! if (revenueAdapter != null) { ! revenueAdapter.removeRevenueListener(); ! revenueAdapter = null; ! } } |
From: Stefan F. <ste...@us...> - 2010-04-27 23:25:49
|
Update of /cvsroot/rails/18xx/data/18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv15762/data/18EU Modified Files: Game.xml Log Message: Changed count town rules for 18EU Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Game.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Game.xml 17 Feb 2010 00:34:52 -0000 1.19 --- Game.xml 27 Apr 2010 23:25:41 -0000 1.20 *************** *** 50,54 **** <Component name="TrainManager" class="rails.game.TrainManager"> <Defaults> ! <Reach base="stops" countTowns="yes"/> <Score towns="yes"/> </Defaults> --- 50,54 ---- <Component name="TrainManager" class="rails.game.TrainManager"> <Defaults> ! <Reach base="stops" countTowns="no"/> <Score towns="yes"/> </Defaults> |
From: Stefan F. <ste...@us...> - 2010-04-27 23:24:58
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv15565/rails/ui/swing Modified Files: ORPanel.java Log Message: Several fixes and improvements to the revenue calculator and the network iterator. Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** ORPanel.java 20 Apr 2010 19:45:40 -0000 1.58 --- ORPanel.java 27 Apr 2010 23:24:50 -0000 1.59 *************** *** 12,15 **** --- 12,16 ---- import org.jgrapht.Graph; + import org.jgrapht.graph.SimpleGraph; import rails.algorithms.*; *************** *** 594,598 **** NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! Graph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); if (companyName.equals("All")) { --- 595,599 ---- NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); if (companyName.equals("All")) { *************** *** 603,607 **** CompanyManagerI cm = gm.getCompanyManager(); PublicCompanyI company = cm.getPublicCompany(companyName); ! Graph<NetworkVertex, NetworkEdge> graph = nwGraph.getRailRoadGraph(company); // NetworkGraphBuilder.visualize(graph, "Network of " + companyName); --- 604,608 ---- CompanyManagerI cm = gm.getCompanyManager(); PublicCompanyI company = cm.getPublicCompany(companyName); ! SimpleGraph<NetworkVertex, NetworkEdge> graph = nwGraph.getRailRoadGraph(company); // NetworkGraphBuilder.visualize(graph, "Network of " + companyName); *************** *** 641,646 **** // ra.refreshRevenueCalculator(); ! ra.populateRevenueCalculator(company, gm.getPhaseManager().getPhaseByName("8"), true); ! // ra.populateRevenueCalculator(company, gm.getCurrentPhase(), true); log.info("Revenue Adapter:" + ra); revenueValue = ra.calculateRevenue(); --- 642,647 ---- // ra.refreshRevenueCalculator(); ! // ra.populateRevenueCalculator(company, gm.getPhaseManager().getPhaseByName("8"), true); ! ra.populateRevenueCalculator(company, gm.getCurrentPhase(), true); log.info("Revenue Adapter:" + ra); revenueValue = ra.calculateRevenue(); *************** *** 813,817 **** NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! Graph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); --- 814,818 ---- NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); nwGraph.generateGraph(mapManager.getHexesAsList()); ! SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph); |
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv15565/rails/algorithms Modified Files: NetworkTrain.java RevenueCalculator.java RevenueAdapter.java NetworkEdge.java NetworkIterator.java NetworkGraphBuilder.java Log Message: Several fixes and improvements to the revenue calculator and the network iterator. Index: RevenueCalculator.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueCalculator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RevenueCalculator.java 20 Apr 2010 22:07:09 -0000 1.7 --- RevenueCalculator.java 27 Apr 2010 23:24:50 -0000 1.8 *************** *** 12,18 **** // static vertex data ! private final int[] vertexValue; ! private final boolean[] vertexCity; ! private final boolean[] vertexTown; private final int[][] vertexNeighbors; --- 12,18 ---- // static vertex data ! private final int[][] vertexValueByTrain; // dimensions: vertexId, trainId ! private final boolean[] vertexMajor; ! private final boolean[] vertexMinor; private final int[][] vertexNeighbors; *************** *** 28,41 **** // static train data ! private final int[] trainMaxCities; ! private final int[] trainMaxTowns; ! private final boolean[] trainIgnoreTowns; ! private final int[] trainMultiplyCities; ! private final int[] trainMultiplyTowns; // dynamic train data private final int[] trainCurrentValue; ! private final int[] trainCities; ! private final int[] trainTowns; private final boolean[][] trainVisited; private final int[][] trainVertexStack; --- 28,39 ---- // static train data ! private final int[] trainMaxMajors; ! private final int[] trainMaxMinors; ! private final boolean[] trainIgnoreMinors; // dynamic train data private final int[] trainCurrentValue; ! private final int[] trainMajors; ! private final int[] trainMinors; private final boolean[][] trainVisited; private final int[][] trainVertexStack; *************** *** 44,54 **** private final int [] trainStartEdge; ! // dynamic run data private int finalTrain; private boolean useRevenuePrediction; private int currentBestValue; private final int [][] currentBestRun; private int countVisits; private int countEdges; --- 42,61 ---- private final int [] trainStartEdge; ! // run settings ! private int startTrain; private int finalTrain; private boolean useRevenuePrediction; + // current best run results private int currentBestValue; private final int [][] currentBestRun; + // prediction data + private int[] maxCumulatedTrainRevenues; + private int[][] maxMajorRevenues; // dimensions trainId x nb vertex; + private int[][] maxMinorRevenues; // dimensions trainId x nb vertex; + private int[][] maxBonusRevenues; // dimensions trainId x nb bonuses + + // statistic data private int countVisits; private int countEdges; *************** *** 57,65 **** private int nbPredictions; - // prediction data - private int[] maxCityRevenues; - private int[] maxTownRevenues; - private int[] maxTrainRevenues; - // revenue Adapter private RevenueAdapter revenueAdapter; --- 64,67 ---- *************** *** 87,93 **** // initialize all required variables ! vertexValue = new int[nbVertexes]; ! vertexCity = new boolean[nbVertexes]; ! vertexTown = new boolean[nbVertexes]; vertexNeighbors = new int[nbVertexes][maxNeighbors]; --- 89,95 ---- // initialize all required variables ! vertexValueByTrain = new int[nbVertexes][nbTrains]; ! vertexMajor = new boolean[nbVertexes]; ! vertexMinor = new boolean[nbVertexes]; vertexNeighbors = new int[nbVertexes][maxNeighbors]; *************** *** 96,108 **** edgeUsed = new boolean[nbVertexes][nbVertexes]; ! trainCities = new int[nbTrains]; ! trainTowns = new int[nbTrains]; ! trainIgnoreTowns = new boolean[nbTrains]; ! trainMultiplyCities = new int[nbTrains]; ! trainMultiplyTowns = new int[nbTrains]; trainCurrentValue = new int[nbTrains]; ! trainMaxCities = new int[nbTrains]; ! trainMaxTowns = new int[nbTrains]; trainVisited = new boolean[nbTrains][nbVertexes]; trainVertexStack = new int[nbTrains][nbVertexes]; --- 98,108 ---- edgeUsed = new boolean[nbVertexes][nbVertexes]; ! trainMaxMajors = new int[nbTrains]; ! trainMaxMinors = new int[nbTrains]; ! trainIgnoreMinors = new boolean[nbTrains]; trainCurrentValue = new int[nbTrains]; ! trainMajors = new int[nbTrains]; ! trainMinors = new int[nbTrains]; trainVisited = new boolean[nbTrains][nbVertexes]; trainVertexStack = new int[nbTrains][nbVertexes]; *************** *** 114,124 **** useRevenuePrediction = false; - } ! void setVertex(int id, int value, boolean city, boolean town, int[]neighbors) { ! vertexValue[id] = value; ! vertexCity[id] = city; ! vertexTown[id] = town; vertexNeighbors[id] = neighbors; } --- 114,125 ---- useRevenuePrediction = false; } ! void setVertex(int id, int value, boolean major, boolean minor, int[] neighbors) { ! for (int j=0; j < nbTrains; j++) { ! vertexValueByTrain[id][j] = value; ! } ! vertexMajor[id] = major; ! vertexMinor[id] = minor; vertexNeighbors[id] = neighbors; } *************** *** 133,149 **** } ! void setTrain(int id, int cities, int towns, boolean ingoreTowns, int multiplyCities, int multiplyTowns) { ! trainMaxCities[id] = cities; ! trainMaxTowns[id] = towns; ! trainIgnoreTowns[id] = ingoreTowns; ! trainMultiplyCities[id] = multiplyCities; ! trainMultiplyTowns[id] = multiplyTowns; } ! void setPredictionData(int[] maxCityRevenues, int[] maxTownRevenues) { ! this.maxCityRevenues = maxCityRevenues; ! this.maxTownRevenues = maxTownRevenues; ! useRevenuePrediction = true; ! } int[][] getOptimalRun() { --- 134,154 ---- } ! void setTrain(int id, int majors, int minors, boolean ignoreMinors, int multiplyMajors, int multiplyMinors) { ! trainMaxMajors[id] = majors; ! trainMaxMinors[id] = minors; ! trainIgnoreMinors[id] = ignoreMinors; ! ! for (int j=0; j < nbVertexes; j++) { ! if (vertexMajor[id]) { ! vertexValueByTrain[j][id] = vertexValueByTrain[j][id] * multiplyMajors; ! } ! if (vertexMinor[id]) { ! vertexValueByTrain[j][id] = vertexValueByTrain[j][id] * multiplyMinors; ! } ! } } ! // void setPredictionData(int[] maxMajorRevenues, int[] maxMinorRevenues) { ! // } int[][] getOptimalRun() { *************** *** 169,188 **** revenueAdapter.notifyRevenueListener(revenue, finalResult); } ! int calculateRevenue(int startTrain, int finalTrain) { ! log.info("RC: calculateRevenue trains from " + startTrain + " to " + finalTrain); nbEvaluations = 0; nbPredictions = 0; nbEdges = 0; ! // initialize maximum train revenues ! if (useRevenuePrediction) { ! maxTrainRevenues = new int[nbTrains]; ! for (int j=0; j < nbTrains; j++) { ! maxTrainRevenues[j] = maxCityRevenues[trainMaxCities[j]] * trainMultiplyCities[j] + ! maxTownRevenues[trainMaxTowns[j]] * trainMultiplyTowns[j]; ! } } this.finalTrain = finalTrain; runTrain(startTrain); --- 174,264 ---- revenueAdapter.notifyRevenueListener(revenue, finalResult); } + + private int[] bestRevenues(int[] values, int length) { + int[] bestRevenues = new int[length + 1]; + Arrays.sort(values); + int cumulatedRevenues = 0; + for (int j=1; j <= length ; j++) { + cumulatedRevenues += values[values.length - j]; + bestRevenues[j] = cumulatedRevenues; + } + log.info(Arrays.toString(bestRevenues)); + return bestRevenues; + } ! private void initRevenueValues(int startTrain, int finalTrain){ ! ! // intialize values ! maxMajorRevenues = new int[nbTrains][nbVertexes]; ! maxMinorRevenues = new int[nbTrains][nbVertexes]; ! for (int t=startTrain; t <= finalTrain; t++) { ! int[] majorValues = new int[nbVertexes]; ! int[] minorValues = new int[nbVertexes]; ! int[] bonusValues = new int[nbVertexes]; ! int major = 0, minor = 0, bonus = 0; ! for (int v=0; v < nbVertexes; v++) { ! if (vertexValueByTrain[v][t] == 0) continue; ! if (vertexMajor[v]) ! majorValues[major++] = vertexValueByTrain[v][t]; ! else if (vertexMinor[v]) ! minorValues[minor++] = vertexValueByTrain[v][t]; ! else ! bonusValues[bonus++] = vertexValueByTrain[v][t]; ! } ! maxMajorRevenues[t] = bestRevenues(majorValues, trainMaxMajors[t]); ! maxMinorRevenues[t] = bestRevenues(minorValues, trainMaxMinors[t]); ! maxCumulatedTrainRevenues[t] = maxMajorRevenues[t][trainMaxMajors[t]] + maxMinorRevenues[t][trainMaxMinors[t]]; ! } ! } ! ! void initialPredictionRuns(int startTrain, int finalTrain) { + if (startTrain > finalTrain) return; + + useRevenuePrediction = true; + this.maxCumulatedTrainRevenues = new int[nbTrains]; + initRevenueValues(startTrain, finalTrain); + + if (startTrain == finalTrain) return; + + // start prediction runs nbEvaluations = 0; nbPredictions = 0; nbEdges = 0; ! log.info("RC: start individual prediction Runs"); ! int cumulatedRevenues = 0; ! int[] maxSingleTrainRevenues = new int[nbTrains]; ! for (int j=finalTrain; j >= startTrain; j--) { ! this.startTrain = j; ! this.finalTrain = j; ! currentBestValue = 0; ! runTrain(j); ! log.info("RC: Best prediction run of train number " + j + " value = " + currentBestValue); ! maxSingleTrainRevenues[j] = currentBestValue; ! cumulatedRevenues += currentBestValue; ! maxCumulatedTrainRevenues[j] = cumulatedRevenues; } + if (startTrain == finalTrain-1) return; + + log.info("RC: start combined prediction runs"); + this.finalTrain = finalTrain; + for (int j=finalTrain - 1; j > startTrain; j--) { + this.startTrain = j; + currentBestValue = 0; + runTrain(j); + log.info("RC: Best prediction run until train nb. " + j + " value = " + currentBestValue); + maxCumulatedTrainRevenues[j] = currentBestValue; + maxCumulatedTrainRevenues[j-1] = currentBestValue + maxSingleTrainRevenues[j-1]; + } + } + + int calculateRevenue(int startTrain, int finalTrain) { + log.info("RC: calculateRevenue trains from " + startTrain + " to " + finalTrain); + + nbEvaluations = 0; nbPredictions = 0; nbEdges = 0; + + this.startTrain = startTrain; this.finalTrain = finalTrain; + runTrain(startTrain); *************** *** 192,199 **** return currentBestValue; } ! private void runTrain(int trainId) { log.debug("RC: runTrain " + trainId); // initialize the positions trainStackPos[trainId] = 0; --- 268,279 ---- return currentBestValue; } ! private void runTrain(int trainId) { log.debug("RC: runTrain " + trainId); + // initialize lengths + trainMajors[trainId] = trainMaxMajors[trainId]; + trainMinors[trainId] = trainMaxMinors[trainId]; + // initialize the positions trainStackPos[trainId] = 0; *************** *** 237,242 **** --- 317,330 ---- finalizeVertex(trainId, vertexId, valueStation); encounterVertex(trainId, vertexId, false); + // keep them on the visited vertex list to avoid route duplication + trainVisited[trainId][vertexId] = true; log.debug("RC: finished startVertex " + vertexId + " for train " +trainId); } + + for (int i=0; i < startVertexes.length; i++) { + // remove all of them from the visited vertex list + trainVisited[trainId][startVertexes[i]] = false; + } + log.debug("RC: finishTrain " + trainId); } *************** *** 308,312 **** } // 2b. restart at startVertex for bottom part ! if (valueStation && trainBottomPos[trainId] == 0 && (vertexCity[vertexId] || vertexTown[vertexId])){ runBottom(trainId); } --- 396,400 ---- } // 2b. restart at startVertex for bottom part ! if (valueStation && trainBottomPos[trainId] == 0){ runBottom(trainId); } *************** *** 327,357 **** // set visit to true if arriving, otherwise you leave trainVisited[trainId][vertexId] = arrive; ! ! boolean valueVertex = false; if (arrive) { ! if (vertexCity[vertexId]) { ! trainCities[trainId]++; ! trainCurrentValue[trainId] += vertexValue[vertexId] * trainMultiplyCities[trainId]; ! valueVertex = true; ! } else if (vertexTown[vertexId] && !trainIgnoreTowns[trainId]) { ! trainTowns[trainId]++; ! trainCurrentValue[trainId] += vertexValue[vertexId] * trainMultiplyTowns[trainId]; valueVertex = true; } trainVertexStack[trainId][trainStackPos[trainId]++] = vertexId; // push to stack countVisits++; } else { ! if (vertexCity[vertexId]) { ! trainCities[trainId]--; ! trainCurrentValue[trainId] -= vertexValue[vertexId] * trainMultiplyCities[trainId]; ! valueVertex = true; ! } else if (vertexTown[vertexId] && !trainIgnoreTowns[trainId] ) { ! trainTowns[trainId]--; ! trainCurrentValue[trainId] -= vertexValue[vertexId] * trainMultiplyTowns[trainId]; valueVertex = true; } trainStackPos[trainId]--; // pull from stack countVisits--; ! } log.debug("RC: Count Visits = " + countVisits); return valueVertex; --- 415,448 ---- // set visit to true if arriving, otherwise you leave trainVisited[trainId][vertexId] = arrive; ! ! boolean valueVertex; if (arrive) { ! if (vertexValueByTrain[vertexId][trainId] == 0) { ! valueVertex = false; ! } else { valueVertex = true; + trainCurrentValue[trainId] += vertexValueByTrain[vertexId][trainId]; + } + if (vertexMajor[vertexId]) + trainMajors[trainId]--; + if (vertexMinor[vertexId]) { + trainMinors[trainId]--; } trainVertexStack[trainId][trainStackPos[trainId]++] = vertexId; // push to stack countVisits++; } else { ! if (vertexValueByTrain[vertexId][trainId] == 0) { ! valueVertex = false; ! } else { valueVertex = true; + trainCurrentValue[trainId] -= vertexValueByTrain[vertexId][trainId]; } + if (vertexMajor[vertexId]) + trainMajors[trainId]++; + if (vertexMinor[vertexId]) + trainMinors[trainId]++; trainStackPos[trainId]--; // pull from stack countVisits--; ! } log.debug("RC: Count Visits = " + countVisits); return valueVertex; *************** *** 404,427 **** private Terminated trainTerminated(int trainId) { Terminated terminated = Terminated.NotYet; ! if (trainIgnoreTowns[trainId]) { // express trains ! if (trainCities[trainId] == trainMaxCities[trainId]) ! terminated = Terminated.WithEvaluation; ! } else if (trainTowns[trainId] == 0) { ! // default train ! if (trainCities[trainId] + trainTowns[trainId] == trainMaxCities[trainId]) terminated = Terminated.WithEvaluation; ! } else { ! // plus trains ! if (trainCities[trainId] > trainMaxCities[trainId]){ terminated = Terminated.WithoutEvaluation; ! } else if (trainCities[trainId] + trainTowns[trainId] == ! trainMaxCities[trainId] + trainMaxTowns[trainId] ) terminated = Terminated.WithEvaluation; } if (terminated != Terminated.NotYet) { log.debug ("RC: Train " + trainId + " has terminated: " + ! "cities = " + trainCities[trainId] + " towns = " + trainTowns[trainId] + ! "maxCities = " + trainMaxCities[trainId] + "maxTowns = " + trainMaxTowns[trainId]); } return terminated; --- 495,511 ---- private Terminated trainTerminated(int trainId) { Terminated terminated = Terminated.NotYet; ! if (trainIgnoreMinors[trainId]) { // express trains ! if (trainMajors[trainId] == 0) terminated = Terminated.WithEvaluation; ! } else { // default and plus trains ! if (trainMajors[trainId] < 0){ terminated = Terminated.WithoutEvaluation; ! } else if (trainMajors[trainId] + trainMinors[trainId] == 0) terminated = Terminated.WithEvaluation; } if (terminated != Terminated.NotYet) { log.debug ("RC: Train " + trainId + " has terminated: " + ! "majors = " + trainMajors[trainId] + " minors = " + trainMinors[trainId]); } return terminated; *************** *** 431,436 **** log.debug("RC: No more edges found at " + vertexId + " for train " + trainId); - if (!vertexCity[vertexId] && !vertexTown[vertexId]) return; - if (trainId == finalTrain) { if (evaluate) evaluateResults(); --- 515,518 ---- *************** *** 443,454 **** // sum to total value int totalValue = 0; ! for (int j = 0; j <= finalTrain; j++) { ! if (trainCities[j] + trainTowns[j] <= 1) { ! log.debug("RC: Train " + j + " has no value / does not have 2+ stations"); } else { ! totalValue += trainCurrentValue[j]; ! log.debug("RC: Train " + j + " has value of " + trainCurrentValue); } } nbEvaluations++; log.debug("RC: current total value " + totalValue); --- 525,538 ---- // sum to total value int totalValue = 0; ! for (int j = startTrain; j <= finalTrain; j++) { ! if (trainIgnoreMinors[j]) { ! if (trainMaxMajors[j] - trainMajors[j] >= 2) ! totalValue += trainCurrentValue[j]; } else { ! if (trainMaxMajors[j] + trainMaxMinors[j] - trainMajors[j] - trainMinors[j] >= 2) ! totalValue += trainCurrentValue[j]; } } + nbEvaluations++; log.debug("RC: current total value " + totalValue); *************** *** 474,512 **** // predict revenues and returns true if best value can still be exceeded private boolean predictRevenues(int trainId){ int totalValue = 0; ! for (int j = 0; j <= finalTrain; j++) { ! int trainValue; ! if (j < trainId) { // train has run already => use realized values ! trainValue = trainCurrentValue[j]; ! } else if (j > trainId) { // train is in the future => use maximum values ! trainValue = maxTrainRevenues[j]; ! } else { // the current train ! if (trainIgnoreTowns[j]) { ! // express train ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j] ] * trainMultiplyCities[j]; ! } else if (trainMaxTowns[j] == 0) { ! // default train ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j] - trainTowns[j] ] * trainMultiplyCities[j]; ! } else { ! // plus trains (or capped default trains) ! int townDiff = trainMaxTowns[j] - trainTowns[j]; ! if (townDiff > 0) { ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j] + ! maxTownRevenues[trainMaxTowns[j] - trainTowns[j]] * trainMultiplyTowns[j]; ! } else if (townDiff == 0) { ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j]; ! } else { // negative townDiff, thus too many towns already visited ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j] + townDiff] * trainMultiplyCities[j]; ! } ! } ! trainValue = Math.min(trainValue, maxTrainRevenues[j]); } - log.debug("RC: Train " + j + " has value of " + trainValue); - totalValue += trainValue; } --- 558,594 ---- // predict revenues and returns true if best value can still be exceeded private boolean predictRevenues(int trainId){ + // the potential revenues of the future trains int totalValue = 0; ! if (trainId < finalTrain) ! totalValue = maxCumulatedTrainRevenues[trainId + 1]; ! ! // predict the current train ! int trainValue = trainCurrentValue[trainId]; ! if (trainIgnoreMinors[trainId]) { ! // express train ! trainValue += maxMajorRevenues[trainId][trainMajors[trainId]]; ! } else { ! // default and plus trains ! if (trainMinors[trainId] > 0){ ! trainValue += maxMajorRevenues[trainId][trainMajors[trainId]]; ! trainValue += maxMinorRevenues[trainId][trainMinors[trainId]]; ! } else { // <= 0 ! trainValue += maxMajorRevenues[trainId][trainMajors[trainId] + trainMinors[trainId]]; ! } ! } ! log.debug("RC: Current train has predicted value of " + trainValue); ! ! // maximum value for the trainId including future trains ! totalValue = Math.min(totalValue + trainValue, maxCumulatedTrainRevenues[trainId]); ! ! // and add the past trains: current realized values ! for (int j = startTrain; j < trainId; j++) { ! if (trainIgnoreMinors[j]) { ! if (trainMaxMajors[j] - trainMajors[j] >= 2) ! totalValue += trainCurrentValue[j]; ! } else { ! if (trainMaxMajors[j] + trainMaxMinors[j] - trainMajors[j] - trainMinors[j] >= 2) ! totalValue += trainCurrentValue[j]; } } *************** *** 524,539 **** StringBuffer buffer = new StringBuffer(); ! buffer.append("vertexValues:" + Arrays.toString(vertexValue) + "\n"); ! buffer.append("vertexCity:" + Arrays.toString(vertexCity) + "\n"); ! buffer.append("vertexTown:" + Arrays.toString(vertexTown) + "\n"); buffer.append("vertexEdges:" + Arrays.deepToString(vertexNeighbors) + "\n"); // buffer.append("edgeGreedy:" + Arrays.deepToString(edgeGreedy)); // buffer.append("edgeDistance:" + Arrays.deepToString(edgeDistance)); buffer.append("startVertexes:" + Arrays.toString(startVertexes) + "\n"); ! buffer.append("trainMaxCities:" + Arrays.toString(trainMaxCities) + "\n"); ! buffer.append("trainMaxTowns:" + Arrays.toString(trainMaxTowns) + "\n"); ! buffer.append("trainIgnoreTowns:" + Arrays.toString(trainIgnoreTowns) + "\n"); ! buffer.append("maxCityRevenues:" + Arrays.toString(maxCityRevenues) + "\n"); ! buffer.append("maxTownRevenues:" + Arrays.toString(maxTownRevenues) + "\n"); return buffer.toString(); --- 606,619 ---- StringBuffer buffer = new StringBuffer(); ! buffer.append("vertexValuesByTrain:" + Arrays.deepToString(vertexValueByTrain) + "\n"); ! buffer.append("vertexMajor:" + Arrays.toString(vertexMajor) + "\n"); ! buffer.append("vertexMinor:" + Arrays.toString(vertexMinor) + "\n"); buffer.append("vertexEdges:" + Arrays.deepToString(vertexNeighbors) + "\n"); // buffer.append("edgeGreedy:" + Arrays.deepToString(edgeGreedy)); // buffer.append("edgeDistance:" + Arrays.deepToString(edgeDistance)); buffer.append("startVertexes:" + Arrays.toString(startVertexes) + "\n"); ! buffer.append("trainMaxMajors:" + Arrays.toString(trainMaxMajors) + "\n"); ! buffer.append("trainMaxMinors:" + Arrays.toString(trainMaxMinors) + "\n"); ! buffer.append("trainIgnoreMinors:" + Arrays.toString(trainIgnoreMinors) + "\n"); return buffer.toString(); Index: NetworkIterator.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkIterator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkIterator.java 19 Apr 2010 19:35:38 -0000 1.4 --- NetworkIterator.java 27 Apr 2010 23:24:50 -0000 1.5 *************** *** 16,54 **** AbstractGraphIterator<NetworkVertex, NetworkEdge> { ! /** ! * Standard vertex visit state enumeration. ! * Copied from CrossComponentIterator due to visibility for generic definition above ! */ ! protected static enum VisitColor ! { ! /** ! * Vertex has not been returned via iterator yet. ! */ ! WHITE, ! /** ! * Vertex has been returned via iterator, but we're ! * not done with all of its out-edges yet. ! */ ! GRAY, ! /** ! * Vertex has been returned via iterator, and we're ! * done with all of its out-edges. ! */ ! BLACK } ! ! /** ! * Stores the vertices that have been seen during iteration and ! * some additional traversal info regarding each vertex. ! */ ! private Map<NetworkVertex, VisitColor> seen = new HashMap<NetworkVertex, VisitColor>(); ! private Map<NetworkVertex, Boolean> mustUseGreedy = new HashMap<NetworkVertex, Boolean>(); private NetworkVertex startVertex; private final PublicCompanyI company; private final Graph<NetworkVertex, NetworkEdge> graph; - - /** LIFO stack for DFS */ - private List<NetworkVertex> stack = new ArrayList<NetworkVertex>(); protected static Logger log = --- 16,33 ---- AbstractGraphIterator<NetworkVertex, NetworkEdge> { ! public static enum greedyState { ! seen, ! nonGreedy, ! greedy, ! done } ! private NetworkVertex startVertex; + private List<NetworkVertex> stack = new ArrayList<NetworkVertex>(); + private List<Boolean> greedyStack = new ArrayList<Boolean>(); + private Map<NetworkVertex, greedyState> seen = new HashMap<NetworkVertex, greedyState>(); private final PublicCompanyI company; private final Graph<NetworkVertex, NetworkEdge> graph; protected static Logger log = *************** *** 95,99 **** } ! return !isConnectedComponentExhausted(); } --- 74,85 ---- } ! int i = stack.size() - 1; ! while (i >= 0) { ! if (stack.get(i) != null) ! break; ! else ! i = i - 2; ! } ! return i >=0; } *************** *** 108,117 **** if (hasNext()) { ! NetworkVertex nextVertex = provideNextVertex(); ! VisitColor previousColor = putSeenData(nextVertex , VisitColor.GRAY); ! addUnseenChildrenOf(nextVertex, previousColor); return nextVertex; --- 94,113 ---- if (hasNext()) { + NetworkVertex nextVertex; + while (true) { + nextVertex = stack.remove(stack.size() - 1); + if (nextVertex != null) + break; + stack.remove(stack.size() - 1); + } ! log.debug("Iterator: provides next vertex" + nextVertex); ! boolean nextGreedy = greedyStack.remove(greedyStack.size() - 1); ! putSeenData(nextVertex, nextGreedy); ! stack.add(nextVertex); ! stack.add(null); // add sentinel that we know when we are ready ! addUnseenChildrenOf(nextVertex, nextGreedy); return nextVertex; *************** *** 121,149 **** } - /** - * Access the data stored for a seen vertex. - * - * @param vertex a vertex which has already been seen. - * - * @return data associated with the seen vertex or <code>null</code> if no - * data was associated with the vertex. A <code>null</code> return can also - * indicate that the vertex was explicitly associated with <code> - * null</code>. - */ - private VisitColor getSeenData(NetworkVertex vertex) { - return seen.get(vertex); - } - - /** - * Determines whether a vertex has been seen yet by this traversal. - * - * @param vertex vertex in question - * - * @return <tt>true</tt> if vertex has already been seen - */ - private boolean isSeenVertex(NetworkVertex vertex, boolean mustUseGreedy) - { - return seen.containsKey(vertex) && (mustUseGreedy || !this.mustUseGreedy.get(vertex) ); - } /** --- 117,120 ---- *************** *** 158,190 **** * associated with <code>null</code>. */ ! private VisitColor putSeenData(NetworkVertex vertex, VisitColor data) { ! return seen.put(vertex, data); ! } ! ! /** ! * Called when a vertex has been finished (meaning is dependent on traversal ! * represented by subclass). ! * ! * @param vertex vertex which has been finished ! */ ! private void finishVertex(NetworkVertex vertex) { ! // do nothing } ! private void addUnseenChildrenOf(NetworkVertex vertex, VisitColor previousColor) { if (company != null && !vertex.canCompanyRunThrough(company)) return; - - for (NetworkEdge edge : graph.edgesOf(vertex)) { - - if (previousColor == VisitColor.WHITE || edge.isGreedy()) { NetworkVertex oppositeV = Graphs.getOppositeVertex(graph, edge, vertex); ! if (isSeenVertex(oppositeV, vertex.isSide() && !edge.isGreedy() )) { ! encounterVertexAgain(oppositeV, edge); ! } else { ! encounterVertex(oppositeV, edge); ! } } } --- 129,160 ---- * associated with <code>null</code>. */ ! private void putSeenData(NetworkVertex vertex, boolean greedy) { ! if (!vertex.isSide()) { ! seen.put(vertex, greedyState.seen); ! log.debug("Iterator: Vertex " + vertex + " seen with greedyState = seen"); ! return; ! } ! // side ! if (seen.containsKey(vertex)){ ! seen.put(vertex, greedyState.done); ! log.debug("Iterator: Vertex " + vertex + " seen with greedyState = done"); ! } else if (greedy) { ! seen.put(vertex, greedyState.greedy); ! log.debug("Iterator: Vertex " + vertex + " seen with greedyState = greedy"); ! } else { ! seen.put(vertex, greedyState.nonGreedy); ! log.debug("Iterator: Vertex " + vertex + " seen with greedyState = nonGreedy"); ! } } ! private void addUnseenChildrenOf(NetworkVertex vertex, boolean greedy) { if (company != null && !vertex.canCompanyRunThrough(company)) return; + for (NetworkEdge edge : graph.edgesOf(vertex)) { + if (!greedy || edge.isGreedy()) { NetworkVertex oppositeV = Graphs.getOppositeVertex(graph, edge, vertex); ! encounterVertex(oppositeV, edge); } } *************** *** 192,287 **** private void encounterStartVertex() { ! putSeenData(startVertex, VisitColor.WHITE); stack.add(startVertex); startVertex = null; - log.debug("Iterator: Added to stack " + startVertex); } - /** copy of standard dfs */ - private void encounterVertex(NetworkVertex vertex, NetworkEdge edge) { - putSeenData(vertex, VisitColor.WHITE); - mustUseGreedy.put(vertex, vertex.isSide() && !edge.isGreedy()); - stack.add(vertex); - log.debug("Iterator: Added to stack " + vertex); - } ! /** copy of standard dfs */ ! private void encounterVertexAgain(NetworkVertex vertex, NetworkEdge edge) { ! VisitColor color = getSeenData(vertex); ! if (color != VisitColor.WHITE) { ! // We've already visited this vertex; no need to mess with the ! // stack (either it's BLACK and not there at all, or it's GRAY ! // and therefore just a sentinel). return; } ! int i = stack.indexOf(vertex); ! ! // Since we've encountered it before, and it's still WHITE or YELLOW, it ! // *must* be on the stack. ! assert (i > -1); ! stack.remove(i); ! stack.add(vertex); ! } ! ! /** copy of standard dfs */ ! private boolean isConnectedComponentExhausted() { ! while (true) { ! if (stack.isEmpty()) { ! return true; ! } ! if (peekStack() != null) { ! // Found a non-sentinel. ! return false; ! } ! ! // Found a sentinel: pop it, record the finish time, ! // and then loop to check the rest of the stack. ! ! // Pop null we peeked at above. ! popStack(); ! ! // This will pop corresponding vertex to be recorded as finished. ! recordFinish(); ! } ! } ! ! /** copy of standard dfs */ ! private NetworkVertex provideNextVertex() { ! NetworkVertex v; ! while (true) { ! v = popStack(); ! if (v == null) { ! // This is a finish-time sentinel we previously pushed. ! recordFinish(); ! // Now carry on with another pop until we find a non-sentinel ! } else { ! // Got a real vertex to start working on ! break; ! } ! } ! ! // Push a sentinel for v onto the stack so that we'll know ! // when we're done with it. stack.add(v); ! stack.add(null); ! return v; } - private NetworkVertex popStack() - { - return stack.remove(stack.size() - 1); - } - private NetworkVertex peekStack() - { - return stack.get(stack.size() - 1); - } - private void recordFinish() - { - NetworkVertex v = popStack(); - if (getSeenData(v) == VisitColor.WHITE) - putSeenData(v, VisitColor.BLACK); - finishVertex(v); - } } --- 162,187 ---- private void encounterStartVertex() { ! putSeenData(startVertex, true); stack.add(startVertex); + greedyStack.add(false); + log.debug("Iterator: Added to stack " + startVertex + " with greedy set to false"); startVertex = null; } ! private void encounterVertex(NetworkVertex v, NetworkEdge e){ ! if (stack.contains(v)) return; ! if (v.isSide() && seen.containsKey(v) && (seen.get(v) == greedyState.done || (e.isGreedy() && seen.get(v) == greedyState.nonGreedy) ! || (!e.isGreedy() && seen.get(v) == greedyState.greedy) )) { ! log.debug("Leave vertex " + v + " due to greedState rules"); return; } ! stack.add(v); ! greedyStack.add(v.isSide() && !e.isGreedy()); ! log.debug("Iterator: Added to stack " + v + " with greedy set to " + (v.isSide() && !e.isGreedy())); } } Index: RevenueAdapter.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueAdapter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RevenueAdapter.java 20 Apr 2010 19:45:40 -0000 1.6 --- RevenueAdapter.java 27 Apr 2010 23:24:50 -0000 1.7 *************** *** 2,6 **** import java.awt.EventQueue; - import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; --- 2,5 ---- *************** *** 12,25 **** import java.util.Map; - import javax.swing.SwingUtilities; - import org.jgrapht.Graph; import org.jgrapht.Graphs; - import rails.game.GameManager; import rails.game.MapHex; import rails.game.PhaseI; import rails.game.PublicCompanyI; - import rails.game.TokenI; import rails.game.TrainI; import rails.ui.swing.hexmap.HexMap; --- 11,21 ---- import java.util.Map; import org.jgrapht.Graphs; + import org.jgrapht.graph.SimpleGraph; import rails.game.MapHex; import rails.game.PhaseI; import rails.game.PublicCompanyI; import rails.game.TrainI; import rails.ui.swing.hexmap.HexMap; *************** *** 28,32 **** public class RevenueAdapter implements Runnable { ! private Graph<NetworkVertex, NetworkEdge> graph; private RevenueCalculator rc; --- 24,28 ---- public class RevenueAdapter implements Runnable { ! private SimpleGraph<NetworkVertex, NetworkEdge> graph; private RevenueCalculator rc; *************** *** 42,46 **** ! public RevenueAdapter(Graph<NetworkVertex, NetworkEdge> graph){ this.graph = graph; --- 38,42 ---- ! public RevenueAdapter(SimpleGraph<NetworkVertex, NetworkEdge> graph){ this.graph = graph; *************** *** 109,120 **** } ! if (activatePrediction) { ! // get max revenue results ! int[] maxCityRevenues = revenueList(cities, maxCityLength); ! int[] maxTownRevenues = revenueList(towns, maxTownLength); ! ! // set revenue results in revenue calculator ! rc.setPredictionData(maxCityRevenues, maxTownRevenues); ! } } --- 105,116 ---- } ! // if (activatePrediction) { ! // // get max revenue results ! // int[] maxCityRevenues = revenueList(cities, maxCityLength); ! // int[] maxTownRevenues = revenueList(towns, maxTownLength); ! // ! // // set revenue results in revenue calculator ! // rc.setPredictionData(maxCityRevenues, maxTownRevenues); ! // } } *************** *** 258,261 **** --- 254,258 ---- public int calculateRevenue(int startTrain, int finalTrain) { if (startTrain < 0 || finalTrain >= trains.size() || startTrain > finalTrain) return -1; + rc.initialPredictionRuns(startTrain, finalTrain); return rc.calculateRevenue(startTrain, finalTrain); } *************** *** 323,338 **** GeneralPath path = new GeneralPath(); NetworkVertex startVertex = null; for (NetworkVertex vertex:run.get(train)) { Point2D vertexPoint = NetworkVertex.getVertexPoint2D(map, vertex); if (startVertex == null) { startVertex = vertex; path.moveTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); continue; } else if (startVertex == vertex) { path.moveTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); continue; } ! if (vertexPoint != null) path.lineTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); } pathList.add(path); --- 320,353 ---- GeneralPath path = new GeneralPath(); NetworkVertex startVertex = null; + NetworkVertex previousVertex = null; for (NetworkVertex vertex:run.get(train)) { Point2D vertexPoint = NetworkVertex.getVertexPoint2D(map, vertex); if (startVertex == null) { startVertex = vertex; + previousVertex = vertex; path.moveTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); continue; } else if (startVertex == vertex) { path.moveTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); + previousVertex = vertex; continue; } ! // draw hidden vertexes ! // NetworkEdge edge = graph.getEdge(previousVertex, vertex); ! // if (edge != null) { ! // edge = graph.getEdge(vertex, previousVertex); ! // } ! // if (edge != null) { ! // List<NetworkVertex> hiddenVertexes = edge.getHiddenVertexes(); ! // for (NetworkVertex v:hiddenVertexes) { ! // Point2D vPoint = NetworkVertex.getVertexPoint2D(map, v); ! // if (vPoint != null) { ! // path.lineTo((float)vPoint.getX(), (float)vPoint.getY()); ! // } ! // } ! // } ! if (vertexPoint != null) { path.lineTo((float)vertexPoint.getX(), (float)vertexPoint.getY()); + } } pathList.add(path); Index: NetworkGraphBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkGraphBuilder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NetworkGraphBuilder.java 13 Apr 2010 23:21:12 -0000 1.6 --- NetworkGraphBuilder.java 27 Apr 2010 23:24:50 -0000 1.7 *************** *** 240,244 **** ! public static Graph<NetworkVertex, NetworkEdge> optimizeGraph(Graph<NetworkVertex, NetworkEdge> graph) { // convert graph --- 240,244 ---- ! public static SimpleGraph<NetworkVertex, NetworkEdge> optimizeGraph(SimpleGraph<NetworkVertex, NetworkEdge> graph) { // convert graph *************** *** 297,302 **** if (edges[0].isGreedy() && !graph.containsEdge(firstVertex, secondVertex)) { int distance = edges[0].getDistance() + edges[1].getDistance(); ! graph.addEdge(firstVertex, secondVertex, ! new NetworkEdge(firstVertex, secondVertex, true, distance)); // remove vertex graph.removeVertex(vertex); --- 297,309 ---- if (edges[0].isGreedy() && !graph.containsEdge(firstVertex, secondVertex)) { int distance = edges[0].getDistance() + edges[1].getDistance(); ! List<NetworkVertex> hiddenVertexes = new ArrayList<NetworkVertex>(); ! hiddenVertexes.addAll(edges[0].getHiddenVertexes()); ! hiddenVertexes.add(vertex); ! hiddenVertexes.addAll(edges[1].getHiddenVertexes()); ! NetworkEdge newEdge = ! new NetworkEdge(firstVertex, secondVertex, true, distance, hiddenVertexes); ! graph.addEdge(firstVertex, secondVertex, newEdge); ! log.info("NGB: Merged Edges removed Vertex = " + vertex); ! log.info("NGB: New Edge = " + newEdge.getConnection() + " with hidden Vertexes " + newEdge.getHiddenVertexes()); // remove vertex graph.removeVertex(vertex); Index: NetworkEdge.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkEdge.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkEdge.java 20 Apr 2010 19:45:40 -0000 1.4 --- NetworkEdge.java 27 Apr 2010 23:24:50 -0000 1.5 *************** *** 4,7 **** --- 4,9 ---- import java.awt.geom.Line2D; import java.awt.geom.Point2D; + import java.util.ArrayList; + import java.util.List; import rails.ui.swing.hexmap.HexMap; *************** *** 17,20 **** --- 19,25 ---- private final int distance; + private final List<NetworkVertex> hiddenVertexes; + // list of vertexes that were merged into the + public NetworkEdge(NetworkVertex source, NetworkVertex target, boolean greedy) { this.source = source; *************** *** 25,35 **** else this.distance = 0; } ! public NetworkEdge(NetworkVertex source, NetworkVertex target, boolean greedy, int distance) { this.source = source; this.target = target; this.greedy = greedy; this.distance = distance; } --- 30,43 ---- else this.distance = 0; + hiddenVertexes = new ArrayList<NetworkVertex>(); } ! public NetworkEdge(NetworkVertex source, NetworkVertex target, boolean greedy, ! int distance, List<NetworkVertex> hiddenVertexes) { this.source = source; this.target = target; this.greedy = greedy; this.distance = distance; + this.hiddenVertexes = hiddenVertexes; } *************** *** 54,57 **** --- 62,69 ---- } + public List<NetworkVertex> getHiddenVertexes() { + return hiddenVertexes; + } + public String getConnection() { return source + " - >" + target; Index: NetworkTrain.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkTrain.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NetworkTrain.java 15 Apr 2010 21:46:28 -0000 1.3 --- NetworkTrain.java 27 Apr 2010 23:24:50 -0000 1.4 *************** *** 5,9 **** private int cities; private int towns; ! private final boolean townsCostNothing; private final int multiplyCities; private final int multiplyTowns; --- 5,9 ---- private int cities; private int towns; ! private final boolean ignoreTowns; private final int multiplyCities; private final int multiplyTowns; *************** *** 14,18 **** this.cities = cities; this.towns = towns; ! this.townsCostNothing = townsCostNothing; this.multiplyCities = multiplyCities; this.multiplyTowns = multiplyTowns; --- 14,18 ---- this.cities = cities; this.towns = towns; ! this.ignoreTowns = townsCostNothing; this.multiplyCities = multiplyCities; this.multiplyTowns = multiplyTowns; *************** *** 21,25 **** void addToRevenueCalculator(RevenueCalculator rc, int trainId) { ! rc.setTrain(trainId, cities, towns, townsCostNothing, multiplyCities, multiplyTowns); } --- 21,25 ---- void addToRevenueCalculator(RevenueCalculator rc, int trainId) { ! rc.setTrain(trainId, cities, towns, ignoreTowns, multiplyCities, multiplyTowns); } |
From: Erik V. <ev...@us...> - 2010-04-22 19:10:06
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23526/rails/game Modified Files: Round.java PublicCompanyI.java PublicCompany.java Log Message: Restructured float detection such that an 1835 bug is fixed (BY must not float if one of its privates is unsold) and that game specific aspects can more easily be implemented in Round subclasses. Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** PublicCompany.java 18 Apr 2010 20:52:32 -0000 1.94 --- PublicCompany.java 22 Apr 2010 19:09:58 -0000 1.95 *************** *** 1295,1299 **** // Calculate, round up, report and add the cash ! // Define a precise sequence for the reporting Set<CashHolder> recipientSet = sharesPerRecipient.keySet(); --- 1295,1299 ---- // Calculate, round up, report and add the cash ! // Define a precise sequence for the reporting Set<CashHolder> recipientSet = sharesPerRecipient.keySet(); *************** *** 1502,1513 **** } } ! /** A generic presidency check. Perhaps it can replace the above two methods. */ public void checkPresidency () { ! Player president = getPresident(); int presIndex = president.getIndex(); int presShare = president.getPortfolio().getShare(this); ! GameManagerI gmgr = GameManager.getInstance(); Player player; --- 1502,1513 ---- } } ! /** A generic presidency check. Perhaps it can replace the above two methods. */ public void checkPresidency () { ! Player president = getPresident(); int presIndex = president.getIndex(); int presShare = president.getPortfolio().getShare(this); ! GameManagerI gmgr = GameManager.getInstance(); Player player; *************** *** 1528,1543 **** } } - - } - /** - * Return the unsold share percentage. It is calculated as the sum of the - * percentages in IPO and in the company treasury. <p>The latter percentage - * can only be nonzero in games where companies can hold their own shares, - * and will only truly represent the "unsold" percentage until the company - * has floated (in many games companies can buy and sell their own shares). - */ - public int getUnsoldPercentage() { - return bank.getIpo().getShare(this) + portfolio.getShare(this); } --- 1528,1532 ---- Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Round.java 5 Feb 2010 19:57:06 -0000 1.38 --- Round.java 22 Apr 2010 19:09:58 -0000 1.39 *************** *** 290,295 **** if (!company.hasStarted() || company.hasFloated()) return; ! int unsoldPercentage = company.getUnsoldPercentage(); ! if (unsoldPercentage <= 100 - company.getFloatPercentage()) { // Company floats floatCompany(company); --- 290,294 ---- if (!company.hasStarted() || company.hasFloated()) return; ! if (getSoldPercentage(company) >= company.getFloatPercentage()) { // Company floats floatCompany(company); *************** *** 297,300 **** --- 296,319 ---- } + /** Determine sold percentage for floating purposes */ + protected int getSoldPercentage (PublicCompanyI company) { + + int soldPercentage = 0; + for (PublicCertificateI cert : company.getCertificates()) { + if (certCountsAsSold(cert)) { + soldPercentage += cert.getShare(); + } + } + return soldPercentage; + } + + /** Can be subclassed for games with special rules */ + protected boolean certCountsAsSold (PublicCertificateI cert) { + Portfolio holder = cert.getPortfolio(); + CashHolder owner = holder.getOwner(); + return owner instanceof Player + || holder == pool; + } + /** * Float a company, including a default implementation of moving cash and *************** *** 307,311 **** // Move cash and shares where required ! int unsoldPercentage = company.getUnsoldPercentage(); int cash = 0; int capitalisationMode = company.getCapitalisation(); --- 326,330 ---- // Move cash and shares where required ! int soldPercentage = getSoldPercentage(company); int cash = 0; int capitalisationMode = company.getCapitalisation(); *************** *** 318,322 **** } else if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL) { // Incremental capitalisation as in 1851 ! capFactor = (100 - unsoldPercentage) / shareUnit; } else if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) { // Cash goes directly to treasury at each buy (as in 1856 before phase 6) --- 337,341 ---- } else if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL) { // Incremental capitalisation as in 1851 ! capFactor = soldPercentage / shareUnit; } else if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) { // Cash goes directly to treasury at each buy (as in 1856 before phase 6) Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** PublicCompanyI.java 18 Apr 2010 20:52:32 -0000 1.52 --- PublicCompanyI.java 22 Apr 2010 19:09:58 -0000 1.53 *************** *** 159,164 **** public boolean canHoldOwnShares(); - public int getUnsoldPercentage(); - /** * Get a list of this company's certificates. --- 159,162 ---- |
From: Erik V. <ev...@us...> - 2010-04-22 19:10:06
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23526/rails/game/specific/_1856 Modified Files: OperatingRound_1856.java StockRound_1856.java Log Message: Restructured float detection such that an 1835 bug is fixed (BY must not float if one of its privates is unsold) and that game specific aspects can more easily be implemented in Round subclasses. Index: StockRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/StockRound_1856.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StockRound_1856.java 15 Apr 2010 19:49:50 -0000 1.16 --- StockRound_1856.java 22 Apr 2010 19:09:58 -0000 1.17 *************** *** 35,39 **** if (!company.hasStarted() || company.hasFloated()) return; ! int unsoldPercentage = company.getUnsoldPercentage(); PublicCompany_1856 comp = (PublicCompany_1856) company; --- 35,39 ---- if (!company.hasStarted() || company.hasFloated()) return; ! int soldPercentage = getSoldPercentage(company); PublicCompany_1856 comp = (PublicCompany_1856) company; *************** *** 43,47 **** log.debug ("Floatpercentage is "+floatPercentage); ! if (unsoldPercentage <= 100 - floatPercentage) { // Company floats. // In 1856 this does not mean that the company will operate, --- 43,47 ---- log.debug ("Floatpercentage is "+floatPercentage); ! if (soldPercentage >= floatPercentage) { // Company floats. // In 1856 this does not mean that the company will operate, *************** *** 55,59 **** } ! protected void initPlayer() { super.initPlayer(); sharesSoldSoFar.set(0); --- 55,60 ---- } ! @Override ! protected void initPlayer() { super.initPlayer(); sharesSoldSoFar.set(0); *************** *** 61,66 **** } ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { ! if (company instanceof PublicCompany_CGR) { if (company.canSharePriceVary()) { --- 62,68 ---- } ! @Override ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { ! if (company instanceof PublicCompany_CGR) { if (company.canSharePriceVary()) { *************** *** 100,106 **** case 4: // Note, that the share has not yet been moved ! if (comp.getUnsoldPercentage() <= 50 && !comp.hasReachedDestination()) { ! recipient = oldHolder.getOwner(); // i.e. the Bank comp.addMoneyInEscrow(cost); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", --- 102,108 ---- case 4: // Note, that the share has not yet been moved ! if (getSoldPercentage(comp) >= 50 && !comp.hasReachedDestination()) { ! recipient = bank; comp.addMoneyInEscrow(cost); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", *************** *** 112,120 **** // fall through case 5: ! recipient = (cert).getCompany(); break; case 6: default: ! recipient = oldHolder.getOwner(); } } else { --- 114,122 ---- // fall through case 5: ! recipient = comp; break; case 6: default: ! recipient = bank; } } else { Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** OperatingRound_1856.java 15 Apr 2010 19:49:50 -0000 1.34 --- OperatingRound_1856.java 22 Apr 2010 19:09:58 -0000 1.35 *************** *** 23,36 **** { ! steps = new GameDef.OrStep[] { GameDef.OrStep.INITIAL, GameDef.OrStep.LAY_TRACK, GameDef.OrStep.LAY_TOKEN, GameDef.OrStep.CALC_REVENUE, ! GameDef.OrStep.PAYOUT, ! GameDef.OrStep.BUY_TRAIN, GameDef.OrStep.TRADE_SHARES, ! GameDef.OrStep.REPAY_LOANS, ! GameDef.OrStep.FINAL }; } --- 23,36 ---- { ! steps = new GameDef.OrStep[] { GameDef.OrStep.INITIAL, GameDef.OrStep.LAY_TRACK, GameDef.OrStep.LAY_TOKEN, GameDef.OrStep.CALC_REVENUE, ! GameDef.OrStep.PAYOUT, ! GameDef.OrStep.BUY_TRAIN, GameDef.OrStep.TRADE_SHARES, ! GameDef.OrStep.REPAY_LOANS, ! GameDef.OrStep.FINAL }; } *************** *** 74,79 **** if (!operatingCompany.hasOperated()) { ! int soldPercentage ! = 100 - operatingCompany.getUnsoldPercentage(); TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); --- 74,78 ---- if (!operatingCompany.hasOperated()) { ! int soldPercentage = getSoldPercentage (operatingCompany); TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); *************** *** 352,356 **** // Step may only be skipped if repayment is optional if (minNumber == 0) doneAllowed = true; ! } else { // No (more) loans --- 351,355 ---- // Step may only be skipped if repayment is optional if (minNumber == 0) doneAllowed = true; ! } else { // No (more) loans |
From: Erik V. <ev...@us...> - 2010-04-21 21:30:47
|
Update of /cvsroot/rails/18xx/data/1851 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2145/data/1851 Modified Files: Game.xml Log Message: Added unlimited last (8-)train option Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1851/Game.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Game.xml 12 Mar 2010 17:15:04 -0000 1.13 --- Game.xml 21 Apr 2010 21:30:40 -0000 1.14 *************** *** 5,8 **** --- 5,9 ---- <GameOption name="NoMapMode" type="toggle" default="no" /> <GameOption name="UnlimitedTiles" type="toggle" default="no"/> + <GameOption name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/> <GameParameters> <PlayerShareLimit percentage="60"/> *************** *** 58,63 **** <Train name="6" majorStops="6" cost="600" amount="2" startPhase="6" rustedTrain="3"/> ! <Train name="8" majorStops="8" cost="800" amount="4" startPhase="8" ! rustedTrain="4"/> <TrainBuyingRules> <FaceValueIfDifferentPresidents/> --- 59,71 ---- <Train name="6" majorStops="6" cost="600" amount="2" startPhase="6" rustedTrain="3"/> ! <Train name="8" majorStops="8" cost="800" startPhase="8" ! rustedTrain="4"> ! <IfOption name="UnlimitedTopTrains" value="yes"> ! <Attributes amount="-1"/> ! </IfOption> ! <IfOption name="UnlimitedTopTrains" value="no"> ! <Attributes amount="4"/> ! </IfOption> ! </Train> <TrainBuyingRules> <FaceValueIfDifferentPresidents/> |
From: Erik V. <ev...@us...> - 2010-04-21 21:30:47
|
Update of /cvsroot/rails/18xx/data In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2145/data Modified Files: GamesList.xml Log Message: Added unlimited last (8-)train option Index: GamesList.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/GamesList.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GamesList.xml 9 Apr 2010 17:50:59 -0000 1.31 --- GamesList.xml 21 Apr 2010 21:30:40 -0000 1.32 *************** *** 77,80 **** --- 77,81 ---- <Option name="NoMapMode" type="toggle" default="no" /> <Option name="UnlimitedTiles" type="toggle" default="no"/> + <Option name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/> <Players minimum="3" maximum="5"/> </Game> |
From: Erik V. <ev...@us...> - 2010-04-21 21:25:58
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1730/rails/game Modified Files: TrainManager.java Log Message: Fixed crash when last 8-train bought Index: TrainManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainManager.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** TrainManager.java 4 Feb 2010 22:22:59 -0000 1.27 --- TrainManager.java 21 Apr 2010 21:25:50 -0000 1.28 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected Map<String, TrainI> trainMap = new HashMap<String, TrainI>(); // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; protected GameManagerI gameManager = null; protected Bank bank = null; // Non-game attributes protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special GameManager.getInstance().setGameParameter(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS, rulesTag.getChild("FaceValueIfDifferentPresidents") != null); } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { this.gameManager = gameManager; bank = gameManager.getBank(); ipo = bank.getIpo(); unavailable = bank.getUnavailable(); for (TrainTypeI type : lTrainTypes) { type.finishConfiguration(gameManager); } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(bank); } public void addTrain (String uniqueID, TrainI train) { trainMap.put(uniqueID, train); } public TrainI getTrainByUniqueId(String id) { return trainMap.get(id); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); nextType = (lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(bank); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { gameManager.getPhaseManager().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(bank); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public String getTrainCostOverview() { StringBuffer b = new StringBuffer(); for (TrainTypeI type : lTrainTypes) { if (b.length() > 1) b.append(" "); b.append(type.getName()).append(":").append(Bank.format(type.getCost())); if (type.getExchangeCost() > 0) { b.append("(").append(Bank.format(type.getExchangeCost())).append(")"); } } return b.toString(); } public TrainTypeI getTypeByName(String name) { return mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected Map<String, TrainI> trainMap = new HashMap<String, TrainI>(); // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; protected GameManagerI gameManager = null; protected Bank bank = null; // Non-game attributes protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special GameManager.getInstance().setGameParameter(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS, rulesTag.getChild("FaceValueIfDifferentPresidents") != null); } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { this.gameManager = gameManager; bank = gameManager.getBank(); ipo = bank.getIpo(); unavailable = bank.getUnavailable(); for (TrainTypeI type : lTrainTypes) { type.finishConfiguration(gameManager); } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(bank); } public void addTrain (String uniqueID, TrainI train) { trainMap.put(uniqueID, train); } public TrainI getTrainByUniqueId(String id) { return trainMap.get(id); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); if (newTypeIndex.intValue() < lTrainTypes.size()) { nextType = (lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(bank); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { gameManager.getPhaseManager().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(bank); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public String getTrainCostOverview() { StringBuffer b = new StringBuffer(); for (TrainTypeI type : lTrainTypes) { if (b.length() > 1) b.append(" "); b.append(type.getName()).append(":").append(Bank.format(type.getCost())); if (type.getExchangeCost() > 0) { b.append("(").append(Bank.format(type.getExchangeCost())).append(")"); } } return b.toString(); } public TrainTypeI getTypeByName(String name) { return mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } } \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-04-21 19:16:52
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv14708/rails/game Modified Files: OperatingRound.java PrivateCompany.java Log Message: Fixed 1856 W&SR closure Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** OperatingRound.java 11 Apr 2010 15:49:47 -0000 1.122 --- OperatingRound.java 21 Apr 2010 19:16:44 -0000 1.123 *************** *** 1407,1414 **** // Check if any privates must be closed ! // (now only applies to 1856 W&SR) ! for (PrivateCompanyI priv : gameManager.getAllPrivateCompanies()) { ! priv.checkClosingIfExercised(true); ! } // OR done. Inform GameManager. --- 1407,1414 ---- // Check if any privates must be closed ! // (now only applies to 1856 W&SR) - no, that is at end of TURN ! //for (PrivateCompanyI priv : gameManager.getAllPrivateCompanies()) { ! // priv.checkClosingIfExercised(true); ! //} // OR done. Inform GameManager. Index: PrivateCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PrivateCompany.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PrivateCompany.java 11 Apr 2010 15:49:47 -0000 1.40 --- PrivateCompany.java 21 Apr 2010 19:16:44 -0000 1.41 *************** *** 30,35 **** // Close at start of phase protected String closeAtPhaseName = null; ! ! protected String blockedHexesString = null; protected List<MapHex> blockedHexes = null; --- 30,35 ---- // Close at start of phase protected String closeAtPhaseName = null; ! ! protected String blockedHexesString = null; protected List<MapHex> blockedHexes = null; *************** *** 93,97 **** String whenAttribute = spTag.getAttributeAsString("when"); if (whenAttribute != null) { ! closeAtEndOfTurn = whenAttribute.equalsIgnoreCase("atEndOfORTurn"); } } --- 93,97 ---- String whenAttribute = spTag.getAttributeAsString("when"); if (whenAttribute != null) { ! closeAtEndOfTurn = whenAttribute.equalsIgnoreCase("endOfORTurn"); } } *************** *** 351,357 **** } ! public void checkClosingIfExercised (boolean endOfOR) { ! if (isClosed() || endOfOR != closeAtEndOfTurn) return; if (closeIfAllExercised) { --- 351,357 ---- } ! public void checkClosingIfExercised (boolean endOfTurn) { ! if (isClosed() || endOfTurn != closeAtEndOfTurn) return; if (closeIfAllExercised) { |
From: Stefan F. <ste...@us...> - 2010-04-20 22:07:17
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv24364/rails/ui/swing/hexmap Modified Files: GUIHex.java Log Message: Some further bug fixes to revenue calculation Index: GUIHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUIHex.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** GUIHex.java 20 Apr 2010 20:17:51 -0000 1.43 --- GUIHex.java 20 Apr 2010 22:07:09 -0000 1.44 *************** *** 207,211 **** public Point2D getSidePoint2D(int side){ - side = (5-side); return new Point2D.Double((xVertex[side] + xVertex[(side+1)%6])/2, (yVertex[side] + yVertex[(side+1)%6])/2); --- 207,210 ---- |
From: Stefan F. <ste...@us...> - 2010-04-20 22:07:17
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv24364/rails/algorithms Modified Files: RevenueCalculator.java NetworkVertex.java Log Message: Some further bug fixes to revenue calculation Index: RevenueCalculator.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueCalculator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RevenueCalculator.java 20 Apr 2010 19:45:40 -0000 1.6 --- RevenueCalculator.java 20 Apr 2010 22:07:09 -0000 1.7 *************** *** 212,216 **** trainTerminated = trainTerminated(trainId); if (trainTerminated == Terminated.WithoutEvaluation || ! trainTerminated == Terminated.NotYet && useRevenuePrediction && predictRevenues(trainId)) { // cannot beat current best value => leave immediately encounterVertex(trainId, vertexId, false); --- 212,217 ---- trainTerminated = trainTerminated(trainId); if (trainTerminated == Terminated.WithoutEvaluation || ! // trainTerminated == Terminated.NotYet && ! useRevenuePrediction && predictRevenues(trainId)) { // cannot beat current best value => leave immediately encounterVertex(trainId, vertexId, false); *************** *** 283,287 **** trainTerminated = trainTerminated(trainId); if (trainTerminated == Terminated.WithoutEvaluation || ! trainTerminated == Terminated.NotYet && useRevenuePrediction && predictRevenues(trainId)) { // cannot beat current best value => leave immediately encounterVertex(trainId, vertexId, false); --- 284,289 ---- trainTerminated = trainTerminated(trainId); if (trainTerminated == Terminated.WithoutEvaluation || ! // trainTerminated == Terminated.NotYet && ! useRevenuePrediction && predictRevenues(trainId)) { // cannot beat current best value => leave immediately encounterVertex(trainId, vertexId, false); *************** *** 480,489 **** trainValue = maxTrainRevenues[j]; } else { // the current train ! if (trainMaxTowns[j] == 0) { // default train trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j]; } else { ! // plus trains int townDiff = trainMaxTowns[j] - trainTowns[j]; if (townDiff > 0) { --- 482,495 ---- trainValue = maxTrainRevenues[j]; } else { // the current train ! if (trainIgnoreTowns[j]) { ! // express train ! trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j] ] * trainMultiplyCities[j]; ! } else if (trainMaxTowns[j] == 0) { // default train trainValue = trainCurrentValue[j] + ! maxCityRevenues[trainMaxCities[j] - trainCities[j] - trainTowns[j] ] * trainMultiplyCities[j]; } else { ! // plus trains (or capped default trains) int townDiff = trainMaxTowns[j] - trainTowns[j]; if (townDiff > 0) { Index: NetworkVertex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkVertex.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NetworkVertex.java 20 Apr 2010 19:45:40 -0000 1.7 --- NetworkVertex.java 20 Apr 2010 22:07:09 -0000 1.8 *************** *** 15,18 **** --- 15,19 ---- import rails.game.Station; import rails.game.TokenI; + import rails.ui.swing.hexmap.EWHexMap; import rails.ui.swing.hexmap.GUIHex; import rails.ui.swing.hexmap.HexMap; *************** *** 279,283 **** return guiHex.getCenterPoint2D(); } else if (vertex.isSide()) { ! return guiHex.getSidePoint2D(vertex.getSide()); } else { return null; --- 280,287 ---- return guiHex.getCenterPoint2D(); } else if (vertex.isSide()) { ! if (map instanceof EWHexMap) ! return guiHex.getSidePoint2D(5-vertex.getSide()); ! else ! return guiHex.getSidePoint2D((3+vertex.getSide())%6); } else { return null; |