|
From: <ev...@us...> - 2011-05-11 20:29:38
|
Revision: 1557
http://rails.svn.sourceforge.net/rails/?rev=1557&view=rev
Author: evos
Date: 2011-05-11 20:29:31 +0000 (Wed, 11 May 2011)
Log Message:
-----------
Created ferry tiles -4007...-4009 with blue background.
-4007 included in 18Scan map (the other two tiles exist in 18GL).
Fixed two more 18Scan map issues.
Modified Paths:
--------------
trunk/18xx/data/18Scan/Map.xml
trunk/18xx/data/18Scan/TileSet.xml
trunk/18xx/data/18Scan/Tiles.xml
trunk/18xx/tiles/TileDictionary.18t
trunk/18xx/tiles/TileDictionary.xml
trunk/18xx/tiles/Tiles.xml
trunk/18xx/tiles/svg/tile-10004.svg
Added Paths:
-----------
trunk/18xx/tiles/svg/tile-4007.svg
trunk/18xx/tiles/svg/tile-4008.svg
trunk/18xx/tiles/svg/tile-4009.svg
Modified: trunk/18xx/data/18Scan/Map.xml
===================================================================
--- trunk/18xx/data/18Scan/Map.xml 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/data/18Scan/Map.xml 2011-05-11 20:29:31 UTC (rev 1557)
@@ -54,10 +54,9 @@
<Hex name="G4" tile="-10" city="Malmö" cost="40"/>
<Hex name="G6" tile="0"/>
<Hex name="G8" tile="0"/>
- <Hex name="G12" tile="0"/>
+ <Hex name="G12" tile="-4007" orientation="2"/>
<Hex name="G14" tile="-10" city="Helsinki"/>
<Hex name="G16" tile="-1" city="Lahti"/>
<Hex name="H13" tile="-911" city="Tallinn" value="0,30,60" orientation="4"/>
- <Hex name="H15" tile="0" />
<Hex name="H17" tile="-911" city="Vyborg" value="30,50,80" orientation="3"/>
</Map>
Modified: trunk/18xx/data/18Scan/TileSet.xml
===================================================================
--- trunk/18xx/data/18Scan/TileSet.xml 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/data/18Scan/TileSet.xml 2011-05-11 20:29:31 UTC (rev 1557)
@@ -12,6 +12,7 @@
<Tile id="-911"/>
<Tile id="-912"/>
<Tile id="-4002"/>
+ <Tile id="-4007"/>
<Tile id="-10004"/>
<!-- Yellow Tiles -->
Modified: trunk/18xx/data/18Scan/Tiles.xml
===================================================================
--- trunk/18xx/data/18Scan/Tiles.xml 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/data/18Scan/Tiles.xml 2011-05-11 20:29:31 UTC (rev 1557)
@@ -21,6 +21,9 @@
<Track from="city1" gauge="normal" to="side2"/>
<Track from="city1" gauge="normal" to="side1"/>
</Tile>
+ <Tile colour="fixed" id="-4007" name="Ferry">
+ <Track from="side3" gauge="narrow" to="side4"/>
+ </Tile>
<Tile colour="yellow" id="-10004" name="Stockholm">
<Station id="city1" position="052" slots="1" type="City" value="30"/>
<Station id="city2" position="452" slots="1" type="City" value="30"/>
Modified: trunk/18xx/tiles/TileDictionary.18t
===================================================================
(Binary files differ)
Modified: trunk/18xx/tiles/TileDictionary.xml
===================================================================
--- trunk/18xx/tiles/TileDictionary.xml 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/tiles/TileDictionary.xml 2011-05-11 20:29:31 UTC (rev 1557)
@@ -23628,6 +23628,10 @@
<shape>tsHexagon</shape>
<level>tlMapUpgradableToGreen</level>
<name>Stockholm</name>
+ <category>
+ <value>Y</value>
+ <position>tp3CornerF</position>
+ </category>
<junctions>
<junction>
<junType>jtCity</junType>
@@ -23788,4 +23792,46 @@
</connection>
</connections>
</tile>
+ <tile>
+ <ID>-4007</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapFixed</level>
+ <name>Ferry</name>
+ <junctions/>
+ <connections>
+ <connection>
+ <conType>ctSmall</conType>
+ <position1>tp4SideD</position1>
+ <position2>tp4SideE</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-4008</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapFixed</level>
+ <name>Ferry</name>
+ <junctions/>
+ <connections>
+ <connection>
+ <conType>ctSmall</conType>
+ <position1>tp4SideD</position1>
+ <position2>tp4SideF</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-4009</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapFixed</level>
+ <name>Ferry</name>
+ <junctions/>
+ <connections>
+ <connection>
+ <conType>ctSmall</conType>
+ <position1>tp4SideD</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ </connections>
+ </tile>
</tiles>
Modified: trunk/18xx/tiles/Tiles.xml
===================================================================
--- trunk/18xx/tiles/Tiles.xml 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/tiles/Tiles.xml 2011-05-11 20:29:31 UTC (rev 1557)
@@ -3341,7 +3341,7 @@
<Track from="city1" gauge="normal" to="side4"/>
<Track from="city1" gauge="normal" to="side2"/>
</Tile>
- <Tile colour="green" id="-89015" name="1889 Kouchi F9">
+ <Tile colour="green" id="-89015" name="1889 Kouchi F9">
<Station id="city1" position="0" slots="2" type="City" value="30"/>
<Track from="city1" gauge="normal" to="side0"/>
<Track from="city1" gauge="normal" to="side5"/>
@@ -4173,4 +4173,13 @@
<Track from="city1" gauge="normal" to="side1"/>
<Track from="city1" gauge="normal" to="side2"/>
</Tile>
+ <Tile colour="fixed" id="-4007" name="Ferry">
+ <Track from="side3" gauge="narrow" to="side4"/>
+ </Tile>
+ <Tile colour="fixed" id="-4008" name="Ferry">
+ <Track from="side3" gauge="narrow" to="side5"/>
+ </Tile>
+ <Tile colour="fixed" id="-4009" name="Ferry">
+ <Track from="side3" gauge="narrow" to="side0"/>
+ </Tile>
</Tiles>
\ No newline at end of file
Modified: trunk/18xx/tiles/svg/tile-10004.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-10004.svg 2011-05-11 16:20:08 UTC (rev 1556)
+++ trunk/18xx/tiles/svg/tile-10004.svg 2011-05-11 20:29:31 UTC (rev 1557)
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="147" cy="85" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="147" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 49,85 A 98,98 0 0,0 147,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 147,255 A 98,98 0 0,0 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 49,85 A 98,98 0 0,0 147,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 147,255 A 98,98 0 0,0 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="147" cy="85" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="294" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="294" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><circle cx="147" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="294" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="294" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="147" cy="85" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="147" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 49,85 A 98,98 0 0,0 147,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 147,255 A 98,98 0 0,0 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 49,85 A 98,98 0 0,0 147,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 147,255 A 98,98 0 0,0 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="147" cy="85" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="294" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="294" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><circle cx="147" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="294" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="294" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">30</text><text x="49" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="TimpaniHeavy" font-size="51">Y</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
Added: trunk/18xx/tiles/svg/tile-4007.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-4007.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-4007.svg 2011-05-11 20:29:31 UTC (rev 1557)
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
+<path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#60A0FF" stroke="#6060FF" stroke-width="1" stroke-linejoin="round"/>
+<path d="M 196,340 A 98,98 0 0,0 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/>
+<path d="M 196,340 A 98,98 0 0,0 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/>
+<path d="M 196,340 A 98,98 0 0,0 49,255" fill="none" stroke="#FFFFFF" stroke-width="18" stroke-linecap="butt" stroke-linejoin="round" stroke-dasharray="26"/>
+<path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
Added: trunk/18xx/tiles/svg/tile-4008.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-4008.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-4008.svg 2011-05-11 20:29:31 UTC (rev 1557)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
+<path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#60A0FF" stroke="#60A0FF" stroke-width="1" stroke-linejoin="round"/><path d="M 196,340 A 294,294 0 0,0 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,340 A 294,294 0 0,0 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,340 A 294,294 0 0,0 49,85" fill="none" stroke="#FFFFFF" stroke-width="18" stroke-linecap="butt" stroke-linejoin="round" stroke-dasharray="26"/><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
Added: trunk/18xx/tiles/svg/tile-4009.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-4009.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-4009.svg 2011-05-11 20:29:31 UTC (rev 1557)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
+<path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#60A0FF" stroke="#60A0FF" stroke-width="1" stroke-linejoin="round"/><path d="M 196,340 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,340 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,340 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="18" stroke-linecap="butt" stroke-linejoin="round" stroke-dasharray="26"/><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-05-19 12:14:03
|
Revision: 1562
http://rails.svn.sourceforge.net/rails/?rev=1562&view=rev
Author: evos
Date: 2011-05-19 12:13:55 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Minor train configuration changes:
- <InitialTrain> is now a separate tag. Cost can be specified (for 1825), as well as type and tradability.
- Attribute name 'number' changed to 'limit' (max. trains per company)
- Attribute name 'amount' changed to 'quantity' (buyable trains per type).
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/1825/CompanyManager.xml
trunk/18xx/data/1825/Game.xml
trunk/18xx/data/1830/CompanyManager.xml
trunk/18xx/data/1830/Game.xml
trunk/18xx/data/1835/CompanyManager.xml
trunk/18xx/data/1835/Game.xml
trunk/18xx/data/1851/CompanyManager.xml
trunk/18xx/data/1851/Game.xml
trunk/18xx/data/1856/CompanyManager.xml
trunk/18xx/data/1856/Game.xml
trunk/18xx/data/1870/CompanyManager.xml
trunk/18xx/data/1870/Game.xml
trunk/18xx/data/1880/CompanyManager.xml
trunk/18xx/data/1880/Game.xml
trunk/18xx/data/1889/CompanyManager.xml
trunk/18xx/data/1889/Game.xml
trunk/18xx/data/18AL/CompanyManager.xml
trunk/18xx/data/18AL/Game.xml
trunk/18xx/data/18EU/CompanyManager.xml
trunk/18xx/data/18EU/Game.xml
trunk/18xx/data/18GA/CompanyManager.xml
trunk/18xx/data/18GA/Game.xml
trunk/18xx/data/18JR/CompanyManager.xml
trunk/18xx/data/18JR/Game.xml
trunk/18xx/data/18Kaas/CompanyManager.xml
trunk/18xx/data/18Kaas/Game.xml
trunk/18xx/data/18Scan/CompanyManager.xml
trunk/18xx/data/18Scan/Game.xml
trunk/18xx/data/18TN/CompanyManager.xml
trunk/18xx/data/18TN/Game.xml
trunk/18xx/data/18VA/CompanyManager.xml
trunk/18xx/data/18VA/Game.xml
trunk/18xx/data/GamesList.xml
trunk/18xx/rails/game/PublicCompany.java
trunk/18xx/rails/game/Train.java
trunk/18xx/rails/game/TrainI.java
trunk/18xx/rails/game/TrainType.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/LocalisedText.properties 2011-05-19 12:13:55 UTC (rev 1562)
@@ -320,12 +320,12 @@
ITEM_PRICE_REDUCED=Price of {0} is now reduced to {1}
InvalidAction=Invalid action in this game
InvalidAllocationTypeIndex=Invalid allocation type index: {0}
-InvalidAmount=Invalid or zero amount specified
InvalidBid=Invalid bid by {0} on {1}: {2}
InvalidCost=Invalid or zero cost specified
InvalidDoneAction=Invalid Done action
InvalidParPriceSetting=Invalid par price {0} set by {1} for {2}: {3}
InvalidPass=Invalid pass by {0}: {1}
+InvalidQuantity=Invalid quantity specified: {0}
InvalidStartPrice=Invalid start price {0} for {1}
InvalidStops=Invalid or zero major stops specified
InvalidTileColourName=Invalid colour name {1} for tile {0}
Modified: trunk/18xx/data/1825/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1825/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1825/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -14,7 +14,7 @@
</BaseTokens>
<Certificate type="President" shares="2"/>
<Certificate shares="1" number="8"/>
- <Trains number="4,4,3"/>
+ <Trains limit="4,4,3"/>
<TileLays>
<Number colour="yellow" number="2" phase="1,2,3,4,5"></Number></TileLays></CompanyType>
<Company name="S&M" type="Private" basePrice="30" revenue="5" longname="Swansea and Mumbles">
Modified: trunk/18xx/data/1825/Game.xml
===================================================================
--- trunk/18xx/data/1825/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1825/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -70,10 +70,10 @@
cities="double" if city-revenue is doubled (e.g. 1826 TGV).
-->
</Defaults>
- <Train name="2" majorStops="2" cost="180" amount="6"/>
- <Train name="3" majorStops="3" cost="300" amount="4" startPhase="2"/>
- <Train name="4" majorStops="4" cost="430" amount="3"/>
- <Train name="5" majorStops="5" cost="550" amount="4"
+ <Train name="2" majorStops="2" cost="180" quantity="6"/>
+ <Train name="3" majorStops="3" cost="300" quantity="4" startPhase="2"/>
+ <Train name="4" majorStops="4" cost="430" quantity="3"/>
+ <Train name="5" majorStops="5" cost="550" quantity="4"
startPhase="3" rustedTrain="2" />
</Component>
<Component name="PhaseManager" class="rails.game.PhaseManager">
Modified: trunk/18xx/data/1830/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1830/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1830/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -20,7 +20,7 @@
</BaseTokens>
<Certificate type="President" shares="2"/>
<Certificate shares="1" number="8"/>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
</CompanyType>
<Company name="SVNRR" type="Private" basePrice="20" revenue="5"
Modified: trunk/18xx/data/1830/Game.xml
===================================================================
--- trunk/18xx/data/1830/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1830/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -130,62 +130,62 @@
cities="double" if city-revenue is doubled (e.g. 1826 TGV).
-->
</Defaults>
- <Train name="2" majorStops="2" cost="80" amount="6">
+ <Train name="2" majorStops="2" cost="80" quantity="6">
<IfOption name="Variant" value="Coalfields,Reading,Coalfields&Reading">
<Attributes obsoleting="yes"/>
</IfOption>
<IfOption name="Variant" value="Wabash">
- <Attributes amount="7"/>
+ <Attributes quantity="7"/>
</IfOption>
</Train>
- <Train name="3" majorStops="3" cost="180" amount="5" startPhase="3">
+ <Train name="3" majorStops="3" cost="180" quantity="5" startPhase="3">
<IfOption name="Variant" value="Coalfields,Reading,Coalfields&Reading">
<Attributes obsoleting="yes"/>
</IfOption>
<IfOption name="Variant" value="Wabash">
- <Attributes amount="6"/>
+ <Attributes quantity="6"/>
</IfOption>
</Train>
- <Train name="4" majorStops="4" cost="300" amount="4" startPhase="4"
+ <Train name="4" majorStops="4" cost="300" quantity="4" startPhase="4"
rustedTrain="2">
<IfOption name="Variant" value="Coalfields,Reading">
- <Attributes obsoleting="yes" amount="5"/>
+ <Attributes obsoleting="yes" quantity="5"/>
</IfOption>
<IfOption name="Variant" value="Coalfields&Reading">
- <Attributes obsoleting="yes" amount="6"/>
+ <Attributes obsoleting="yes" quantity="6"/>
</IfOption>
<IfOption name="Variant" value="Wabash">
- <Attributes amount="5"/>
+ <Attributes quantity="5"/>
</IfOption>
</Train>
- <Train name="5" majorStops="5" cost="450" amount="3" startPhase="5">
+ <Train name="5" majorStops="5" cost="450" quantity="3" startPhase="5">
<IfOption name="Variant" value="Wabash">
- <Attributes amount="4"/>
+ <Attributes quantity="4"/>
</IfOption>
</Train>
<Train name="6" majorStops="6" cost="630" startPhase="6"
rustedTrain="3" releasedTrain="D">
<IfOption name="WithOptional6Train" value="yes">
- <Attributes amount="3"/>
+ <Attributes quantity="3"/>
</IfOption>
<IfOption name="WithOptional6Train" value="no">
- <Attributes amount="2"/>
+ <Attributes quantity="2"/>
</IfOption>
<IfOption name="Variant" value="Pere Marquette,Coalfields,Reading">
- <Attributes amount="3" releasedTrain="7,D"/>
+ <Attributes quantity="3" releasedTrain="7,D"/>
</IfOption>
<IfOption name="Variant" value="Coalfields&Reading">
- <Attributes amount="4" releasedTrain="7,D"/>
+ <Attributes quantity="4" releasedTrain="7,D"/>
</IfOption>
<IfOption name="Variant" value="Simple,Wabash">
- <Attributes amount="3"/>
+ <Attributes quantity="3"/>
</IfOption>
</Train>
<IfOption name="Variant" value="Coalfields,Reading,Coalfields&Reading">
- <Train name="7" majorStops="7" cost="710" amount="2"/>
+ <Train name="7" majorStops="7" cost="710" quantity="2"/>
</IfOption>
<IfOption name="Variant" value="Wabash">
- <Train name="7" majorStops="7" cost="830" amount="-1"/>
+ <Train name="7" majorStops="7" cost="830" quantity="-1"/>
</IfOption>
<IfOption name="Variant" value="Basegame,Pere Marquette,Reading,Coalfields,Coalfields&Reading,Simple">
<Train name="D" majorStops="99" startPhase="D" rustedTrain="4">
@@ -198,10 +198,10 @@
<Exchange cost="750"/>
</IfOption>
<IfOption name="UnlimitedTopTrains" value="yes">
- <Attributes amount="-1"/>
+ <Attributes quantity="-1"/>
</IfOption>
<IfOption name="UnlimitedTopTrains" value="no">
- <Attributes amount="6"/>
+ <Attributes quantity="6"/>
</IfOption>
<Exchange cost="800"/>
</Train>
Modified: trunk/18xx/data/1835/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1835/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1835/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -10,7 +10,7 @@
<HomeBase lay="whenFloated"/>
</BaseTokens>
<Payout split="always"/>
- <Trains number="2,2,1" mandatory="no"/>
+ <Trains limit="2,2,1" mandatory="no"/>
</CompanyType>
<CompanyType name="Major" class="rails.game.PublicCompany" capitalisation="incremental">
<PoolPaysOut/>
@@ -28,7 +28,7 @@
<HomeBase lay="whenFloated"/>
</BaseTokens>
<Capitalisation type="incremental"/>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
</CompanyType>
@@ -211,7 +211,7 @@
<Certificate shares="2" number="3"/>
<Certificate shares="2" number="4" status="reserved"/>
<Certificate shares="1" number="4" status="reserved"/>
- <Trains number="0,0,4,3"/>
+ <Trains limit="0,0,4,3"/>
</Company>
<StartPacket roundClass="rails.game.StartRound_1835" variant="Snake">
Modified: trunk/18xx/data/1835/Game.xml
===================================================================
--- trunk/18xx/data/1835/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1835/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -53,19 +53,19 @@
<Reach base="stops" countTowns="yes"/>
<Score towns="yes"/>
</Defaults>
- <Train name="2" majorStops="2" cost="80" amount="9"/>
- <Train name="2+2" majorStops="2" minorStops="2" cost="120" amount="4"/>
- <Train name="3" majorStops="3" cost="180" amount="4" startPhase="3"/>
- <Train name="3+3" majorStops="3" minorStops="3" cost="270" amount="3"/>
- <Train name="4" majorStops="4" cost="360" amount="3" startPhase="4"
+ <Train name="2" majorStops="2" cost="80" quantity="9"/>
+ <Train name="2+2" majorStops="2" minorStops="2" cost="120" quantity="4"/>
+ <Train name="3" majorStops="3" cost="180" quantity="4" startPhase="3"/>
+ <Train name="3+3" majorStops="3" minorStops="3" cost="270" quantity="3"/>
+ <Train name="4" majorStops="4" cost="360" quantity="3" startPhase="4"
rustedTrain="2"/>
- <Train name="4+4" majorStops="4" minorStops="4" cost="440" amount="1"
+ <Train name="4+4" majorStops="4" minorStops="4" cost="440" quantity="1"
startPhase="4+4" rustedTrain="2+2"/>
- <Train name="5" majorStops="5" cost="500" amount="2" startPhase="5"/>
- <Train name="5+5" majorStops="5" minorStops="5" cost="600" amount="1"/>
- <Train name="6" majorStops="6" cost="600" amount="2" startPhase="6"
+ <Train name="5" majorStops="5" cost="500" quantity="2" startPhase="5"/>
+ <Train name="5+5" majorStops="5" minorStops="5" cost="600" quantity="1"/>
+ <Train name="6" majorStops="6" cost="600" quantity="2" startPhase="6"
rustedTrain="3"/>
- <Train name="6+6" majorStops="6" minorStops="6" cost="720" amount="4"
+ <Train name="6+6" majorStops="6" minorStops="6" cost="720" quantity="4"
rustedTrain="3+3"/>
</Component>
<Component name="PhaseManager" class="rails.game.PhaseManager">
Modified: trunk/18xx/data/1851/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1851/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1851/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -10,7 +10,7 @@
<ShareUnit percentage="10"/>
<Certificate type="President" shares="2"/>
<Certificate shares="1" number="8"/>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<BaseTokens>
<BuyCost initialTokenCost="100"/>
<HomeBase lay="whenFloated"/>
Modified: trunk/18xx/data/1851/Game.xml
===================================================================
--- trunk/18xx/data/1851/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1851/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -54,20 +54,20 @@
cities="double" if city-revenue is doubled (e.g. 1826 TGV).
-->
</Defaults>
- <Train name="2" majorStops="2" cost="100" amount="5"/>
- <Train name="3" majorStops="3" cost="200" amount="4" startPhase="3"/>
- <Train name="4" majorStops="4" cost="300" amount="3" startPhase="4"
+ <Train name="2" majorStops="2" cost="100" quantity="5"/>
+ <Train name="3" majorStops="3" cost="200" quantity="4" startPhase="3"/>
+ <Train name="4" majorStops="4" cost="300" quantity="3" startPhase="4"
rustedTrain="2"/>
- <Train name="5" majorStops="5" cost="500" amount="2" startPhase="5"/>
- <Train name="6" majorStops="6" cost="600" amount="2" startPhase="6"
+ <Train name="5" majorStops="5" cost="500" quantity="2" startPhase="5"/>
+ <Train name="6" majorStops="6" cost="600" quantity="2" startPhase="6"
rustedTrain="3"/>
<Train name="8" majorStops="8" cost="800" startPhase="8"
rustedTrain="4">
<IfOption name="UnlimitedTopTrains" value="yes">
- <Attributes amount="-1"/>
+ <Attributes quantity="-1"/>
</IfOption>
<IfOption name="UnlimitedTopTrains" value="no">
- <Attributes amount="4"/>
+ <Attributes quantity="4"/>
</IfOption>
</Train>
<TrainBuyingRules>
Modified: trunk/18xx/data/1856/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1856/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1856/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -13,7 +13,7 @@
<BaseTokens>
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<Loans value="100" perRound="1" interest="10"/>
<!-- Number of loans is undefined and handled in the code -->
<CanUseSpecialProperties/>
@@ -26,7 +26,7 @@
<BaseTokens>
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
- <Trains number="0,0,0,3"/>
+ <Trains limit="0,0,0,3"/>
<Options mustTradeTrainsAtFixedPrice="yes" canClose="no"/>
</CompanyType>
Modified: trunk/18xx/data/1856/Game.xml
===================================================================
--- trunk/18xx/data/1856/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1856/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -51,14 +51,14 @@
<Reach base="stops" countTowns="major"/>
<Score towns="yes"/>
</Defaults>
- <Train name="2" majorStops="2" cost="100" amount="6"/>
- <Train name="3" majorStops="3" cost="225" amount="5" startPhase="2"/>
- <Train name="4" majorStops="4" cost="350" amount="4" startPhase="3"
+ <Train name="2" majorStops="2" cost="100" quantity="6"/>
+ <Train name="3" majorStops="3" cost="225" quantity="5" startPhase="2"/>
+ <Train name="4" majorStops="4" cost="350" quantity="4" startPhase="3"
rustedTrain="2"/>
- <Train name="5" majorStops="5" cost="550" amount="3" startPhase="4"/>
- <Train name="6" majorStops="6" cost="700" amount="2" startPhase="5"
+ <Train name="5" majorStops="5" cost="550" quantity="3" startPhase="4"/>
+ <Train name="6" majorStops="6" cost="700" quantity="2" startPhase="5"
rustedTrain="3" releasedTrain="D"/>
- <Train name="D" majorStops="99" cost="1100" amount="-1" startPhase="6"
+ <Train name="D" majorStops="99" cost="1100" quantity="-1" startPhase="6"
rustedTrain="4">
<Exchange cost="750"/>
</Train>
Modified: trunk/18xx/data/1870/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1870/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1870/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -21,7 +21,7 @@
<BaseTokens>
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
</CompanyType>
Modified: trunk/18xx/data/1870/Game.xml
===================================================================
--- trunk/18xx/data/1870/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1870/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -43,17 +43,17 @@
<Reach base="stops" countTowns="major"/>
<Score towns="yes"/>
</Defaults>
- <Train name="2" majorStops="2" cost="80" amount="7"/>
- <Train name="3" majorStops="3" cost="180" amount="6" startPhase="2"/>
- <Train name="4" majorStops="4" cost="300" amount="5" startPhase="3"
+ <Train name="2" majorStops="2" cost="80" quantity="7"/>
+ <Train name="3" majorStops="3" cost="180" quantity="6" startPhase="2"/>
+ <Train name="4" majorStops="4" cost="300" quantity="5" startPhase="3"
rustedTrain="2"/>
- <Train name="5" majorStops="5" cost="450" amount="4" startPhase="4"/>
- <Train name="6" majorStops="6" cost="630" amount="3" startPhase="5"
+ <Train name="5" majorStops="5" cost="450" quantity="4" startPhase="4"/>
+ <Train name="6" majorStops="6" cost="630" quantity="3" startPhase="5"
rustedTrain="3"/>
- <Train name="8" majorStops="8" cost="800" amount="3" startPhase="6"
+ <Train name="8" majorStops="8" cost="800" quantity="3" startPhase="6"
rustedTrain="4"/>
- <Train name="10" majorStops="10" cost="950" amount="2" startPhase="7"/>
- <Train name="12" majorStops="12" cost="1100" amount="-1" startPhase="8"
+ <Train name="10" majorStops="10" cost="950" quantity="2" startPhase="7"/>
+ <Train name="12" majorStops="12" cost="1100" quantity="-1" startPhase="8"
rustedTrain="5"/>
</Component>
<Component name="PhaseManager" class="rails.game.PhaseManager">
Modified: trunk/18xx/data/1880/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1880/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1880/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -20,7 +20,7 @@
<HomeBase lay="whenFloated"/>
</BaseTokens>
<Payout split="no"/>
- <Trains number="1" mandatory="no"/>
+ <Trains limit="1" mandatory="no"/>
</CompanyType>
<CompanyType name="Private" class="rails.game.PrivateCompany"/>
@@ -41,7 +41,7 @@
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
<Capitalisation type="incremental"/>
- <Trains number="4,4,4,3,3,3,3,3,2,2,2"/>
+ <Trains limit="4,4,4,3,3,3,3,3,2,2,2"/>
<CanUseSpecialProperties/>
</CompanyType>
Modified: trunk/18xx/data/1880/Game.xml
===================================================================
--- trunk/18xx/data/1880/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1880/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -38,21 +38,21 @@
<Reach base="stops" countTowns="major"/>
<Score towns="yes"/>
</Defaults>
- <Train name="2" majorStops="2" cost="100" amount="10"/>
- <Train name="2+2" majorStops="2" minorStops="2" cost="180" amount="5"/>
- <Train name="3" majorStops="3" cost="180" amount="6" startPhase="2"/>
- <Train name="3+3" majorStops="3" minorStops="3" cost="300" amount="5" startPhase="3"/>
- <Train name="4" majorStops="4" cost="300" amount="5" startPhase="4" rustedTrain="2"/>
- <Train name="4+4" majorStops="4" minorStops="4" cost="450" amount="5" startPhase="5" rustedTrain="2+2"/>
- <Train name="6" majorStops="6" cost="600" amount="5" startPhase="6" rustedTrain="3"/>
- <Train name="6e" majorStops="-1" cost="700" amount="5" startPhase="7" rustedTrain="3+3"/>
+ <Train name="2" majorStops="2" cost="100" quantity="10"/>
+ <Train name="2+2" majorStops="2" minorStops="2" cost="180" quantity="5"/>
+ <Train name="3" majorStops="3" cost="180" quantity="6" startPhase="2"/>
+ <Train name="3+3" majorStops="3" minorStops="3" cost="300" quantity="5" startPhase="3"/>
+ <Train name="4" majorStops="4" cost="300" quantity="5" startPhase="4" rustedTrain="2"/>
+ <Train name="4+4" majorStops="4" minorStops="4" cost="450" quantity="5" startPhase="5" rustedTrain="2+2"/>
+ <Train name="6" majorStops="6" cost="600" quantity="5" startPhase="6" rustedTrain="3"/>
+ <Train name="6e" majorStops="-1" cost="700" quantity="5" startPhase="7" rustedTrain="3+3"/>
<!-- majorStops="-1" indicates that this not a normally running train-->
<!-- The e-type trains are express trains that can ignore towns/cities on their way for a maximum payout-->
- <Train name="8" majorStops="8" cost="800" amount="2" startPhase="8" rustedTrain="4"/>
- <Train name="8e" majorStops="-1" cost="900" amount="2" rustedTrain="4+4"/>
+ <Train name="8" majorStops="8" cost="800" quantity="2" startPhase="8" rustedTrain="4"/>
+ <Train name="8e" majorStops="-1" cost="900" quantity="2" rustedTrain="4+4"/>
<!-- majorStops="-1" indicates that this not a normally running train-->
<!-- The e-type trains are express trains that can ignore towns/cities on their way for a maximum payout-->
- <Train name="10" majorStops="10" cost="1000" amount="-1"/>
+ <Train name="10" majorStops="10" cost="1000" quantity="-1"/>
</Component>
<Component name="PhaseManager" class="rails.game.PhaseManager">
<Phase name="A1">
Modified: trunk/18xx/data/1889/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1889/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1889/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -19,7 +19,7 @@
</BaseTokens>
<Certificate type="President" shares="2"/>
<Certificate shares="1" number="8"/>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
</CompanyType>
<IfOption name="BeginnerGame" value="yes">
Modified: trunk/18xx/data/1889/Game.xml
===================================================================
--- trunk/18xx/data/1889/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/1889/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -80,27 +80,27 @@
cities="double" if city-revenue is doubled (e.g. 1826 TGV).
-->
</Defaults>
- <Train name="2" majorStops="2" cost="80" amount="6"/>
- <Train name="3" majorStops="3" cost="180" amount="5" startPhase="3"/>
- <Train name="4" majorStops="4" cost="300" amount="4" startPhase="4"
+ <Train name="2" majorStops="2" cost="80" quantity="6"/>
+ <Train name="3" majorStops="3" cost="180" quantity="5" startPhase="3"/>
+ <Train name="4" majorStops="4" cost="300" quantity="4" startPhase="4"
rustedTrain="2"/>
- <Train name="5" majorStops="5" cost="450" amount="3" startPhase="5"/>
+ <Train name="5" majorStops="5" cost="450" quantity="3" startPhase="5"/>
<Train name="6" majorStops="6" cost="630" startPhase="6"
rustedTrain="3" releasedTrain="D">
<IfOption name="WithOptional6Train" value="yes">
- <Attributes amount="3"/>
+ <Attributes quantity="3"/>
</IfOption>
<IfOption name="WithOptional6Train" value="no">
- <Attributes amount="2"/>
+ <Attributes quantity="2"/>
</IfOption>
</Train>
<Train name="D" majorStops="99" cost="1100" startPhase="D"
rustedTrain="4">
<IfOption name="UnlimitedTopTrains" value="yes">
- <Attributes amount="-1"/>
+ <Attributes quantity="-1"/>
</IfOption>
<IfOption name="UnlimitedTopTrains" value="no">
- <Attributes amount="6"/>
+ <Attributes quantity="6"/>
</IfOption>
<Exchange cost="800"/>
</Train>
Modified: trunk/18xx/data/18AL/CompanyManager.xml
===================================================================
--- trunk/18xx/data/18AL/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/18AL/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -13,7 +13,7 @@
<BaseTokens>
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
- <Trains number="4,4,3,2"/>
+ <Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
</CompanyType>
<Company name="Tusc" type="Private" basePrice="20" revenue="5" longname="Tuscumbia Railway"/>
Modified: trunk/18xx/data/18AL/Game.xml
===================================================================
--- trunk/18xx/data/18AL/Game.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/18AL/Game.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -49,9 +49,9 @@
<Reach base="stops" countTowns="no"/>
<Score towns="yes"/>
</Defaults>
- <Train name="2" majorStops="2" cost="100" amount="5"/>
- <Train name="3" majorStops="3" cost="180" amount="4" startPhase="3"/>
- <Train name="4" majorStops="4" cost="300" amount="3" startPhase="4"
+ <Train name="2" majorStops="2" cost="100" quantity="5"/>
+ <Train name="3" majorStops="3" cost="180" quantity="4" startPhase="3"/>
+ <Train name="4" majorStops="4" cost="300" quantity="3" startPhase="4"
rustedTrain="2" >
<IfOption name="Obsolete4Trains" value="yes">
<Attributes obsoleting="yes"/>
@@ -60,17 +60,17 @@
<Attributes obsoleting="no"/>
</IfOption>
</Train>/>
- <Train name="5" majorStops="5" cost="450" amount="2" startPhase="5"/>
- <Train name="6" majorStops="6" cost="630" amount="1" startPhase="6"
+ <Train name="5" majorStops="5" cost="450" quantity="2" startPhase="5"/>
+ <Train name="6" majorStops="6" cost="630" quantity="1" startPhase="6"
rustedTrain="3"/>
- <Train name="7" majorStops="7" cost="700" amount="1" startPhase="7"
+ <Train name="7" majorStops="7" cost="700" quantity="1" startPhase="7"
rustedTrain="4"/>
<Train name="4D" majorStops="4" cost="800" startPhase="4D">
<IfOption name="UnlimitedTopTrains" value="yes">
- <Attributes amount="-1"/>
+ <Attributes quantity="-1"/>
</IfOption>
<IfOption name="UnlimitedTopTrains" value="no">
- <Attributes amount="5"/>
+ <Attributes quantity="5"/>
</IfOption>
<Reach countTowns="no"/>
<Score scoreCities="double"/>
Modified: trunk/18xx/data/18EU/CompanyManager.xml
===================================================================
--- trunk/18xx/data/18EU/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561)
+++ trunk/18xx/data/18EU/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562)
@@ -1,118 +1,130 @@
-<?xml version="1.0"?>
-<CompanyManager>
- <CompanyType name="Minor" class="rails.game.PublicCompany" fgColour="000000" bgColour="CCCCCC">
- <ShareUnit percentage="100"/>
- <Certificate type="President" shares="1"/>
- <StockPrice market="no"/>
- <Payout split="always"/>
- <TileLays>
- <Number colour="yellow" phase="2" number="2" occurrences="1"/>
- <Number colour="green" phase="3,4,5,6,8" number="0"/>
- <Number colour="brown" phase="5,6,8" number="0"/>
- <Number colour="grey" phase="8" number="0"/>
- </TileLays>
- <BaseTokens>
- <HomeBase lay="whenStarted"/>
- </BaseTokens>
- <Trains initial="2" number="2,2,1" mandatory="no"/>
- </CompanyType>
- <CompanyType name="Major" class="rails.game.PublicCompany" capitalisation="incremental" restartable="yes">
- <Float percentage="50"/>
- <TreasuryCanHoldOwnShares maxPerc="80"/>
- <HomeBase lay="whenStarted"/>
- <StockPrice par="no"/>
- <ShareUnit percentage="10"/>
- <Certificate type="President" shares="2"/>
- <Certificate shares="1" number="8"/>
- <Capitalisation type="incremental"/>
- <BaseTokens>
- <BuyCost initialTokenCost="100"/>
- <HomeBase lay="whenStarted"/>
- </BaseTokens>
- <Payout split="allowed" mustExceedPriceToMove="yes"/>
- <Trains number="4,4,3,2"/>
- <TradeShares mustHaveOperated="yes"/>
- </CompanyType>
-
- <Company name="1" longname="Chemin de Fer du Nord" type="Minor">
- <Home hex="J1" city="1"/>
- </Company>
- <Company name="2" longname="État Belge" type="Minor">
- <Home hex="H3"/>
- </Company>
- <Company name="3" longname="Paris-Lyon-Méditerranée" type="Minor">
- <Home hex="J1" city="2"/>
- </Company>
- <Company name="4" longname="Leipzig-Dresdner-Bahn" type="Minor">
- <Home hex="G10"/>
- </Company>
- <Company name="5" longname="Ferrovia Adriatica" type="Minor">
- <Home hex="S8"/>
- </Company>
- <Company name="6" longname="Kaiser-Ferdinand-Nordbahn" type="Minor">
- <Home hex="N11" city="1"/>
- </Company>
- <Company name="7" longname="Berlin-Potsdamer-Bahn" type="Minor">
- <Home hex="E10" city="2"/>
- </Company>
- <Company name="8" longname="Ungarische Staatsbahn" type="Minor">
- <Home hex="P13"/>
- </Company>
- <Company name="9" longname="Berlin-Stettiner-Bahn" type="Minor">
- <Home hex="E10" city="1"/>
- </Company>
- <Company name="10" longname="Strade Ferrate Alta Italia" type="Minor">
- <Home hex="R5"/>
- </Company>
- <Company name="11" longname="Südbahn" type="Minor">
- <Home hex="N11" city="2"/>
- </Company>
- <Company name="12" longname="Hollandsche Maatschappij" type="Minor">
- <Home hex="C4"/>
- </Company>
- <Company name="13" longname="Ludwigsbahn" type="Minor">
- <Home hex="L7"/>
- </Company>
- <Company name="14" longname="Ligne Strasbourg-Bâle" type="Minor">
- <Home hex="M4"/>
- </Company>
- <Company name="15" longname="Grand Central" type="Minor">
- <Home hex="Q2"/>
- </Company>
-
- <Company name="SNCB" longname="Société Nationale des...
[truncated message content] |
|
From: <ev...@us...> - 2011-05-22 14:45:51
|
Revision: 1564
http://rails.svn.sourceforge.net/rails/?rev=1564&view=rev
Author: evos
Date: 2011-05-22 14:45:45 +0000 (Sun, 22 May 2011)
Log Message:
-----------
Added 'quantityIncrement' attribute to <Train>. Not used yet, but may be useful for 1825 kits.
Added comments to 1830/Game.xml and 1830/TileSet.xml to indicate the option to use this new attribute.
Modified Paths:
--------------
trunk/18xx/data/1830/Game.xml
trunk/18xx/data/1830/TileSet.xml
trunk/18xx/rails/game/TrainType.java
Modified: trunk/18xx/data/1830/Game.xml
===================================================================
--- trunk/18xx/data/1830/Game.xml 2011-05-21 10:40:43 UTC (rev 1563)
+++ trunk/18xx/data/1830/Game.xml 2011-05-22 14:45:45 UTC (rev 1564)
@@ -136,6 +136,8 @@
</IfOption>
<IfOption name="Variant" value="Wabash">
<Attributes quantity="7"/>
+ <!-- NOTE: An alternative way to configure an extra train is: quantityIncrement="+1"
+ (the '+' is optional) -->
</IfOption>
</Train>
<Train name="3" majorStops="3" cost="180" quantity="5" startPhase="3">
Modified: trunk/18xx/data/1830/TileSet.xml
===================================================================
--- trunk/18xx/data/1830/TileSet.xml 2011-05-21 10:40:43 UTC (rev 1563)
+++ trunk/18xx/data/1830/TileSet.xml 2011-05-22 14:45:45 UTC (rev 1564)
@@ -111,6 +111,8 @@
<Tile id="15" quantity="2">
<IfOption name="Variant" value="Coalfields,Coalfields&Reading,Wabash">
<Attributes quantity="3"/>
+ <!-- NOTE: An alternative way to configure an extra tile is: quantityIncrement="+1"
+ (the '+' is optional) -->
</IfOption>
<IfOption name="Variant" value="Wabash">
<Upgrade id="63,448"/>
Modified: trunk/18xx/rails/game/TrainType.java
===================================================================
--- trunk/18xx/rails/game/TrainType.java 2011-05-21 10:40:43 UTC (rev 1563)
+++ trunk/18xx/rails/game/TrainType.java 2011-05-22 14:45:45 UTC (rev 1564)
@@ -123,6 +123,8 @@
} else if (quantity <= 0) {
throw new ConfigurationException(
LocalText.getText("InvalidQuantity", String.valueOf(quantity)));
+ } else {
+ quantity += tag.getAttributeAsInteger("quantityIncrement", 0);
}
// Major stops
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-07 15:25:40
|
Revision: 1569
http://rails.svn.sourceforge.net/rails/?rev=1569&view=rev
Author: evos
Date: 2011-06-07 15:25:30 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
Initial attempt to include a background map.
18EU map included.
Zooming with a background map does not yet work correctly! Avoid zooming in serious play.
Modified Paths:
--------------
trunk/18xx/.settings/org.eclipse.jdt.core.prefs
trunk/18xx/data/18EU/Map.xml
trunk/18xx/rails/game/MapManager.java
trunk/18xx/rails/ui/swing/MapPanel.java
trunk/18xx/rails/ui/swing/ORPanel.java
trunk/18xx/rails/ui/swing/hexmap/EWHexMap.java
trunk/18xx/rails/ui/swing/hexmap/GUIHex.java
trunk/18xx/rails/ui/swing/hexmap/HexMap.java
trunk/18xx/rails/ui/swing/hexmap/NSHexMap.java
Added Paths:
-----------
trunk/18xx/data/18EU/MapImage.svg
trunk/18xx/rails/ui/swing/hexmap/HexMapImage.java
Modified: trunk/18xx/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/18xx/.settings/org.eclipse.jdt.core.prefs 2011-05-23 16:44:56 UTC (rev 1568)
+++ trunk/18xx/.settings/org.eclipse.jdt.core.prefs 2011-06-07 15:25:30 UTC (rev 1569)
@@ -1,4 +1,4 @@
-#Sun Jul 04 20:27:07 CEST 2010
+#Thu Jun 02 21:56:30 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
Modified: trunk/18xx/data/18EU/Map.xml
===================================================================
--- trunk/18xx/data/18EU/Map.xml 2011-05-23 16:44:56 UTC (rev 1568)
+++ trunk/18xx/data/18EU/Map.xml 2011-06-07 15:25:30 UTC (rev 1569)
@@ -1,4 +1,5 @@
<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A">
+ <Image file="18EU/MapImage.svg" x="18" y="15" scale="0.952"/>
<!-- Hex name="" tile="" orientation="" value="" impassable="" label="" cost="" value="" port="yes/no" -->
<Hex name="A4" port="yes" value="10" tile="-800" orientation="0"/>
<Hex name="B7" value="30,50" tile="-939" orientation="1" city="Hamburg"/>
Added: trunk/18xx/data/18EU/MapImage.svg
===================================================================
--- trunk/18xx/data/18EU/MapImage.svg (rev 0)
+++ trunk/18xx/data/18EU/MapImage.svg 2011-06-07 15:25:30 UTC (rev 1569)
@@ -0,0 +1,6793 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="1342.007"
+ height="1242.5"
+ viewBox="0 0 1342.007 1242.5"
+ enable-background="new 0 0 1746 1314"
+ xml:space="preserve"
+ inkscape:version="0.48.0 r9654"
+ sodipodi:docname="18EU-Map.svg"><metadata
+ id="metadata2109"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs2107" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="803"
+ inkscape:window-height="624"
+ id="namedview2105"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.22146119"
+ inkscape:cx="633.204"
+ inkscape:cy="603.25"
+ inkscape:window-x="1910"
+ inkscape:window-y="196"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g3"
+ transform="translate(-239.796,-17.75)">
+ <defs
+ id="defs5">
+ <rect
+ id="SVGID_1_"
+ x="-9"
+ y="9"
+ width="1746"
+ height="1314" />
+ </defs>
+ <clipPath
+ id="SVGID_2_">
+ <use
+ xlink:href="#SVGID_1_"
+ overflow="visible"
+ id="use9"
+ style="overflow:visible"
+ x="0"
+ y="0"
+ width="1746"
+ height="1314" />
+ </clipPath>
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="489.6,504 520.776,504 536.365,477 551.953,450 536.365,423 520.776,396 489.6,396 458.423,396 442.835,423 427.246,450 442.835,477 458.423,504 "
+ id="polygon11"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="489.6,504 520.776,504 536.365,477 551.953,450 536.365,423 520.776,396 489.6,396 458.423,396 442.835,423 427.246,450 442.835,477 458.423,504 "
+ id="polygon13"
+ style="fill:none;stroke:#999999;stroke-width:7.99989986;stroke-miterlimit:2.61310005;stroke-dasharray:8, 8" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="817.166,1071 832.754,1044 817.165,1017 801.577,990.001 770.4,990 739.223,990 723.635,1017 708.046,1044 723.635,1071 739.223,1098 770.4,1098 801.577,1098 "
+ id="polygon15"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="817.166,1071 832.754,1044 817.165,1017 801.577,990.001 770.4,990 739.223,990 723.635,1017 708.046,1044 723.635,1071 739.223,1098 770.4,1098 801.577,1098 "
+ id="polygon17"
+ style="fill:none;stroke:#999999;stroke-width:7.99989986;stroke-miterlimit:2.61310005;stroke-dasharray:8, 8" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="770.4,1206 801.577,1206 817.165,1179 832.753,1152 817.165,1125 801.577,1098 770.4,1098 739.224,1098 723.635,1125 708.046,1152 723.635,1179 739.224,1206 "
+ id="polygon19"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="770.4,1206 801.577,1206 817.165,1179 832.753,1152 817.165,1125 801.577,1098 770.4,1098 739.224,1098 723.635,1125 708.046,1152 723.635,1179 739.224,1206 "
+ id="polygon21"
+ style="fill:none;stroke:#999999;stroke-width:7.99989986;stroke-miterlimit:2.61310005;stroke-dasharray:8, 8" />
+ <polyline
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="832.753,1260 817.165,1233 801.577,1206 770.4,1206 739.224,1206 723.635,1233 708.046,1260 "
+ id="polyline23"
+ style="fill:#ffffff;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1051.199,396 1082.376,396 1097.965,369 1113.553,342 1097.965,315 1082.376,288 1051.199,288 1020.023,288 1004.435,315 988.846,342 1004.435,369 1020.023,396 "
+ id="polygon25"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1051.199,396 1082.376,396 1097.965,369 1113.553,342 1097.965,315 1082.376,288 1051.199,288 1020.023,288 1004.435,315 988.846,342 1004.435,369 1020.023,396 "
+ id="polygon27"
+ style="fill:none;stroke:#999999;stroke-width:7.99989986;stroke-miterlimit:2.61310005;stroke-dasharray:8, 8" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="957.6,234 988.776,234 1004.364,207 1019.952,180 1004.364,153 988.776,126 957.6,126 926.423,126 910.835,153 895.246,180 910.835,207 926.423,234 "
+ id="polygon29"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="957.6,234 988.776,234 1004.364,207 1019.952,180 1004.364,153 988.776,126 957.6,126 926.423,126 910.835,153 895.246,180 910.835,207 926.423,234 "
+ id="polygon31"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1051.199,288 1082.376,288 1097.965,261 1113.553,234 1097.965,207 1082.376,180 1051.199,180 1020.023,180 1004.435,207 988.846,234 1004.435,261 1020.023,288 "
+ id="polygon33"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1051.199,288 1082.376,288 1097.965,261 1113.553,234 1097.965,207 1082.376,180 1051.199,180 1020.023,180 1004.435,207 988.846,234 1004.435,261 1020.023,288 "
+ id="polygon35"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1144.8,234 1175.977,234 1191.564,207 1207.153,180 1191.564,153 1175.977,126 1144.8,126 1113.623,126 1098.035,153 1082.446,180 1098.035,207 1113.623,234 "
+ id="polygon37"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1144.8,234 1175.977,234 1191.564,207 1207.153,180 1191.564,153 1175.977,126 1144.8,126 1113.623,126 1098.035,153 1082.446,180 1098.035,207 1113.623,234 "
+ id="polygon39"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1144.8,450 1175.977,450 1191.564,423 1207.153,396 1191.564,369 1175.977,342 1144.8,342 1113.623,342 1098.035,369 1082.446,396 1098.035,423 1113.623,450 "
+ id="polygon41"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1144.8,450 1175.977,450 1191.564,423 1207.153,396 1191.564,369 1175.977,342 1144.8,342 1113.623,342 1098.035,369 1082.446,396 1098.035,423 1113.623,450 "
+ id="polygon43"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1144.8,558 1175.977,558 1191.564,531 1207.153,504 1191.564,477 1175.977,450 1144.8,450 1113.623,450 1098.035,477 1082.446,504 1098.035,531 1113.623,558 "
+ id="polygon45"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1144.8,558 1175.977,558 1191.564,531 1207.153,504 1191.564,477 1175.977,450 1144.8,450 1113.623,450 1098.035,477 1082.446,504 1098.035,531 1113.623,558 "
+ id="polygon47"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1144.8,666 1175.977,666 1191.564,639 1207.153,612 1191.564,585 1175.977,558 1144.8,558 1113.623,558 1098.035,585 1082.446,612 1098.035,639 1113.623,666 "
+ id="polygon49"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1144.8,666 1175.977,666 1191.564,639 1207.153,612 1191.564,585 1175.977,558 1144.8,558 1113.623,558 1098.035,585 1082.446,612 1098.035,639 1113.623,666 "
+ id="polygon51"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1238.399,288 1269.576,288 1285.164,261 1300.753,234 1285.164,207 1269.576,180 1238.399,180 1207.223,180 1191.635,207 1176.046,234 1191.635,261 1207.223,288 "
+ id="polygon53"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1238.399,288 1269.576,288 1285.164,261 1300.753,234 1285.164,207 1269.576,180 1238.399,180 1207.223,180 1191.635,207 1176.046,234 1191.635,261 1207.223,288 "
+ id="polygon55"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1238.399,396 1269.576,396 1285.164,369 1300.753,342 1285.164,315 1269.576,288 1238.399,288 1207.223,288 1191.635,315 1176.046,342 1191.635,369 1207.223,396 "
+ id="polygon57"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1238.399,396 1269.576,396 1285.164,369 1300.753,342 1285.164,315 1269.576,288 1238.399,288 1207.223,288 1191.635,315 1176.046,342 1191.635,369 1207.223,396 "
+ id="polygon59"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1238.399,504 1269.576,504 1285.164,477 1300.753,450 1285.164,423 1269.576,396 1238.399,396 1207.223,396 1191.635,423 1176.046,450 1191.635,477 1207.223,504 "
+ id="polygon61"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1238.399,504 1269.576,504 1285.164,477 1300.753,450 1285.164,423 1269.576,396 1238.399,396 1207.223,396 1191.635,423 1176.046,450 1191.635,477 1207.223,504 "
+ id="polygon63"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1238.399,612 1269.576,612 1285.164,585 1300.753,558 1285.164,531 1269.576,504 1238.399,504 1207.223,504 1191.635,531 1176.046,558 1191.635,585 1207.223,612 "
+ id="polygon65"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1238.399,612 1269.576,612 1285.164,585 1300.753,558 1285.164,531 1269.576,504 1238.399,504 1207.223,504 1191.635,531 1176.046,558 1191.635,585 1207.223,612 "
+ id="polygon67"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1332,342 1363.176,342 1378.765,315 1394.353,288 1378.765,261 1363.176,234 1332,234 1300.823,234 1285.234,261 1269.646,288 1285.234,315 1300.823,342 "
+ id="polygon69"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1332,342 1363.176,342 1378.765,315 1394.353,288 1378.765,261 1363.176,234 1332,234 1300.823,234 1285.234,261 1269.646,288 1285.234,315 1300.823,342 "
+ id="polygon71"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1332,450 1363.176,450 1378.765,423 1394.353,396 1378.765,369 1363.176,342 1332,342 1300.823,342 1285.234,369 1269.646,396 1285.234,423 1300.823,450 "
+ id="polygon73"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1332,450 1363.176,450 1378.765,423 1394.353,396 1378.765,369 1363.176,342 1332,342 1300.823,342 1285.234,369 1269.646,396 1285.234,423 1300.823,450 "
+ id="polygon75"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1425.6,396 1456.776,396 1472.364,369 1487.953,342 1472.364,315 1456.776,288 1425.6,288 1394.423,288 1378.835,315 1363.246,342 1378.835,369 1394.423,396 "
+ id="polygon77"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1425.6,396 1456.776,396 1472.364,369 1487.953,342 1472.364,315 1456.776,288 1425.6,288 1394.423,288 1378.835,315 1363.246,342 1378.835,369 1394.423,396 "
+ id="polygon79"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1332,558 1363.176,558 1378.765,531 1394.353,504 1378.765,477 1363.176,450 1332,450 1300.823,450 1285.234,477 1269.646,504 1285.234,531 1300.823,558 "
+ id="polygon81"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1332,558 1363.176,558 1378.765,531 1394.353,504 1378.765,477 1363.176,450 1332,450 1300.823,450 1285.234,477 1269.646,504 1285.234,531 1300.823,558 "
+ id="polygon83"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1332,666 1363.176,666 1378.765,639 1394.353,612 1378.765,585 1363.176,558 1332,558 1300.823,558 1285.234,585 1269.646,612 1285.234,639 1300.823,666 "
+ id="polygon85"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1332,666 1363.176,666 1378.765,639 1394.353,612 1378.765,585 1363.176,558 1332,558 1300.823,558 1285.234,585 1269.646,612 1285.234,639 1300.823,666 "
+ id="polygon87"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1425.6,504 1456.776,504 1472.364,477 1487.953,450 1472.364,423 1456.776,396 1425.6,396 1394.423,396 1378.835,423 1363.246,450 1378.835,477 1394.423,504 "
+ id="polygon89"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1425.6,504 1456.776,504 1472.364,477 1487.953,450 1472.364,423 1456.776,396 1425.6,396 1394.423,396 1378.835,423 1363.246,450 1378.835,477 1394.423,504 "
+ id="polygon91"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1425.6,612 1456.776,612 1472.364,585 1487.953,558 1472.364,531 1456.776,504 1425.6,504 1394.423,504 1378.835,531 1363.246,558 1378.835,585 1394.423,612 "
+ id="polygon93"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1425.6,612 1456.776,612 1472.364,585 1487.953,558 1472.364,531 1456.776,504 1425.6,504 1394.423,504 1378.835,531 1363.246,558 1378.835,585 1394.423,612 "
+ id="polygon95"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1519.199,342 1550.376,342 1565.965,315 1581.553,288 1565.965,261 1550.376,234 1519.199,234 1488.023,234 1472.435,261 1456.846,288 1472.435,315 1488.023,342 "
+ id="polygon97"
+ style="fill:#ff0000;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1519.199,342 1550.376,342 1565.965,315 1581.553,288 1565.965,261 1550.376,234 1519.199,234 1488.023,234 1472.435,261 1456.846,288 1472.435,315 1488.023,342 "
+ id="polygon99"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1051.199,504 1082.376,504 1097.965,477 1113.553,450 1097.965,423 1082.376,396 1051.199,396 1020.023,396 1004.435,423 988.846,450 1004.435,477 1020.023,504 "
+ id="polygon101"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1051.199,504 1082.376,504 1097.965,477 1113.553,450 1097.965,423 1082.376,396 1051.199,396 1020.023,396 1004.435,423 988.846,450 1004.435,477 1020.023,504 "
+ id="polygon103"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="1051.199,612 1082.376,612 1097.965,585 1113.553,558 1097.965,531 1082.376,504 1051.199,504 1020.023,504 1004.435,531 988.846,558 1004.435,585 1020.023,612 "
+ id="polygon105"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="1051.199,612 1082.376,612 1097.965,585 1113.553,558 1097.965,531 1082.376,504 1051.199,504 1020.023,504 1004.435,531 988.846,558 1004.435,585 1020.023,612 "
+ id="polygon107"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="957.6,342 988.776,342 1004.364,315 1019.952,288 1004.364,261 988.776,234 957.6,234 926.423,234 910.835,261 895.246,288 910.835,315 926.423,342 "
+ id="polygon109"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="957.6,342 988.776,342 1004.364,315 1019.952,288 1004.364,261 988.776,234 957.6,234 926.423,234 910.835,261 895.246,288 910.835,315 926.423,342 "
+ id="polygon111"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="957.6,450 988.776,450 1004.364,423 1019.952,396 1004.364,369 988.776,342 957.6,342 926.423,342 910.835,369 895.246,396 910.835,423 926.423,450 "
+ id="polygon113"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="957.6,450 988.776,450 1004.364,423 1019.952,396 1004.364,369 988.776,342 957.6,342 926.423,342 910.835,369 895.246,396 910.835,423 926.423,450 "
+ id="polygon115"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="957.6,558 988.776,558 1004.364,531 1019.952,504 1004.364,477 988.776,450 957.6,450 926.423,450 910.835,477 895.246,504 910.835,531 926.423,558 "
+ id="polygon117"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="957.6,558 988.776,558 1004.364,531 1019.952,504 1004.364,477 988.776,450 957.6,450 926.423,450 910.835,477 895.246,504 910.835,531 926.423,558 "
+ id="polygon119"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="957.6,666 988.776,666 1004.364,639 1019.952,612 1004.364,585 988.776,558 957.6,558 926.423,558 910.835,585 895.246,612 910.835,639 926.423,666 "
+ id="polygon121"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="957.6,666 988.776,666 1004.364,639 1019.952,612 1004.364,585 988.776,558 957.6,558 926.423,558 910.835,585 895.246,612 910.835,639 926.423,666 "
+ id="polygon123"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="863.999,288 895.176,288 910.764,261 926.353,234 910.764,207 895.176,180 863.999,180 832.823,180 817.234,207 801.646,234 817.234,261 832.823,288 "
+ id="polygon125"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="863.999,288 895.176,288 910.764,261 926.353,234 910.764,207 895.176,180 863.999,180 832.823,180 817.234,207 801.646,234 817.234,261 832.823,288 "
+ id="polygon127"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="863.999,180 895.176,180 910.764,153 926.353,126 910.764,99 895.176,72 863.999,72 832.823,72 817.234,99 801.646,126 817.234,153 832.823,180 "
+ id="polygon129"
+ style="fill:#ff0000;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="863.999,180 895.176,180 910.764,153 926.353,126 910.764,99 895.176,72 863.999,72 832.823,72 817.234,99 801.646,126 817.234,153 832.823,180 "
+ id="polygon131"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="863.999,396 895.176,396 910.764,369 926.353,342 910.764,315 895.176,288 863.999,288 832.823,288 817.234,315 801.646,342 817.234,369 832.823,396 "
+ id="polygon133"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="863.999,396 895.176,396 910.764,369 926.353,342 910.764,315 895.176,288 863.999,288 832.823,288 817.234,315 801.646,342 817.234,369 832.823,396 "
+ id="polygon135"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="863.999,504 895.176,504 910.764,477 926.353,450 910.764,423 895.176,396 863.999,396 832.823,396 817.234,423 801.646,450 817.234,477 832.823,504 "
+ id="polygon137"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="863.999,504 895.176,504 910.764,477 926.353,450 910.764,423 895.176,396 863.999,396 832.823,396 817.234,423 801.646,450 817.234,477 832.823,504 "
+ id="polygon139"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="863.999,612 895.176,612 910.764,585 926.353,558 910.764,531 895.176,504 863.999,504 832.823,504 817.234,531 801.646,558 817.234,585 832.823,612 "
+ id="polygon141"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="863.999,612 895.176,612 910.764,585 926.353,558 910.764,531 895.176,504 863.999,504 832.823,504 817.234,531 801.646,558 817.234,585 832.823,612 "
+ id="polygon143"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="396,450 427.177,450 442.765,423 458.353,396 442.765,369 427.177,342 396,342 364.823,342 349.235,369 333.646,396 349.235,423 364.823,450 "
+ id="polygon145"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="396,450 427.177,450 442.765,423 458.353,396 442.765,369 427.177,342 396,342 364.823,342 349.235,369 333.646,396 349.235,423 364.823,450 "
+ id="polygon147"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="396,666 427.177,666 442.765,639 458.353,612 442.765,585 427.177,558 396,558 364.823,558 349.235,585 333.646,612 349.235,639 364.823,666 "
+ id="polygon149"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="396,666 427.177,666 442.765,639 458.353,612 442.765,585 427.177,558 396,558 364.823,558 349.235,585 333.646,612 349.235,639 364.823,666 "
+ id="polygon151"
+ style="fill:none;stroke:#999999;stroke-width:7.99989986;stroke-miterlimit:2.61310005;stroke-dasharray:8, 8" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="489.6,288 520.776,288 536.365,261 551.953,234 536.365,207 520.776,180 489.6,180 458.423,180 442.835,207 427.246,234 442.835,261 458.423,288 "
+ id="polygon153"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="489.6,288 520.776,288 536.365,261 551.953,234 536.365,207 520.776,180 489.6,180 458.423,180 442.835,207 427.246,234 442.835,261 458.423,288 "
+ id="polygon155"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="489.6,396 520.776,396 536.365,369 551.953,342 536.365,315 520.776,288 489.6,288 458.423,288 442.835,315 427.246,342 442.835,369 458.423,396 "
+ id="polygon157"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="489.6,396 520.776,396 536.365,369 551.953,342 536.365,315 520.776,288 489.6,288 458.423,288 442.835,315 427.246,342 442.835,369 458.423,396 "
+ id="polygon159"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="489.6,612 520.776,612 536.365,585 551.953,558 536.365,531 520.776,504 489.6,504 458.423,504 442.835,531 427.246,558 442.835,585 458.423,612 "
+ id="polygon161"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="489.6,612 520.776,612 536.365,585 551.953,558 536.365,531 520.776,504 489.6,504 458.423,504 442.835,531 427.246,558 442.835,585 458.423,612 "
+ id="polygon163"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="583.2,342 614.376,342 629.965,315 645.553,288 629.965,261 614.376,234 583.2,234 552.023,234 536.435,261 520.846,288 536.435,315 552.023,342 "
+ id="polygon165"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="583.2,342 614.376,342 629.965,315 645.553,288 629.965,261 614.376,234 583.2,234 552.023,234 536.435,261 520.846,288 536.435,315 552.023,342 "
+ id="polygon167"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="583.2,234 614.376,234 629.965,207 645.553,180 629.965,153 614.376,126 583.2,126 552.023,126 536.435,153 520.846,180 536.435,207 552.023,234 "
+ id="polygon169"
+ style="fill:#ccffcc;fill-rule:evenodd" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ stroke-miterlimit="2.6131"
+ points="583.2,234 614.376,234 629.965,207 645.553,180 629.965,153 614.376,126 583.2,126 552.023,126 536.435,153 520.846,180 536.435,207 552.023,234 "
+ id="polygon171"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" />
+ <polygon
+ clip-path="url(#SVGID_2_)"
+ clip-rule="evenodd"
+ points="583.2,126 614.376,126 629....
[truncated message content] |
|
From: <ev...@us...> - 2011-06-09 22:05:34
|
Revision: 1572
http://rails.svn.sourceforge.net/rails/?rev=1572&view=rev
Author: evos
Date: 2011-06-09 22:05:28 +0000 (Thu, 09 Jun 2011)
Log Message:
-----------
Implemented train rusting on buying another than the first train of a type (for 18TN).
Modified Paths:
--------------
trunk/18xx/data/18TN/Game.xml
trunk/18xx/rails/game/TrainManager.java
trunk/18xx/rails/game/TrainType.java
trunk/18xx/rails/game/TrainTypeI.java
Modified: trunk/18xx/data/18TN/Game.xml
===================================================================
--- trunk/18xx/data/18TN/Game.xml 2011-06-09 22:04:33 UTC (rev 1571)
+++ trunk/18xx/data/18TN/Game.xml 2011-06-09 22:05:28 UTC (rev 1572)
@@ -72,7 +72,9 @@
rustedTrain="2" />
<Train name="5" majorStops="5" cost="450" quantity="2" startPhase="5"/>
<Train name="6" majorStops="6" cost="630" quantity="2" startPhase="6"
- rustedTrain="3" />
+ rustedTrain="3">
+ <Sub index="2" rustedTrain="4"/>
+ </Train>
<Train name="8" majorStops="8" cost="700" quantity="7" startPhase="8"
rustedTrain="4" />
</Component>
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-06-09 22:04:33 UTC (rev 1571)
+++ trunk/18xx/rails/game/TrainManager.java 2011-06-09 22:05:28 UTC (rev 1572)
@@ -91,6 +91,8 @@
}
// Finish initialisation of the train types
+ Map<Integer, String> rustedTrainTypeNames;
+ TrainTypeI rustedType;
for (TrainTypeI type : lTrainTypes) {
if (type.getReleasedTrainTypeNames() != null) {
List<TrainTypeI> rtts = new ArrayList<TrainTypeI>(2);
@@ -99,9 +101,13 @@
}
type.setReleasedTrainTypes(rtts);
}
- if (type.getRustedTrainTypeName() != null) {
- type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName()));
- mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false);
+ rustedTrainTypeNames = type.getRustedTrainTypeNames();
+ if (rustedTrainTypeNames != null) {
+ for (int index : rustedTrainTypeNames.keySet()) {
+ rustedType = mTrainTypes.get(rustedTrainTypeNames.get(index));
+ type.setRustedTrainType(index, rustedType);
+ rustedType.setPermanent(false);
+ }
}
}
@@ -176,7 +182,9 @@
}
}
}
- if (boughtType.getNumberBoughtFromIPO() == 1) {
+
+ int trainIndex = boughtType.getNumberBoughtFromIPO();
+ if (trainIndex == 1) {
// First train of a new type bought
ReportBuffer.add(LocalText.getText("FirstTrainBought",
boughtType.getName()));
@@ -187,21 +195,6 @@
phaseHasChanged = true;
}
- TrainTypeI rustedType = boughtType.getRustedTrainType();
- if (rustedType != null && !rustedType.hasRusted()) {
- rustedType.setRusted(train.getHolder()); // Or obsolete,
- // where applicable
- if (rustedType.isObsoleting()) {
- ReportBuffer.add(LocalText.getText("TrainsObsolete",
- rustedType.getName()));
- } else {
- ReportBuffer.add(LocalText.getText("TrainsRusted",
- rustedType.getName()));
- }
- trainsHaveRusted = true;
- trainAvailabilityChanged = true;
- }
-
List<TrainTypeI> releasedTypes = boughtType.getReleasedTrainTypes();
if (releasedTypes != null) {
for (TrainTypeI releasedType : releasedTypes) {
@@ -214,8 +207,24 @@
trainAvailabilityChanged = true;
}
}
- }
+ TrainTypeI rustedType = boughtType.getRustedTrainType(trainIndex);
+ if (rustedType != null && !rustedType.hasRusted()) {
+ rustedType.setRusted(train.getHolder()); // Or obsolete,
+ // where applicable
+ if (rustedType.isObsoleting()) {
+ ReportBuffer.add(LocalText.getText("TrainsObsolete",
+ rustedType.getName()));
+ } else {
+ ReportBuffer.add(LocalText.getText("TrainsRusted",
+ rustedType.getName()));
+ }
+ trainsHaveRusted = true;
+ trainAvailabilityChanged = true;
+ }
+
+}
+
public List<TrainI> getAvailableNewTrains() {
List<TrainI> availableTrains = new ArrayList<TrainI>();
Modified: trunk/18xx/rails/game/TrainType.java
===================================================================
--- trunk/18xx/rails/game/TrainType.java 2011-06-09 22:04:33 UTC (rev 1571)
+++ trunk/18xx/rails/game/TrainType.java 2011-06-09 22:05:28 UTC (rev 1572)
@@ -1,8 +1,7 @@
/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/TrainType.java,v 1.32 2010/05/11 21:47:21 stefanfrey Exp $ */
package rails.game;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
import org.apache.log4j.Logger;
@@ -11,8 +10,7 @@
import rails.game.state.IntegerState;
import rails.util.*;
-public class TrainType
-implements TrainTypeI {
+public class TrainType implements TrainTypeI {
public final static int TOWN_COUNT_MAJOR = 2;
public final static int TOWN_COUNT_MINOR = 1;
@@ -58,8 +56,8 @@
protected String startedPhaseName = null;
// Phase startedPhase;
- private String rustedTrainTypeName = null;
- protected TrainTypeI rustedTrainType = null;
+ private Map<Integer, String> rustedTrainTypeNames = null;
+ protected Map<Integer, TrainTypeI> rustedTrainType = null;
private String releasedTrainTypeNames = null;
protected List<TrainTypeI> releasedTrainTypes = null;
@@ -141,7 +139,11 @@
startedPhaseName = tag.getAttributeAsString("startPhase", "");
// Train type rusted
- rustedTrainTypeName = tag.getAttributeAsString("rustedTrain");
+ String rustedTrainTypeName1 = tag.getAttributeAsString("rustedTrain");
+ if (Util.hasValue(rustedTrainTypeName1)) {
+ rustedTrainTypeNames = new HashMap<Integer, String>();
+ rustedTrainTypeNames.put(1, rustedTrainTypeName1);
+ }
// Other train type released for buying
releasedTrainTypeNames = tag.getAttributeAsString("releasedTrain");
@@ -153,6 +155,19 @@
initialPortfolio =
tag.getAttributeAsString("initialPortfolio",
initialPortfolio);
+
+ // Configure any actions on other than the first train of a type
+ List<Tag> subs = tag.getChildren("Sub");
+ if (subs != null) {
+ for (Tag sub : tag.getChildren("Sub")) {
+ int index = sub.getAttributeAsInteger("index");
+ rustedTrainTypeName1 = sub.getAttributeAsString("rustedTrain");
+ if (rustedTrainTypeNames == null) {
+ rustedTrainTypeNames = new HashMap<Integer, String>();
+ }
+ rustedTrainTypeNames.put(index, rustedTrainTypeName1);
+ }
+ }
} else {
name = "";
quantity = 0;
@@ -343,8 +358,9 @@
/**
* @return Returns the rustedTrainType.
*/
- public TrainTypeI getRustedTrainType() {
- return rustedTrainType;
+ public TrainTypeI getRustedTrainType(int index) {
+ if (rustedTrainType == null) return null;
+ return rustedTrainType.get(index);
}
/**
@@ -378,8 +394,8 @@
/**
* @return Returns the rustedTrainTypeName.
*/
- public String getRustedTrainTypeName() {
- return rustedTrainTypeName;
+ public Map<Integer,String> getRustedTrainTypeNames() {
+ return rustedTrainTypeNames;
}
public boolean isObsoleting() {
@@ -396,8 +412,11 @@
/**
* @param rustedTrainType The rustedTrainType to set.
*/
- public void setRustedTrainType(TrainTypeI rustedTrainType) {
- this.rustedTrainType = rustedTrainType;
+ public void setRustedTrainType(int index, TrainTypeI rustedTrainType) {
+ if (this.rustedTrainType == null) {
+ this.rustedTrainType = new HashMap<Integer, TrainTypeI>();
+ }
+ this.rustedTrainType.put(index, rustedTrainType);
}
public boolean isPermanent() {
@@ -485,8 +504,9 @@
if (Util.hasValue(startedPhaseName)) {
appendInfoText(b, LocalText.getText("StartsPhase", startedPhaseName));
}
- if (rustedTrainTypeName != null) {
- appendInfoText(b, LocalText.getText("RustsTrains", rustedTrainTypeName));
+ if (rustedTrainTypeNames != null) {
+ appendInfoText(b, LocalText.getText("RustsTrains", rustedTrainTypeNames.get(1)));
+ // Ignore any 'Sub' cases for now
}
if (releasedTrainTypeNames != null) {
appendInfoText(b, LocalText.getText("ReleasesTrains", releasedTrainTypeNames));
Modified: trunk/18xx/rails/game/TrainTypeI.java
===================================================================
--- trunk/18xx/rails/game/TrainTypeI.java 2011-06-09 22:04:33 UTC (rev 1571)
+++ trunk/18xx/rails/game/TrainTypeI.java 2011-06-09 22:05:28 UTC (rev 1572)
@@ -2,6 +2,7 @@
package rails.game;
import java.util.List;
+import java.util.Map;
public interface TrainTypeI
extends ConfigurableComponentI, Cloneable {
@@ -58,7 +59,7 @@
/**
* @return Returns the rustedTrainType.
*/
- public TrainTypeI getRustedTrainType();
+ public TrainTypeI getRustedTrainType(int index);
/**
* @return Returns the startedPhaseName.
@@ -95,7 +96,7 @@
public String getReleasedTrainTypeNames();
- public String getRustedTrainTypeName();
+ public Map<Integer,String> getRustedTrainTypeNames();
public boolean isPermanent();
@@ -103,7 +104,7 @@
public void setReleasedTrainTypes(List<TrainTypeI> releasedTrainTypes);
- public void setRustedTrainType(TrainTypeI rustedTrainType);
+ public void setRustedTrainType(int index, TrainTypeI rustedTrainType);
public TrainI cloneTrain();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ste...@us...> - 2011-06-11 06:05:27
|
Revision: 1575
http://rails.svn.sourceforge.net/rails/?rev=1575&view=rev
Author: stefanfrey
Date: 2011-06-11 06:05:21 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Added map.image.display to configuration menu.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/Properties.xml
trunk/18xx/data/profiles/default.profile
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-10 13:40:11 UTC (rev 1574)
+++ trunk/18xx/LocalisedText.properties 2011-06-11 06:05:21 UTC (rev 1575)
@@ -172,6 +172,7 @@
Config.label.local.player.name=Local player (for pbem)
Config.label.locale=Language setting
Config.label.map.autoscroll=Map autoscroll
+Config.label.map.image.display=Display background map
Config.label.map.zoomstep=Map zoomstep
Config.label.money_format=Money format
Config.label.or.number_format=OR number format
Modified: trunk/18xx/data/Properties.xml
===================================================================
--- trunk/18xx/data/Properties.xml 2011-06-10 13:40:11 UTC (rev 1574)
+++ trunk/18xx/data/Properties.xml 2011-06-11 06:05:21 UTC (rev 1575)
@@ -30,6 +30,7 @@
<Section name="UI">
<Property name="map.autoscroll" type="BOOLEAN" />
<Property name="map.zoomstep" type="INTEGER" />
+ <Property name="map.image.display" type="BOOLEAN" />
<Property name="report.window.type" type="LIST" values="static,dynamic" />
<Property name="report.window.open" type="BOOLEAN" />
<Property name="report.window.editable" type="BOOLEAN" />
Modified: trunk/18xx/data/profiles/default.profile
===================================================================
--- trunk/18xx/data/profiles/default.profile 2011-06-10 13:40:11 UTC (rev 1574)
+++ trunk/18xx/data/profiles/default.profile 2011-06-11 06:05:21 UTC (rev 1575)
@@ -24,6 +24,7 @@
### Panel Map
map.autoscroll=yes
+map.image.display=no
map.zoomstep=10
### Panel Format
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wak...@us...> - 2011-06-13 19:10:52
|
Revision: 1576
http://rails.svn.sourceforge.net/rails/?rev=1576&view=rev
Author: wakko666
Date: 2011-06-13 19:10:45 +0000 (Mon, 13 Jun 2011)
Log Message:
-----------
Apply TileOrientation Enumeration patch
from "Adam Badura" <ab...@o2...>
Modified Paths:
--------------
trunk/18xx/data/1825/Map.xml
trunk/18xx/data/1830/Map.xml
trunk/18xx/data/1835/Map.xml
trunk/18xx/data/1851/Map.xml
trunk/18xx/data/1856/Map.xml
trunk/18xx/data/1870/Map.xml
trunk/18xx/data/1880/Map.xml
trunk/18xx/data/1889/Map.xml
trunk/18xx/data/18AL/Map.xml
trunk/18xx/data/18EU/Map.xml
trunk/18xx/data/18GA/Map.xml
trunk/18xx/data/18JR/Map.xml
trunk/18xx/data/18Kaas/Map.xml
trunk/18xx/data/18Scan/Map.xml
trunk/18xx/data/18TN/Map.xml
trunk/18xx/data/18VA/Map.xml
trunk/18xx/rails/game/MapHex.java
trunk/18xx/rails/game/MapManager.java
trunk/18xx/rails/ui/swing/hexmap/EWHexMap.java
trunk/18xx/rails/ui/swing/hexmap/GUIHex.java
trunk/18xx/rails/ui/swing/hexmap/GUITile.java
trunk/18xx/rails/ui/swing/hexmap/NSHexMap.java
Added Paths:
-----------
trunk/18xx/rails/game/TileOrientation.java
Modified: trunk/18xx/data/1825/Map.xml
===================================================================
--- trunk/18xx/data/1825/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1825/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="R">
+<Map tileOrientation="EW" letterOrientation="vertical" even="R">
<IfOption name="Include" parm="Unit3" value="yes">
<Hex name="B8" tile="-5" orientation="1" city="Inverness"/>
<Hex name="B12" tile="-25011" city="Aberdeen"/>
Modified: trunk/18xx/data/1830/Map.xml
===================================================================
--- trunk/18xx/data/1830/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1830/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW"
+<Map tileOrientation="EW"
letterOrientation="vertical" even="B">
<Hex name="A9" tile="-901" orientation="0" value="30,50" city="Canadian West"/>
<Hex name="A11" tile="-902" orientation="1" value="30,50" city="Canadian West"/>
Modified: trunk/18xx/data/1835/Map.xml
===================================================================
--- trunk/18xx/data/1835/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1835/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="B">
+<Map tileOrientation="EW" letterOrientation="vertical" even="B">
<Hex name="A9" tile="-7"/>
<Hex name="A11" tile="-10" city="Kiel"/>
<Hex name="A17" tile="-800" orientation="5"/>
Modified: trunk/18xx/data/1851/Map.xml
===================================================================
--- trunk/18xx/data/1851/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1851/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="B">
+<Map tileOrientation="EW" letterOrientation="vertical" even="B">
<Hex name="@18" tile="-902" orientation="1" value="40,50,60" city="Cincinnati"/>
<Hex name="A3" tile="-901" orientation="5" value="40,50,70" city="St. Louis"/>
<Hex name="A5" tile="-10" orientation="1" city="East St. Louis"/>
Modified: trunk/18xx/data/1856/Map.xml
===================================================================
--- trunk/18xx/data/1856/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1856/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="horizontal" even="A">
+<Map tileOrientation="NS" letterOrientation="horizontal" even="A">
<Hex name="A20" tile="-902" value="30,50,60" city="Detroit/Windsor"/>
<Hex name="B13" tile="-902" orientation="1" value="30,50,50" city="Sarnia"/>
<Hex name="B15" tile="0"/>
Modified: trunk/18xx/data/1870/Map.xml
===================================================================
--- trunk/18xx/data/1870/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1870/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="A">
+<Map tileOrientation="EW" letterOrientation="vertical" even="A">
<Hex name="A2" tile="-902" value="30,40,50" city="Denver"/>
<Hex name="A4" tile="0"/>
<Hex name="A6" tile="0"/>
Modified: trunk/18xx/data/1880/Map.xml
===================================================================
--- trunk/18xx/data/1880/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1880/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="B">
+<Map tileOrientation="EW" letterOrientation="vertical" even="B">
<Hex name="A3" tile="-902" value="20,30,40,50" city="Russia" />
<Hex name="A5" tile="-10" city="Qiqihar"/>
<Hex name="A7" tile="-1" />
Modified: trunk/18xx/data/1889/Map.xml
===================================================================
--- trunk/18xx/data/1889/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/1889/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="horizontal" even="A">
+<Map tileOrientation="NS" letterOrientation="horizontal" even="A">
<Hex name="A8" tile="0" cost="80"/>
<Hex name="A10" tile="-10" city="Sukomo"/>
Modified: trunk/18xx/data/18AL/Map.xml
===================================================================
--- trunk/18xx/data/18AL/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18AL/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A">
+<Map tileOrientation="NS" letterOrientation="vertical" even="A">
<Hex name="A2" tile="0"/>
<Hex name="A4" tile="-912" orientation="2" value="40,50" city="Nashville"/>
<Hex name="B1" tile="-901" value="40,30" city="Corinth"/>
Modified: trunk/18xx/data/18EU/Map.xml
===================================================================
--- trunk/18xx/data/18EU/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18EU/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A">
+<Map tileOrientation="NS" letterOrientation="vertical" even="A">
<Image file="18EU/MapImage.svg" x="18" y="15" scale="0.952"/>
<!-- Hex name="" tile="" orientation="" value="" impassable="" label="" cost="" value="" port="yes/no" -->
<Hex name="A4" port="yes" value="10" tile="-800" orientation="0"/>
Modified: trunk/18xx/data/18GA/Map.xml
===================================================================
--- trunk/18xx/data/18GA/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18GA/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,5 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW"
- letterOrientation="vertical" even="B">
+<Map tileOrientation="EW" letterOrientation="vertical" even="B">
<Hex name="A3" tile="-902" orientation="1" value="30,60" city="Chattanooga"/>
<Hex name="B2" tile="0" cost="60">
Modified: trunk/18xx/data/18JR/Map.xml
===================================================================
--- trunk/18xx/data/18JR/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18JR/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="B">
+<Map tileOrientation="NS" letterOrientation="vertical" even="B">
<Hex name="A5" tile="-7" orientation="1"/>
<Hex name="A7" tile="-7" orientation="2"/>
Modified: trunk/18xx/data/18Kaas/Map.xml
===================================================================
--- trunk/18xx/data/18Kaas/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18Kaas/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="A">
+<Map tileOrientation="EW" letterOrientation="vertical" even="A">
<!-- To be added: orientation, impassable hex sides, etc.-->
<Hex name="A16" tile="0"/>
<Hex name="A18" tile="-3" value="10" orientation="0"/>
Modified: trunk/18xx/data/18Scan/Map.xml
===================================================================
--- trunk/18xx/data/18Scan/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18Scan/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="A">
+<Map tileOrientation="EW" letterOrientation="vertical" even="A">
<!-- Hex name="" tile="" orientation="" value="" impassable="" label="" cost="" value="" port="yes/no" -->
<Hex name="A4" tile="-911" city="Newcastle" value="20,50,80"/>
<Hex name="A6" tile="0" cost="60"/>
Modified: trunk/18xx/data/18TN/Map.xml
===================================================================
--- trunk/18xx/data/18TN/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18TN/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,5 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW"
- letterOrientation="vertical" even="A">
+<Map tileOrientation="EW" letterOrientation="vertical" even="A">
<Hex name="A16" tile="-902" city="Cincinnati" orientation="1" value="50,80"/>
<Hex name="B13" tile="-10001" city="Louisville"/>
Modified: trunk/18xx/data/18VA/Map.xml
===================================================================
--- trunk/18xx/data/18VA/Map.xml 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/data/18VA/Map.xml 2011-06-13 19:10:45 UTC (rev 1576)
@@ -1,4 +1,4 @@
-<Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A">
+<Map tileOrientation="NS" letterOrientation="vertical" even="A">
<Hex name="A6" tile="0"/>
<Hex name="A8" tile="-1921" orientation="1" value="40,70" city="Philadelphia"/>
<Hex name="B5" tile="-10" city="Hagerstown"/>
Modified: trunk/18xx/rails/game/MapHex.java
===================================================================
--- trunk/18xx/rails/game/MapHex.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/game/MapHex.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -19,14 +19,14 @@
/**
* Represents a Hex on the Map from the Model side.
*
- * <p> <b>Tile orientations</b>. Tiles can be oriented NS or EW; the directions
- * refer to the "flat" hex sides. <p> The term "rotation" is used to indicate
- * the amount of rotation (in 60 degree units) from the standard orientation of
- * the tile (sometimes the term orientation is also used to refer to rotation).
+ * <p> The term "rotation" is used to indicate the amount of rotation (in 60
+ * degree units) from the standard orientation of the tile (sometimes the term
+ * orientation is also used to refer to rotation).
* <p>Rotation is always relative to the standard orientation, which has the
- * printed tile number on the S edge for NS oriented tiles, or on the SW edge
- * for EW oriented tiles. The rotation numbers are indicated in the below
- * picture for an NS-oriented tile: <p> <code>
+ * printed tile number on the S edge for {@link TileOrientation#NS}-oriented
+ * tiles, or on the SW edge for {@link TileOrientation#EW}-oriented tiles. The
+ * rotation numbers are indicated in the below picture for an
+ * {@code NS}-oriented tile: <p> <code>
*
* ____3____
* / \
@@ -35,15 +35,12 @@
* \ /
* 1 5
* \____0____/
- * </code> <p> For EW-oriented
+ * </code> <p> For {@code EW}-oriented
* tiles the above picture should be rotated 30 degrees clockwise.
*/
public class MapHex extends ModelObject implements ConfigurableComponentI,
StationHolder, TokenHolder {
- public static final int EW = 0;
- public static final int NS = 1;
-
private static final String[] ewOrNames =
{ "SW", "W", "NW", "NE", "E", "SE" };
private static final String[] nsOrNames =
@@ -186,7 +183,7 @@
if (lettersGoHorizontal()) {
row = number;
column = letter - '@';
- if (getTileOrientation() == MapHex.EW) {
+ if (getTileOrientation() == TileOrientation.EW) {
// Tiles with flat EW sides, letters go horizontally.
// Example: 1841 (NOT TESTED, PROBABLY WRONG).
x = column;
@@ -202,7 +199,7 @@
{
row = letter - '@';
column = number;
- if (getTileOrientation() == MapHex.EW) {
+ if (getTileOrientation() == TileOrientation.EW) {
// Tiles with flat EW sides, letters go vertically.
// Most common case.
// Tested for 1830 and 1870. OK with 1830 Wabash and 1825R2 (negative column numbers)
@@ -276,6 +273,9 @@
}
public void finishConfiguration (GameManagerI gameManager) {
+ if(gameManager == null) {
+ throw new IllegalArgumentException("gameManager must not be null");
+ }
currentTile = gameManager.getTileManager().getTile(preprintedTileId);
// We need completely new objects, not just references to the Tile's
@@ -335,7 +335,7 @@
return openHexSides != null && openHexSides[side%6];
}
- public int getTileOrientation() {
+ public TileOrientation getTileOrientation() {
return mapManager.getTileOrientation();
}
@@ -355,7 +355,7 @@
public String getOrientationName(int orientation) {
- if (getTileOrientation() == EW) {
+ if (getTileOrientation() == TileOrientation.EW) {
return ewOrNames[orientation % 6];
} else {
return nsOrNames[orientation % 6];
Modified: trunk/18xx/rails/game/MapManager.java
===================================================================
--- trunk/18xx/rails/game/MapManager.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/game/MapManager.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -18,7 +18,7 @@
// The next attributes are duplicates in MapHex. We'll see what we really
// need.
- protected int tileOrientation;
+ protected TileOrientation tileOrientation;
protected boolean lettersGoHorizontal;
protected boolean letterAHasEvenNumbers;
@@ -60,23 +60,28 @@
* @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)
*/
public void configureFromXML(Tag tag) throws ConfigurationException {
- mapUIClassName = tag.getAttributeAsString("mapClass");
- if (mapUIClassName == null) {
- throw new ConfigurationException("Map class name missing");
- }
-
String attr = tag.getAttributeAsString("tileOrientation");
if (attr == null)
throw new ConfigurationException("Map orientation undefined");
- if (attr.equals("EW")) {
- tileOrientation = MapHex.EW;
- } else if (attr.equals("NS")) {
- tileOrientation = MapHex.NS;
- } else {
- throw new ConfigurationException("Invalid tile orientation: "
- + attr);
+ try {
+ tileOrientation = TileOrientation.valueOf(attr);
}
+ catch(IllegalArgumentException exception) {
+ throw new ConfigurationException("Invalid tile orientation: " + attr, exception);
+ }
+ switch(tileOrientation) {
+ case NS:
+ mapUIClassName = "rails.ui.swing.hexmap.NSHexMap";
+ break;
+ case EW:
+ mapUIClassName = "rails.ui.swing.hexmap.EWHexMap";
+ break;
+ default:
+ // Unexpected default.
+ throw new AssertionError(tileOrientation);
+ }
+
attr = tag.getAttributeAsString("letterOrientation");
if (attr.equals("horizontal")) {
lettersGoHorizontal = true;
@@ -101,8 +106,8 @@
List<Tag> hexTags = tag.getChildren("Hex");
MapHex hex;
- minX = minY = minCol = minRow = 9999;
- maxX = maxY = maxCol = maxRow = -9999;
+ minX = minY = minCol = minRow = Integer.MAX_VALUE;
+ maxX = maxY = maxCol = maxRow = Integer.MIN_VALUE;
possibleTileCosts = new TreeSet<Integer>();
for (Tag hexTag : hexTags) {
hex = new MapHex(this);
@@ -223,7 +228,7 @@
public int getAdjacentX (int x, int y, int orientation) {
- if (tileOrientation == MapHex.EW) {
+ if (tileOrientation == TileOrientation.EW) {
return x + (y % 2 == 0 ? xYEvenDeltaEW[orientation] : xYOddDeltaEW[orientation]);
} else {
return x + xDeltaNS[orientation];
@@ -232,7 +237,7 @@
public int getAdjacentY (int x, int y, int orientation) {
- if (tileOrientation == MapHex.EW) {
+ if (tileOrientation == TileOrientation.EW) {
return y + yDeltaEW[orientation];
} else {
return y + ((x % 2 == 0) == letterAHasEvenNumbers ?
@@ -243,7 +248,7 @@
/**
* @return Returns the currentTileOrientation.
*/
- public int getTileOrientation() {
+ public TileOrientation getTileOrientation() {
return tileOrientation;
}
Added: trunk/18xx/rails/game/TileOrientation.java
===================================================================
--- trunk/18xx/rails/game/TileOrientation.java (rev 0)
+++ trunk/18xx/rails/game/TileOrientation.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -0,0 +1,57 @@
+package rails.game;
+
+/**
+ * Tile orientation enumeration.
+ *
+ * Tile orientation refers to "flat edges" parallel with coordinates system
+ * axis. Thus there are two orientations: North-South
+ * ({@link TileOrientation#NS NS}) and East-West
+ * ({@link TileOrientation#EW EW}).
+ *
+ * Although it seems neither is dominating in 18xx games North-South is used by
+ * default for management and classification. So North-South orientation is
+ * treated here as the natural one.
+ *
+ * @author Adam Badura
+ * @since 1.4.3
+ */
+public enum TileOrientation {
+ /**
+ * North-South tile orientation.
+ *
+ * <p>This is default orientation for internal uses (which includes SVG
+ * images).</p>
+ */
+ NS,
+
+ /**
+ * East-West tile orientation.
+ */
+ EW;
+
+
+ /**
+ * Returns rotation to be applied to {@link TileOrientation#NS}-oriented
+ * tile to achieve this orientation.
+ *
+ * <p>The rotation has to be done around center point of the tile.</p>
+ *
+ * <p>This function returns {@literal 0} for {@link TileOrientation#NS}
+ * since {@code NS}-oriented tile does not need any rotation to be
+ * transformed into {@code NS}-oriented tile.</p>
+ *
+ * @return Rotation to be applied to {@link TileOrientation#NS}-oriented
+ * tile to achieve this orientation.
+ */
+ public int getBaseRotation() {
+ switch(this) {
+ case NS:
+ return 0;
+ case EW:
+ return 30;
+ default:
+ // Unexpected default.
+ throw new AssertionError(this);
+ }
+ }
+}
Property changes on: trunk/18xx/rails/game/TileOrientation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/18xx/rails/ui/swing/hexmap/EWHexMap.java
===================================================================
--- trunk/18xx/rails/ui/swing/hexmap/EWHexMap.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/ui/swing/hexmap/EWHexMap.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -4,7 +4,8 @@
import java.awt.*;
/**
- * Class EWHexMap displays a basic hex map with EW exit orientation.
+ * Class EWHexMap displays a basic hex map with
+ * {@link rails.game.TileOrientation#EW EW} exit orientation.
*/
public class EWHexMap extends HexMap {
Modified: trunk/18xx/rails/ui/swing/hexmap/GUIHex.java
===================================================================
--- trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/ui/swing/hexmap/GUIHex.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -108,7 +108,7 @@
this.zoomFactor = zoomFactor;
tokenDiameter = (int)Math.round(NORMAL_TOKEN_SIZE * zoomFactor);
- if (hexMap.getMapManager().getTileOrientation() == MapHex.EW) {
+ if (hexMap.getMapManager().getTileOrientation() == TileOrientation.EW) {
/* The numbering is unusual:
* 0
* / \
@@ -242,7 +242,7 @@
// NOTE: orientation here is its normal value in Rails + 3 (mod 6).
orientation %= 6;
if (barStartPoints == null) barStartPoints = new ArrayList<Integer>(2);
- if (hexMap.getMapManager().getTileOrientation() == MapHex.EW) {
+ if (hexMap.getMapManager().getTileOrientation() == TileOrientation.EW) {
barStartPoints.add((5-orientation)%6);
} else {
barStartPoints.add((3+orientation)%6);
Modified: trunk/18xx/rails/ui/swing/hexmap/GUITile.java
===================================================================
--- trunk/18xx/rails/ui/swing/hexmap/GUITile.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/ui/swing/hexmap/GUITile.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -56,7 +56,7 @@
tile = tileManager.getTile(tileId);
picId = tile.getPictureId();
- if (hex.getTileOrientation() == MapHex.EW) {
+ if (hex.getTileOrientation() == TileOrientation.EW) {
baseRotation = 0.5 * DEG60;
} else {
baseRotation = 0.0;
Modified: trunk/18xx/rails/ui/swing/hexmap/NSHexMap.java
===================================================================
--- trunk/18xx/rails/ui/swing/hexmap/NSHexMap.java 2011-06-11 06:05:21 UTC (rev 1575)
+++ trunk/18xx/rails/ui/swing/hexmap/NSHexMap.java 2011-06-13 19:10:45 UTC (rev 1576)
@@ -4,7 +4,8 @@
import java.awt.*;
/**
- * Class NSHexMap displays a basic hex map with NS exit orientation.
+ * Class NSHexMap displays a basic hex map with
+ * {@link rails.game.TileOrientation#NS NS} exit orientation.
*/
public class NSHexMap extends HexMap {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-15 11:12:11
|
Revision: 1577
http://rails.svn.sourceforge.net/rails/?rev=1577&view=rev
Author: evos
Date: 2011-06-15 11:12:05 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
Fixed spurious report line in 1830/56 that D-trains are available after buying the *last* 6-train.
Add report line to mention added president's cash in case of emergency train buying.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/TrainManager.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-13 19:10:45 UTC (rev 1576)
+++ trunk/18xx/LocalisedText.properties 2011-06-15 11:12:05 UTC (rev 1577)
@@ -485,6 +485,7 @@
PoolOverHoldLimit=Pool would get over its share holding limit
PoolWouldGetOverLimit=The Pool would get over its share holding limit of {0}
PresidentMayNotAddMoreThan=The president may not add more than {0}
+PresidentAddsCash={0} president {1} contributes {2} to buy a train
PriceAboveUpperLimit=Price ({0}) is above the maximum buy price ({1}) of {2}
PriceBelowLowerLimit=Price ({0}) is below the minimum buy price ({1}) of {2}
PriceIsPaidTo=The price ({0}) is paid to {1}
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-06-13 19:10:45 UTC (rev 1576)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-06-15 11:12:05 UTC (rev 1577)
@@ -1801,6 +1801,10 @@
if (actualPresidentCash > 0) {
new CashMove(currentPlayer, operatingCompany.get(), presidentCash);
+ ReportBuffer.add(LocalText.getText("PresidentAddsCash",
+ operatingCompany.get().getName(),
+ currentPlayer.getName(),
+ Bank.format(actualPresidentCash)));
}
Portfolio oldHolder = train.getHolder();
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-06-13 19:10:45 UTC (rev 1576)
+++ trunk/18xx/rails/game/TrainManager.java 2011-06-15 11:12:05 UTC (rev 1577)
@@ -174,11 +174,13 @@
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 (!nextType.isAvailable()) {
+ nextType.setAvailable(bank);
+ trainAvailabilityChanged = true;
+ ReportBuffer.add("All " + boughtType.getName()
+ + "-trains are sold out, "
+ + nextType.getName() + "-trains now available");
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-21 21:25:57
|
Revision: 1581
http://rails.svn.sourceforge.net/rails/?rev=1581&view=rev
Author: evos
Date: 2011-06-21 21:25:49 +0000 (Tue, 21 Jun 2011)
Log Message:
-----------
Train management refactoring II - game
Major overhaul of train management.
TrainCertificateType describes buyable trains, single or dual
TrainType describes a singe train type
Train describes separate train certificate objects. It contains a reference to the current TrainType, which is null as long as it is owned by the Bank.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/rails/algorithms/NetworkTrain.java
trunk/18xx/rails/algorithms/RevenueAdapter.java
trunk/18xx/rails/algorithms/RevenueBonus.java
trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/Portfolio.java
trunk/18xx/rails/game/PublicCompany.java
trunk/18xx/rails/game/Train.java
trunk/18xx/rails/game/TrainI.java
trunk/18xx/rails/game/TrainManager.java
trunk/18xx/rails/game/TrainType.java
trunk/18xx/rails/game/action/BuyTrain.java
trunk/18xx/rails/game/model/TrainsModel.java
trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java
trunk/18xx/rails/game/specific/_1856/PublicCompany_1856.java
trunk/18xx/rails/game/specific/_1856/PublicCompany_CGR.java
trunk/18xx/rails/game/specific/_18AL/NameableTrain.java
trunk/18xx/rails/game/specific/_18EU/OperatingRound_18EU.java
trunk/18xx/rails/game/state/GenericState.java
trunk/18xx/rails/ui/swing/ORPanel.java
trunk/18xx/rails/ui/swing/ORUIManager.java
Added Paths:
-----------
trunk/18xx/rails/game/TrainCertificateType.java
Removed Paths:
-------------
trunk/18xx/rails/game/TrainTypeI.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/LocalisedText.properties 2011-06-21 21:25:49 UTC (rev 1581)
@@ -322,13 +322,10 @@
InvalidAction=Invalid action in this game
InvalidAllocationTypeIndex=Invalid allocation type index: {0}
InvalidBid=Invalid bid by {0} on {1}: {2}
-InvalidCost=Invalid or zero cost specified
InvalidDoneAction=Invalid Done action
InvalidParPriceSetting=Invalid par price {0} set by {1} for {2}: {3}
InvalidPass=Invalid pass by {0}: {1}
-InvalidQuantity=Invalid quantity specified: {0}
InvalidStartPrice=Invalid start price {0} for {1}
-InvalidStops=Invalid or zero major stops specified
InvalidTileColourName=Invalid colour name {1} for tile {0}
InvalidTileLay=Invalid tile lay
InvalidTrackEnd=Invalid track end
@@ -401,7 +398,6 @@
NoIncomeForPreviousOperation={0} gets no income for {1}% {2} shares as precursors have operated
NoMapMode=No map mode (for ftf play)
NoMoney=Not enough money
-NoNameSpecified=No name specified
None=None
NoPriceToSet=No price to be set
# Texts with lowercase keys are intended to be inserted into other messages
Modified: trunk/18xx/rails/algorithms/NetworkTrain.java
===================================================================
--- trunk/18xx/rails/algorithms/NetworkTrain.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/algorithms/NetworkTrain.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -3,7 +3,7 @@
import org.apache.log4j.Logger;
import rails.game.TrainI;
-import rails.game.TrainTypeI;
+import rails.game.TrainType;
public final class NetworkTrain {
@@ -118,7 +118,7 @@
return railsTrain;
}
- public TrainTypeI getRailsTrainType() {
+ public TrainType getRailsTrainType() {
if (railsTrain == null) return null;
return railsTrain.getType();
Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -22,7 +22,7 @@
import rails.game.PhaseI;
import rails.game.PublicCompanyI;
import rails.game.TrainI;
-import rails.game.TrainTypeI;
+import rails.game.TrainType;
import rails.ui.swing.hexmap.HexMap;
import rails.util.LocalText;
@@ -172,10 +172,10 @@
}
public boolean addTrainByString(String trainString) {
- TrainTypeI trainType = gameManager.getTrainManager().getTypeByName(trainString.trim());
+ TrainType trainType = gameManager.getTrainManager().getTypeByName(trainString.trim());
if (trainType != null) { // string defines available trainType
log.info("RA: found trainType" + trainType);
- TrainI railsTrain = gameManager.getTrainManager().cloneTrain(trainType);
+ TrainI railsTrain = gameManager.getTrainManager().cloneTrain(trainType.getCertificateType());
return addTrain(railsTrain);
} else { // otherwise interpret the train
NetworkTrain train = NetworkTrain.createFromString(trainString);
Modified: trunk/18xx/rails/algorithms/RevenueBonus.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueBonus.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/algorithms/RevenueBonus.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -10,7 +10,7 @@
import rails.game.PhaseI;
import rails.game.TrainI;
-import rails.game.TrainTypeI;
+import rails.game.TrainType;
public final class RevenueBonus {
@@ -25,7 +25,7 @@
// internal attributes
private List<NetworkVertex> vertices;
- private List<TrainTypeI> trainTypes;
+ private List<TrainType> trainTypes;
private List<TrainI> trains;
private List<PhaseI> phases;
@@ -34,7 +34,7 @@
this.name = name;
vertices = new ArrayList<NetworkVertex>();
- trainTypes = new ArrayList<TrainTypeI>();
+ trainTypes = new ArrayList<TrainType>();
trains = new ArrayList<TrainI>();
phases = new ArrayList<PhaseI>();
}
@@ -47,7 +47,7 @@
this.vertices.addAll(vertices);
}
- public void addTrainType(TrainTypeI trainType) {
+ public void addTrainType(TrainType trainType) {
trainTypes.add(trainType);
}
@@ -71,7 +71,7 @@
return vertices;
}
- public List<TrainTypeI> getTrainTypes() {
+ public List<TrainType> getTrainTypes() {
return trainTypes;
}
Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -12,7 +12,7 @@
import rails.game.PhaseI;
import rails.game.PhaseManager;
import rails.game.TrainManager;
-import rails.game.TrainTypeI;
+import rails.game.TrainType;
import rails.util.Tag;
/**
@@ -117,7 +117,7 @@
private void convertTrainTypes(RevenueBonus bonus, TrainManager tm) {
for (String identTrainType:identTrainTypes) {
- TrainTypeI trainType = tm.getTypeByName(identTrainType);
+ TrainType trainType = tm.getTypeByName(identTrainType);
if (trainType != null) {
bonus.addTrainType(trainType);
}
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -58,8 +58,8 @@
/** A List per player with owned companies that have excess trains */
protected Map<Player, List<PublicCompanyI>> excessTrainCompanies = null;
- protected List<TrainTypeI> trainsBoughtThisTurn =
- new ArrayList<TrainTypeI>(4);
+ protected List<TrainCertificateType> trainsBoughtThisTurn =
+ new ArrayList<TrainCertificateType>(4);
protected Map<PublicCompanyI, Integer> loansThisRound = null;
@@ -1763,7 +1763,7 @@
//exchangedTrain = operatingCompany.getObject().getPortfolio().getTrainList().get(0);
//action.setExchangedTrain(exchangedTrain);
break;
- } else if (operatingCompany.get().getPortfolio().getTrainOfType(exchangedTrain.getType()) == null) {
+ } else if (operatingCompany.get().getPortfolio().getTrainOfType(exchangedTrain.getCertType()) == null) {
errMsg = LocalText.getText("CompanyDoesNotOwnTrain",
operatingCompany.get().getName(),
exchangedTrain.getName());
@@ -1812,7 +1812,7 @@
if (exchangedTrain != null) {
TrainI oldTrain =
operatingCompany.get().getPortfolio().getTrainOfType(
- exchangedTrain.getType());
+ exchangedTrain.getCertType());
oldTrain.moveTo(train.isObsolete() ? scrapHeap : pool);
ReportBuffer.add(LocalText.getText("ExchangesTrain",
companyName,
@@ -1835,18 +1835,20 @@
stb.getOriginalCompany().getName() ));
}
+ train.setType(action.getType()); // Needed for dual trains bought from the Bank
+
operatingCompany.get().buyTrain(train, price);
if (oldHolder == ipo) {
- train.getType().addToBoughtFromIPO();
+ train.getCertType().addToBoughtFromIPO();
trainManager.setAnyTrainBought(true);
// Clone the train if infinitely available
- if (train.getType().hasInfiniteQuantity()) {
- ipo.addTrain(trainManager.cloneTrain(train.getType()));
+ if (train.getCertType().hasInfiniteQuantity()) {
+ ipo.addTrain(trainManager.cloneTrain(train.getCertType()));
}
}
if (oldHolder.getOwner() instanceof Bank) {
- trainsBoughtThisTurn.add(train.getType());
+ trainsBoughtThisTurn.add(train.getCertType());
}
if (stb != null) {
@@ -1957,6 +1959,11 @@
//
if (action.isForced()) moveStack.linkToPreviousMoveSet();
+ // Reset type of dual trains
+ if (train.getCertType().getPotentialTrainTypes().size() > 1) {
+ train.setType(null);
+ }
+
train.moveTo(train.isObsolete() ? scrapHeap : pool);
ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain",
companyName,
@@ -2623,7 +2630,7 @@
int cash = operatingCompany.get().getCash();
- int cost;
+ int cost = 0;
List<TrainI> trains;
boolean hasTrains =
@@ -2650,24 +2657,30 @@
for (TrainI train : trains) {
if (!operatingCompany.get().mayBuyTrainType(train)) continue;
if (!mayBuyMoreOfEachType
- && trainsBoughtThisTurn.contains(train.getType())) {
+ && trainsBoughtThisTurn.contains(train.getCertType())) {
continue;
}
- cost = train.getCost();
- if (cost <= cash) {
- if (canBuyTrainNow) {
- BuyTrain action = new BuyTrain(train, ipo, cost);
- action.setForcedBuyIfNoRoute(presidentMayHelp); // TEMPORARY
- possibleActions.add(action);
+
+ // Allow dual trains (since jun 2011)
+ List<TrainType> types = train.getCertType().getPotentialTrainTypes();
+ for (TrainType type : types) {
+ cost = type.getCost();
+ if (cost <= cash) {
+ if (canBuyTrainNow) {
+ BuyTrain action = new BuyTrain(train, type, ipo, cost);
+ action.setForcedBuyIfNoRoute(presidentMayHelp); // TEMPORARY
+ possibleActions.add(action);
+ }
+ } else if (costOfCheapestTrain == 0
+ || cost < costOfCheapestTrain) {
+ cheapestTrain = train;
+ costOfCheapestTrain = cost;
}
- } else if (costOfCheapestTrain == 0
- || cost < costOfCheapestTrain) {
- cheapestTrain = train;
- costOfCheapestTrain = cost;
}
+
// Even at train limit, exchange is allowed (per 1856)
if (train.canBeExchanged() && hasTrains) {
- cost = train.getType().getExchangeCost();
+ cost = train.getCertType().getExchangeCost();
if (cost <= cash) {
List<TrainI> exchangeableTrains =
operatingCompany.get().getPortfolio().getUniqueTrains();
@@ -2683,8 +2696,8 @@
// Can a special property be used?
// N.B. Assume that this never occurs in combination with
- // a train exchange, otherwise the below code must be duplicated
- // above.
+ // dual trains or train exchanges,
+ // otherwise the below code must be duplicated above.
for (SpecialTrainBuy stb : getSpecialProperties(SpecialTrainBuy.class)) {
int reducedPrice = stb.getPrice(cost);
if (reducedPrice > cash) continue;
@@ -2701,7 +2714,7 @@
trains = pool.getUniqueTrains();
for (TrainI train : trains) {
if (!mayBuyMoreOfEachType
- && trainsBoughtThisTurn.contains(train.getType())) {
+ && trainsBoughtThisTurn.contains(train.getCertType())) {
continue;
}
cost = train.getCost();
@@ -2895,7 +2908,7 @@
if (getGameParameterAsBoolean(GameDef.Parm.REMOVE_TRAIN_BEFORE_SR)
&& trainManager.isAnyTrainBought()) {
TrainI train = trainManager.getAvailableNewTrains().get(0);
- if (train.getType().hasInfiniteQuantity()) return;
+ if (train.getCertType().hasInfiniteQuantity()) return;
new ObjectMove (train, ipo, scrapHeap);
ReportBuffer.add(LocalText.getText("RemoveTrain", train.getName()));
}
Modified: trunk/18xx/rails/game/Portfolio.java
===================================================================
--- trunk/18xx/rails/game/Portfolio.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/game/Portfolio.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -51,8 +51,10 @@
/** Owned trains */
protected List<TrainI> trains = new ArrayList<TrainI>();
- protected Map<TrainTypeI, List<TrainI>> trainsPerType =
- new HashMap<TrainTypeI, List<TrainI>>();
+ protected Map<TrainType, List<TrainI>> trainsPerType =
+ new HashMap<TrainType, List<TrainI>>();
+ protected Map<TrainCertificateType, List<TrainI>> trainsPerCertType =
+ new HashMap<TrainCertificateType, List<TrainI>>();
protected TrainsModel trainsModel = new TrainsModel(this);
/** Owned tokens */
@@ -73,6 +75,8 @@
protected String name;
/** Unique name (including owner class name) */
protected String uniqueName;
+
+ GameManagerI gameManager;
/** Specific portfolio names */
public static final String IPO_NAME = "IPO";
@@ -88,7 +92,8 @@
this.owner = holder;
this.uniqueName = holder.getClass().getSimpleName() + "_" + name;
- GameManager.getInstance().addPortfolio(this);
+ gameManager = GameManager.getInstance();
+ gameManager.addPortfolio(this);
if (owner instanceof PublicCompanyI) {
trainsModel.setOption(TrainsModel.FULL_LIST);
@@ -390,24 +395,33 @@
}
public void addTrain (TrainI train) {
- addTrain (train, new int[] {-1,-1});
+ addTrain (train, new int[] {-1,-1,-1});
}
public void addTrain(TrainI train, int[] position) {
Util.addToList(trains, train, position[0]);
- TrainTypeI type = train.getType();
+
+ TrainType type = train.getType();
if (!trainsPerType.containsKey(type)) {
trainsPerType.put(type, new ArrayList<TrainI>());
}
- Util.addToList(trainsPerType.get(train.getType()), train, position[1]);
+ Util.addToList(trainsPerType.get(type), train, position[1]);
+
+ TrainCertificateType certType = train.getCertType();
+ if (!trainsPerCertType.containsKey(certType)) {
+ trainsPerCertType.put(certType, new ArrayList<TrainI>());
+ }
+ Util.addToList(trainsPerCertType.get(certType), train, position[2]);
+
train.setHolder(this);
trainsModel.update();
}
public void removeTrain(TrainI train) {
trains.remove(train);
- trainsPerType.get(train.getType()).remove(train);
+ trainsPerType.get(train.getPreviousType()).remove(train);
+ trainsPerCertType.get(train.getCertType()).remove(train);
train.setHolder(null);
trainsModel.update();
}
@@ -436,7 +450,7 @@
return trains;
}
- public TrainI[] getTrainsPerType(TrainTypeI type) {
+ public TrainI[] getTrainsPerType(TrainType type) {
List<TrainI> trainsFound = new ArrayList<TrainI>();
for (TrainI train : trains) {
@@ -454,8 +468,8 @@
public List<TrainI> getUniqueTrains() {
List<TrainI> trainsFound = new ArrayList<TrainI>();
- Map<TrainTypeI, Object> trainTypesFound =
- new HashMap<TrainTypeI, Object>();
+ Map<TrainType, Object> trainTypesFound =
+ new HashMap<TrainType, Object>();
for (TrainI train : trains) {
if (!trainTypesFound.containsKey(train.getType())) {
trainsFound.add(train);
@@ -466,9 +480,9 @@
}
- public TrainI getTrainOfType(TrainTypeI type) {
+ public TrainI getTrainOfType(TrainCertificateType type) {
for (TrainI train : trains) {
- if (train.getType() == type) return train;
+ if (train.getCertType() == type) return train;
}
return null;
}
@@ -478,19 +492,19 @@
* IPO.
*/
- public String makeAbbreviatedListOfTrains() {
+ public String makeListOfTrainCertificates() {
if (trains == null || trains.isEmpty()) return "";
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
List<TrainI> trainsOfType;
- for (TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
- trainsOfType = trainsPerType.get(type);
+ for (TrainCertificateType certType : gameManager.getTrainManager().getTrainCertTypes()) {
+ trainsOfType = trainsPerCertType.get(certType);
if (trainsOfType != null && !trainsOfType.isEmpty()) {
if (b.length() > 0) b.append(" ");
- b.append(type.getName()).append("(");
- if (type.hasInfiniteQuantity()) {
+ b.append(certType.getName()).append("(");
+ if (certType.hasInfiniteQuantity()) {
b.append("+");
} else {
b.append(trainsOfType.size());
@@ -506,14 +520,14 @@
* Make a full list of trains, like "2 2 3 3", to show in any field
* describing train possessions, except the IPO.
*/
- public String makeFullListOfTrains() {
+ public String makeListOfTrains() {
if (trains == null || trains.isEmpty()) return "";
List<TrainI> trainsOfType;
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
- for (TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
+ for (TrainType type : gameManager.getTrainManager().getTrainTypes()) {
trainsOfType = trainsPerType.get(type);
if (trainsOfType != null && !trainsOfType.isEmpty()) {
for (TrainI train : trainsOfType) {
@@ -603,7 +617,7 @@
addPrivate((PrivateCompanyI) object, position == null ? -1 : position[0]);
return true;
} else if (object instanceof TrainI) {
- if (position == null) position = new int[] {-1, -1};
+ if (position == null) position = new int[] {-1, -1, -1};
addTrain((TrainI) object, position);
return true;
} else if (object instanceof SpecialPropertyI) {
@@ -654,7 +668,8 @@
TrainI train = (TrainI) object;
return new int[] {
trains.indexOf(train),
- trainsPerType.get(train.getType()).indexOf(train)
+ train.getPreviousType() != null ? trainsPerType.get(train.getPreviousType()).indexOf(train) : -1,
+ trainsPerCertType.get(train.getCertType()).indexOf(train)
};
} else if (object instanceof SpecialPropertyI) {
return new int[] {specialProperties.indexOf(object)};
Modified: trunk/18xx/rails/game/PublicCompany.java
===================================================================
--- trunk/18xx/rails/game/PublicCompany.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/game/PublicCompany.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -973,7 +973,7 @@
if (initialTrainType != null) {
TrainManager trainManager = gameManager.getTrainManager();
- TrainTypeI type = trainManager.getTypeByName(initialTrainType);
+ TrainCertificateType type = trainManager.getCertTypeByName(initialTrainType);
TrainI train = bank.getIpo().getTrainOfType(type);
buyTrain(train, initialTrainCost);
train.setTradeable(initialTrainTradeable);
Modified: trunk/18xx/rails/game/Train.java
===================================================================
--- trunk/18xx/rails/game/Train.java 2011-06-21 21:21:43 UTC (rev 1580)
+++ trunk/18xx/rails/game/Train.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -6,10 +6,16 @@
import rails.game.move.MoveableHolder;
import rails.game.move.ObjectMove;
import rails.game.state.BooleanState;
+import rails.game.state.GenericState;
public class Train implements TrainI {
- protected TrainTypeI type;
+ protected TrainCertificateType certificateType;
+
+ protected GenericState<TrainType> type;
+
+ /** Temporary variable, only used during moves. */
+ protected TrainType previousType = null;
/** Some specific trains cannot be traded between companies */
protected boolean tradeable = true;
@@ -24,14 +30,36 @@
public Train() {}
- public void init(TrainTypeI type, String uniqueId) {
+ public void init(TrainCertificateType certType, TrainType type, String uniqueId) {
- this.type = type;
+ this.certificateType = certType;
this.uniqueId = uniqueId;
+ this.type = new GenericState<TrainType>(certType.getName()+"_CurrentType", type);
+ this.previousType = type;
obsolete = new BooleanState(uniqueId, false);
}
+
+ public void setType (TrainType type) {
+ previousType = this.type.get();
+ this.type.set(type);
+ }
+ /**
+ * @return Returns the type.
+ */
+ public TrainCertificateType getCertType() {
+ return certificateType;
+ }
+
+ public TrainType getType() {
+ return isAssigned() ? type.get() : null;
+ }
+
+ public TrainType getPreviousType() {
+ return previousType;
+ }
+
public String getUniqueId() {
return uniqueId;
}
@@ -40,53 +68,54 @@
* @return Returns the cityScoreFactor.
*/
public int getCityScoreFactor() {
- return type.getCityScoreFactor();
+ return getType().getCityScoreFactor();
}
/**
* @return Returns the cost.
*/
public int getCost() {
- return type.getCost();
+ return getType().getCost();
}
/**
* @return Returns the majorStops.
*/
public int getMajorStops() {
- return type.getMajorStops();
+ return getType().getMajorStops();
}
/**
* @return Returns the minorStops.
*/
public int getMinorStops() {
- return type.getMinorStops();
+ return getType().getMinorStops();
}
/**
* @return Returns the townCountIndicator.
*/
public int getTownCountIndicator() {
- return type.getTownCountIndicator();
+ return getType().getTownCountIndicator();
}
/**
* @return Returns the townScoreFactor.
*/
public int getTownScoreFactor() {
- return type.getTownScoreFactor();
+ return getType().getTownScoreFactor();
}
- /**
- * @return Returns the type.
- */
- public TrainTypeI getType() {
- return type;
+ public boolean isAssigned() {
+ return type.get() != null;
}
-
+
+ public boolean isPermanent() {
+ return certificateType.isPermanent();
+ }
+
public String getName() {
- return type.getName();
+ return isAssigned() ? type.get().getName() : certificateType.getName();
}
public Portfolio getHolder() {
@@ -123,7 +152,7 @@
}
public boolean canBeExchanged() {
- return type.nextCanBeExchanged();
+ return certificateType.nextCanBeExchanged();
}
public String toDisplay() {
@@ -138,4 +167,11 @@
this.tradeable = tradeable;
}
+ public String toString() {
+ StringBuilder b = new StringBuilder(uniqueId);
+ b.append(" certType=").append(getCertType());
+ b.append(" type=").append(getType());
+ b.append(" holder=").append(holder.getName());
+ return b.toString();
+ }
}
Added: trunk/18xx/rails/game/TrainCertificateType.java
===================================================================
--- trunk/18xx/rails/game/TrainCertificateType.java (rev 0)
+++ trunk/18xx/rails/game/TrainCertificateType.java 2011-06-21 21:25:49 UTC (rev 1581)
@@ -0,0 +1,316 @@
+package rails.game;
+
+import java.util.*;
+
+import org.apache.log4j.Logger;
+
+import rails.game.state.BooleanState;
+import rails.game.state.IntegerState;
+import rails.util.*;
+
+public class TrainCertificateType {
+
+ protected String name;
+ protected int quantity = 0;
+ protected boolean infiniteQuantity = false;
+
+ protected String startedPhaseName = null;
+ // Phase startedPhase;
+
+ protected List<TrainType> potentialTrainTypes = new ArrayList<TrainType>(2);
+
+ protected Map<Integer, String> rustedTrainTypeNames = null;
+ protected Map<Integer, TrainCertificateType> rustedTrainType = null;
+
+ protected boolean permanent = true;
+ protected boolean obsoleting = false;
+
+ protected String releasedTrainTypeNames = null;
+ protected List<TrainCertificateType> releasedTrainTypes = null;
+
+ protected boolean canBeExchanged = false;
+ protected int cost;
+ protected int exchangeCost;
+
+ protected String trainClassName = "rails.game.Train";
+ protected Class<? extends Train> trainClass;
+
+
+ protected int lastIndex = 0;
+
+ // State variables
+ protected IntegerState numberBoughtFromIPO;
+ protected BooleanState available;
+ protected BooleanState rusted;
+
+ // References
+ protected TrainManager trainManager;
+
+ /** In some cases, trains start their life in the Pool */
+ protected String initialPortfolio = "IPO";
+
+ protected static Logger log =
+ Logger.getLogger(TrainCertificateType.class.getPackage().getName());
+
+ public TrainCertificateType () {
+ }
+
+ public void configureFromXML(Tag tag) throws ConfigurationException {
+
+ trainClassName = tag.getAttributeAsString("class", trainClassName);
+ try {
+ trainClass = Class.forName(trainClassName).asSubclass(Train.class);
+ } catch (ClassNotFoundException e) {
+ throw new ConfigurationException("Class " + trainClassName
+ + "not found", e);
+ }
+
+ // Name
+ name = tag.getAttributeAsString("name");
+
+ // Quantity
+ quantity = tag.getAttributeAsInteger("quantity", quantity);
+ quantity += tag.getAttributeAsInteger("quantityIncrement", 0);
+
+ // Phase started
+ startedPhaseName = tag.getAttributeAsString("startPhase", "");
+
+ // Train type rusted
+ String rustedTrainTypeName1 = tag.getAttributeAsString("rustedTrain");
+ if (Util.hasValue(rustedTrainTypeName1)) {
+ rustedTrainTypeNames = new HashMap<Integer, String>();
+ rustedTrainTypeNames.put(1, rustedTrainTypeName1);
+ }
+
+ // Other train type released for buying
+ releasedTrainTypeNames = tag.getAttributeAsString("releasedTrain");
+
+ // From where is this type initially available
+ initialPortfolio =
+ tag.getAttributeAsString("initialPortfolio",
+ initialPortfolio);
+
+ // Configure any actions on other than the first train of a type
+ List<Tag> subs = tag.getChildren("Sub");
+ if (subs != null) {
+ for (Tag sub : tag.getChildren("Sub")) {
+ int index = sub.getAttributeAsInteger("index");
+ rustedTrainTypeName1 = sub.getAttributeAsString("rustedTrain");
+ if (rustedTrainTypeNames == null) {
+ rustedTrainTypeNames = new HashMap<Integer, String>();
+ }
+ rustedTrainTypeNames.put(index, rustedTrainTypeName1);
+ }
+ }
+
+ // Exchangeable
+ Tag swapTag = tag.getChild("Exchange");
+ if (swapTag != null) {
+ exchangeCost = swapTag.getAttributeAsInteger("cost", 0);
+ canBeExchanged = (exchan...
[truncated message content] |
|
From: <ev...@us...> - 2011-06-22 11:57:01
|
Revision: 1582
http://rails.svn.sourceforge.net/rails/?rev=1582&view=rev
Author: evos
Date: 2011-06-22 11:56:55 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
Fixed 1830 PM config bug, and added a check for this and related errors.
Modified Paths:
--------------
trunk/18xx/data/1830/Game.xml
trunk/18xx/rails/game/TrainManager.java
Modified: trunk/18xx/data/1830/Game.xml
===================================================================
--- trunk/18xx/data/1830/Game.xml 2011-06-21 21:25:49 UTC (rev 1581)
+++ trunk/18xx/data/1830/Game.xml 2011-06-22 11:56:55 UTC (rev 1582)
@@ -173,13 +173,13 @@
<IfOption name="WithOptional6Train" value="no">
<Attributes quantity="2"/>
</IfOption>
- <IfOption name="Variant" value="Pere Marquette,Coalfields,Reading">
+ <IfOption name="Variant" value="Coalfields,Reading">
<Attributes quantity="3" releasedTrain="7,D"/>
</IfOption>
<IfOption name="Variant" value="Coalfields&Reading">
<Attributes quantity="4" releasedTrain="7,D"/>
</IfOption>
- <IfOption name="Variant" value="Simple,Wabash">
+ <IfOption name="Variant" value="Pere Marquette,Simple,Wabash">
<Attributes quantity="3"/>
</IfOption>
</TrainType>
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-06-21 21:25:49 UTC (rev 1581)
+++ trunk/18xx/rails/game/TrainManager.java 2011-06-22 11:56:55 UTC (rev 1582)
@@ -138,11 +138,15 @@
// Finish initialisation of the train types
Map<Integer, String> rustedTrainTypeNames;
- TrainCertificateType rustedType;
+ TrainCertificateType releasedType, rustedType;
for (TrainCertificateType type : trainCertTypes) {
if (type.getReleasedTrainTypeNames() != null) {
List<TrainCertificateType> rtts = new ArrayList<TrainCertificateType>(2);
for (String ttName : type.getReleasedTrainTypeNames().split(",")) {
+ releasedType = trainCertTypeMap.get(ttName);
+ if (releasedType == null) {
+ throw new ConfigurationException ("Train type "+type.getName()+" releases undefined type "+ttName);
+ }
rtts.add (trainCertTypeMap.get(ttName));
}
type.setReleasedTrainTypes(rtts);
@@ -150,7 +154,11 @@
rustedTrainTypeNames = type.getRustedTrainTypeNames();
if (rustedTrainTypeNames != null) {
for (int index : rustedTrainTypeNames.keySet()) {
- rustedType = trainCertTypeMap.get(rustedTrainTypeNames.get(index));
+ String ttName = rustedTrainTypeNames.get(index);
+ rustedType = trainCertTypeMap.get(ttName);
+ if (rustedType == null) {
+ throw new ConfigurationException ("Train type "+type.getName()+" rusts undefined type "+ttName);
+ }
type.setRustedTrainType(index, rustedType);
rustedType.setPermanent(false);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-24 14:23:35
|
Revision: 1583
http://rails.svn.sourceforge.net/rails/?rev=1583&view=rev
Author: evos
Date: 2011-06-24 14:23:29 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
18GA: OSRR extra 2-train
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/18GA/CompanyManager.xml
trunk/18xx/data/18GA/Game.xml
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/Train.java
trunk/18xx/rails/game/TrainManager.java
trunk/18xx/rails/game/action/StartCompany.java
Added Paths:
-----------
trunk/18xx/rails/game/specific/_18GA/
trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/LocalisedText.properties 2011-06-24 14:23:29 UTC (rev 1583)
@@ -295,6 +295,7 @@
GameSetupFailed=Game setup from file {0} failed
GetShareForMinor={0} gets a {1}% share of {2} from {3} in exchange for {4}
GetNoShareForMinor={0} does not get a share for Minor {1}, which closes
+GetsExtraTrain={0} gets an extra {1}-train
Has={0} has {1}
HasFirstTurn={0} has the first turn
HasMergedShares={0} has exchanged {1} old shares for {2} {3} shares
Modified: trunk/18xx/data/18GA/CompanyManager.xml
===================================================================
--- trunk/18xx/data/18GA/CompanyManager.xml 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/data/18GA/CompanyManager.xml 2011-06-24 14:23:29 UTC (rev 1583)
@@ -48,6 +48,7 @@
</Company>
<Company name="OSO" type="Private" basePrice="100" revenue="20"
longname="Ocilla Southern Railroad">
+ <!-- Note: name "OSO" is also used in OperatingRound_18GA -->
<Blocking hex="G7"/>
</Company>
<Company name="M&B" type="Private" basePrice="150" revenue="25"
Modified: trunk/18xx/data/18GA/Game.xml
===================================================================
--- trunk/18xx/data/18GA/Game.xml 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/data/18GA/Game.xml 2011-06-24 14:23:29 UTC (rev 1583)
@@ -11,6 +11,7 @@
<GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/>
<GameOption name="TwoPlayersCertLimit70Percent" type="toggle" default="yes"/>
<GameParameters>
+ <OperatingRound class="rails.game.specific._18GA.OperatingRound_18GA"/>
<PlayerShareLimit percentage="60">
<IfOption name="NumberOfPlayers" value="2">
<IfOption name="TwoPlayersCertLimit70Percent" value="yes">
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-06-24 14:23:29 UTC (rev 1583)
@@ -1838,6 +1838,7 @@
train.setType(action.getType()); // Needed for dual trains bought from the Bank
operatingCompany.get().buyTrain(train, price);
+
if (oldHolder == ipo) {
train.getCertType().addToBoughtFromIPO();
trainManager.setAnyTrainBought(true);
@@ -2772,7 +2773,7 @@
trains = pf.getUniqueTrains();
for (TrainI train : trains) {
- if (train.isObsolete()) continue;
+ if (train.isObsolete() || !train.isTradeable()) continue;
if (i != currentPlayerIndex
//&& trainMgr.buyAtFaceValueBetweenDifferentPresidents()
&& getGameParameterAsBoolean(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS)
@@ -2848,7 +2849,7 @@
}
/**
- * Can the company buy a train now?
+ * Can the operating company buy a train now?
* Normally only calls isBelowTrainLimit() to get the result.
* May be overridden if other considerations apply (such as
* having a Pullmann in 18EU).
Modified: trunk/18xx/rails/game/Train.java
===================================================================
--- trunk/18xx/rails/game/Train.java 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/rails/game/Train.java 2011-06-24 14:23:29 UTC (rev 1583)
@@ -123,7 +123,7 @@
}
public CashHolder getOwner() {
- return holder.getOwner();
+ return holder != null ? holder.getOwner() : null;
}
public boolean isObsolete() {
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/rails/game/TrainManager.java 2011-06-24 14:23:29 UTC (rev 1583)
@@ -202,7 +202,7 @@
// Train trading between different players at face value only (1851)
gameManager.setGameParameter(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS,
trainPriceAtFaceValueIfDifferentPresidents);
-}
+ }
/** Create train without throwing exceptions.
* To be used <b>after</b> completing initialization,
Modified: trunk/18xx/rails/game/action/StartCompany.java
===================================================================
--- trunk/18xx/rails/game/action/StartCompany.java 2011-06-22 11:56:55 UTC (rev 1582)
+++ trunk/18xx/rails/game/action/StartCompany.java 2011-06-24 14:23:29 UTC (rev 1583)
@@ -47,8 +47,8 @@
@Override
public String toString() {
- StringBuffer text = new StringBuffer();
- text.append("StartCompany: ").append(company.getName());
+ StringBuilder text = new StringBuilder();
+ text.append("StartCompany: ").append(company != null ? company.getName() : null);
if (price > 0) {
text.append(" price=").append(Bank.format(price));
if (numberBought > 1) {
Added: trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java
===================================================================
--- trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java (rev 0)
+++ trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java 2011-06-24 14:23:29 UTC (rev 1583)
@@ -0,0 +1,40 @@
+package rails.game.specific._18GA;
+
+import rails.game.*;
+import rails.game.action.BuyPrivate;
+import rails.util.LocalText;
+
+public class OperatingRound_18GA extends OperatingRound {
+
+ public final static String OS_NAME = "OSO";
+ public final static String OS_EXTRA_TRAIN_TYPE = "2";
+
+ public OperatingRound_18GA (GameManagerI gameManager) {
+ super (gameManager);
+ }
+
+ public boolean buyPrivate(BuyPrivate action) {
+
+ boolean result = super.buyPrivate(action);
+
+ // If the Ocilla Southern has been bought, the company gets an extra 2-train, if possible
+ if (result
+ && action.getPrivateCompany().getName().equalsIgnoreCase(OS_NAME)
+ && isBelowTrainLimit()) {
+ PublicCompanyI company = operatingCompany.get();
+ TrainCertificateType certType = trainManager.getCertTypeByName(OS_EXTRA_TRAIN_TYPE);
+ if (!certType.hasRusted()) { // I.e. before phase "4"
+ TrainI train = trainManager.cloneTrain(certType);
+ company.getPortfolio().buyTrain(train, 0);
+ train.setTradeable(false);
+ ReportBuffer.add(LocalText.getText("GetsExtraTrain",
+ company.getName(),
+ OS_EXTRA_TRAIN_TYPE));
+ company.getPortfolio().getTrainsModel().update();
+ }
+ }
+
+ return result;
+ }
+
+}
Property changes on: trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-25 14:14:54
|
Revision: 1585
http://rails.svn.sourceforge.net/rails/?rev=1585&view=rev
Author: evos
Date: 2011-06-25 14:14:47 +0000 (Sat, 25 Jun 2011)
Log Message:
-----------
1826: new preprinted tiles
Modified Paths:
--------------
trunk/18xx/data/1826/CompanyManager.xml
trunk/18xx/data/1826/Map.xml
trunk/18xx/data/1826/TileSet.xml
trunk/18xx/data/1826/Tiles.xml
trunk/18xx/tiles/TileDictionary.18t
trunk/18xx/tiles/TileDictionary.xml
trunk/18xx/tiles/Tiles.xml
Added Paths:
-----------
trunk/18xx/tiles/svg/tile-26001.svg
trunk/18xx/tiles/svg/tile-26002.svg
trunk/18xx/tiles/svg/tile-26003.svg
Modified: trunk/18xx/data/1826/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1826/CompanyManager.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/data/1826/CompanyManager.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -53,7 +53,7 @@
<Company name="Est" type="Public" tokens="4" fgColour="000000" bgColour="FF6600"
longname="Chemin de Fer de L'Est">
- <Home hex="G9"/>
+ <Home hex="G9" city="2"/>
</Company>
<Company name="GC" type="Public" tokens="4" fgColour="000000" bgColour="BCD2EE"
@@ -68,27 +68,27 @@
<Company name="N" type="Public" tokens="4" fgColour="FFFFFF" bgColour="EE0000"
longname="Chemin de Fer du Nord">
- <Home hex="G9"/>
+ <Home hex="G9" city="1"/>
</Company>
<Company name="Ouest" type="Public" tokens="4" fgColour="000000" bgColour="FF92BB"
longname="Chemin de Fer de L'Ouest">
- <Home hex="G9"/>
+ <Home hex="G9" city="5"/>
</Company>
<Company name="Paris" type="Public" tokens="4" fgColour="000000" bgColour="CECC15"
longname="Chemin de Fer de Paris">
- <Home hex="G9"/>
+ <Home hex="G9" city="6"/>
</Company>
<Company name="PLM" type="Public" tokens="4" fgColour="FFFFFF" bgColour="691F01"
longname="Chemin de Fer Paris-Lyon-Méditerranée">
- <Home hex="G9"/>
+ <Home hex="G9" city="3"/>
</Company>
<Company name="PO" type="Public" tokens="4" fgColour="FFFFFF" bgColour="0000CD"
longname="Chemin de Fer Paris-Orléans">
- <Home hex="G9"/>
+ <Home hex="G9" city="4"/>
</Company>
<Company name="Etat" type="Public" tokens="4" fgColour="FFFFFF" bgColour="000000"
Modified: trunk/18xx/data/1826/Map.xml
===================================================================
--- trunk/18xx/data/1826/Map.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/data/1826/Map.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -16,7 +16,7 @@
<Hex name="D12" tile="-1" city="Mons"/>
<Hex name="D14" tile="-1" city="Namur" cost="60"/>
<Hex name="D16" tile="-1" city="Luxembourg" cost="60"/>
- <Hex name="E5" tile="-4007" city="Le Havre"/>
+ <Hex name="E5" tile="-103" orientation="5" city="Le Havre"/>
<Hex name="E7" tile="-1" city="Rouen" cost="40"/>
<Hex name="E9" tile="0"/>
<Hex name="E11" tile="0"/>
@@ -33,12 +33,12 @@
<Hex name="G3" tile="0"/>
<Hex name="G5" tile="0"/>
<Hex name="G7" tile="0"/>
- <Hex name="G9" tile="-4007" city="Paris"/>
+ <Hex name="G9" tile="-26001" city="Paris"/>
<Hex name="G11" tile="0"/>
<Hex name="G13" tile="0"/>
<Hex name="G15" tile="0"/>
<Hex name="G17" tile="0"/>
- <Hex name="G19" tile="-4007" city="Strasbourg"/>
+ <Hex name="G19" tile="-26002" orientation="3" city="Strasbourg"/>
<Hex name="H2" tile="-1" city="Rennes"/>
<Hex name="H4" tile="0"/>
<Hex name="H6" tile="-10" city="Le Mans"/>
@@ -48,7 +48,7 @@
<Hex name="H14" tile="0"/>
<Hex name="H16" tile="0"/>
<Hex name="H18" tile="-1" city="Mulhouse"/>
- <Hex name="I1" tile="-4007" city="Nantes"/>
+ <Hex name="I1" tile="-26002" city="Nantes"/>
<Hex name="I3" tile="-1" city="Angers" cost="40"/>
<Hex name="I5" tile="0" cost="40"/>
<Hex name="I7" tile="57" city="Orléans"/>
@@ -73,7 +73,7 @@
<Hex name="K11" tile="-1" city="Clermont-Ferrand" cost="60"/>
<Hex name="K13" tile="0"/>
<Hex name="K15" tile="0"/>
- <Hex name="K17" tile="-4007" city="Geneva"/>
+ <Hex name="K17" tile="-105" orientation="2" city="Geneva"/>
<Hex name="L4" tile="0"/>
<Hex name="L6" tile="0"/>
<Hex name="L8" tile="-1" city="Limoges"/>
@@ -81,7 +81,7 @@
<Hex name="L12" tile="0" cost="60"/>
<Hex name="L14" tile="14" city="Lyon" orientation="5"/>
<Hex name="L16" tile="0"/>
- <Hex name="M3" tile="-4007" city="Bordeaux"/>
+ <Hex name="M3" tile="-26003" city="Bordeaux"/>
<Hex name="M5" tile="0" cost="40"/>
<Hex name="M7" tile="0"/>
<Hex name="M9" tile="0"/>
Modified: trunk/18xx/data/1826/TileSet.xml
===================================================================
--- trunk/18xx/data/1826/TileSet.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/data/1826/TileSet.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -11,6 +11,10 @@
<Tile id="14"/>
<Tile id="619"/>
<Tile id="5"/>
- <Tile id="-4007"/>
+ <Tile id="-26001"/>
+ <Tile id="-26002"/>
+ <Tile id="-26003"/>
+ <Tile id="-103"/>
+ <Tile id="-105"/>
</TileManager>
Modified: trunk/18xx/data/1826/Tiles.xml
===================================================================
--- trunk/18xx/data/1826/Tiles.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/data/1826/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -1,15 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Tiles>
<Tile colour="white" id="0" name="empty"/>
- <Tile colour="white" id="-1" name="empty"/>
- <Tile colour="white" id="-10" name="empty"/>
- <Tile colour="white" id="57" name="empty"/>
- <Tile colour="white" id="-901" name="empty"/>
- <Tile colour="white" id="-902" name="empty"/>
- <Tile colour="white" id="-903" name="empty"/>
- <Tile colour="white" id="14" name="empty"/>
- <Tile colour="white" id="619" name="empty"/>
- <Tile colour="white" id="5" name="empty"/>
- <Tile colour="white" id="-4007" name="empty"/>
-
+ <Tile colour="white" id="-1" name="1 village">
+ <Station id="city1" position="002" type="Town"/>
+ </Tile>
+ <Tile colour="white" id="-10" name="1 city">
+ <Station id="city1" position="302" slots="1" type="City"/>
+ </Tile>
+ <Tile colour="yellow" id="57" name="57">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ </Tile>
+ <Tile colour="red" id="-901" name="OM 1 way">
+ <Station id="city1" position="0" type="OffMapCity" value="-1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ </Tile>
+ <Tile colour="red" id="-902" name="OM 2 way">
+ <Station id="city1" position="0" type="OffMapCity" value="-1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ </Tile>
+ <Tile colour="red" id="-903" name="OM 3 way">
+ <Station id="city1" position="0" type="OffMapCity" value="-1"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ </Tile>
+ <Tile colour="green" id="14" name="14">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side4"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ </Tile>
+ <Tile colour="green" id="619" name="619">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side4"/>
+ <Track from="city1" gauge="normal" to="side5"/>
+ </Tile>
+ <Tile colour="yellow" id="5" name="5">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ </Tile>
+ <Tile colour="yellow" id="-26001" name="Paris">
+ <Station id="city1" position="003" slots="1" type="City" value="50"/>
+ <Station id="city2" position="103" slots="1" type="City" value="50"/>
+ <Station id="city3" position="203" slots="1" type="City" value="50"/>
+ <Station id="city4" position="303" slots="1" type="City" value="50"/>
+ <Station id="city5" position="403" slots="1" type="City" value="50"/>
+ <Station id="city6" position="503" slots="1" type="City" value="50"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city2" gauge="normal" to="side1"/>
+ <Track from="city3" gauge="normal" to="side2"/>
+ <Track from="city4" gauge="normal" to="side3"/>
+ <Track from="city5" gauge="normal" to="side4"/>
+ <Track from="city6" gauge="normal" to="side5"/>
+ </Tile>
+ <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg">
+ <Station id="city1" position="0" slots="1" type="City" value="40"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ </Tile>
+ <Tile colour="fixed" id="-26003" name="Bordeaux">
+ <Station id="city1" position="0" slots="1" type="City" value="40"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="fixed" id="-103" name="MF 103">
+ <Station id="city1" position="0" slots="1" type="City" value="40"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="fixed" id="-105" name="MF 105">
+ <Station id="city1" position="0" slots="1" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
</Tiles>
\ No newline at end of file
Modified: trunk/18xx/tiles/TileDictionary.18t
===================================================================
(Binary files differ)
Modified: trunk/18xx/tiles/TileDictionary.xml
===================================================================
--- trunk/18xx/tiles/TileDictionary.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/tiles/TileDictionary.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -23834,4 +23834,158 @@
</connection>
</connections>
</tile>
-</tiles>
+ <tile>
+ <ID>-26001</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapUpgradableToGreen</level>
+ <name>Paris</name>
+ <junctions>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideA</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideB</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideC</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideD</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideE</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tp3SideF</position>
+ <revenue>
+ <value>50</value>
+ <position>tpCenter</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideA</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideB</position1>
+ <position2>tp4SideB</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideC</position1>
+ <position2>tp4SideC</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideD</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideE</position1>
+ <position2>tp4SideE</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tp3SideF</position1>
+ <position2>tp4SideF</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-26002</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapFixed</level>
+ <name>Nantes/Sstrasbourg</name>
+ <junctions>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>40</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideB</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideC</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-26003</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapFixed</level>
+ <name>Bordeaux</name>
+ <junctions>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>40</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideB</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ </connections>
+ </tile>
+</tiles>
\ No newline at end of file
Modified: trunk/18xx/tiles/Tiles.xml
===================================================================
--- trunk/18xx/tiles/Tiles.xml 2011-06-25 09:50:26 UTC (rev 1584)
+++ trunk/18xx/tiles/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585)
@@ -4182,4 +4182,30 @@
<Tile colour="fixed" id="-4009" name="Ferry">
<Track from="side3" gauge="narrow" to="side0"/>
</Tile>
+ <Tile colour="yellow" id="-26001" name="Paris">
+ <Station id="city1" position="003" slots="1" type="City" value="50"/>
+ <Station id="city2" position="103" slots="1" type="City" value="50"/>
+ <Station id="city3" position="203" slots="1" type="City" value="50"/>
+ <Station id="city4" position="303" slots="1" type="City" value="50"/>
+ <Station id="city5" position="403" slots="1" type="City" value="50"/>
+ <Station id="city6" position="503" slots="1" type="City" value="50"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city2" gauge="normal" to="side1"/>
+ <Track from="city3" gauge="normal" to="side2"/>
+ <Track from="city4" gauge="normal" to="side3"/>
+ <Track from="city5" gauge="normal" to="side4"/>
+ <Track from="city6" gauge="normal" to="side5"/>
+ </Tile>
+ <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg">
+ <Station id="city1" position="0" slots="1" type="City" value="40"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ </Tile>
+ <Tile colour="fixed" id="-26003" name="Bordeaux">
+ <Station id="city1" position="0" slots="1" type="City" value="40"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
</Tiles>
\ No newline at end of file
Added: trunk/18xx/tiles/svg/tile-26001.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-26001.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-26001.svg 2011-06-25 14:14:47 UTC (rev 1585)
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#FFFF00" stroke="#FFFF00" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="43" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="306" cy="107" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="306" cy="233" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="297" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="86" cy="233" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="86" cy="107" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,43 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,107 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,233 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,297 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,233 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,107 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,43 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,107 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 306,233 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,297 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,233 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 86,107 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="43" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="306" cy="107" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="306" cy="233" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="196" cy="297" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="86" cy="233" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><circle cx="86" cy="107" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="196" cy="170" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="196" y="170" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">50</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
Added: trunk/18xx/tiles/svg/tile-26002.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-26002.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-26002.svg 2011-06-25 14:14:47 UTC (rev 1585)
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#C0C0C0" stroke="#C0C0C0" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">40</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
Added: trunk/18xx/tiles/svg/tile-26003.svg
===================================================================
--- trunk/18xx/tiles/svg/tile-26003.svg (rev 0)
+++ trunk/18xx/tiles/svg/tile-26003.svg 2011-06-25 14:14:47 UTC (rev 1585)
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#C0C0C0" stroke="#C0C0C0" stroke-width="1" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 196,170 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,170 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="196" cy="170" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="43" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="43" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">40</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-25 15:37:07
|
Revision: 1586
http://rails.svn.sourceforge.net/rails/?rev=1586&view=rev
Author: evos
Date: 2011-06-25 15:37:01 +0000 (Sat, 25 Jun 2011)
Log Message:
-----------
1826 more preprinted tiles
Modified Paths:
--------------
trunk/18xx/data/1826/Map.xml
trunk/18xx/data/1826/TileSet.xml
trunk/18xx/data/1826/Tiles.xml
trunk/18xx/tiles/TileDictionary.xml
trunk/18xx/tiles/Tiles.xml
Modified: trunk/18xx/data/1826/Map.xml
===================================================================
--- trunk/18xx/data/1826/Map.xml 2011-06-25 14:14:47 UTC (rev 1585)
+++ trunk/18xx/data/1826/Map.xml 2011-06-25 15:37:01 UTC (rev 1586)
@@ -7,8 +7,8 @@
<Hex name="B12" tile="-10" city="Antwerp" cost="40"/>
<Hex name="B14" tile="0" cost="40"/>
<Hex name="C9" tile="-1" city="Calais"/>
- <Hex name="C11" tile="5" city="Lille" orientation="2"/>
- <Hex name="C13" tile="619" city="Brussels" orientation="3"/>
+ <Hex name="C11" tile="-26004" city="Lille"/>
+ <Hex name="C13" tile="-26006" city="Brussels"/>
<Hex name="C15" tile="-10" city="Liège" cost="40"/>
<Hex name="C17" tile="-902" city="Cologne" value="20,40,60,100" orientation="2"/>
<Hex name="D8" tile="0"/>
@@ -51,7 +51,7 @@
<Hex name="I1" tile="-26002" city="Nantes"/>
<Hex name="I3" tile="-1" city="Angers" cost="40"/>
<Hex name="I5" tile="0" cost="40"/>
- <Hex name="I7" tile="57" city="Orléans"/>
+ <Hex name="I7" tile="-26005" city="Orléans"/>
<Hex name="I9" tile="0"/>
<Hex name="I11" tile="0"/>
<Hex name="I13" tile="-10" city="Dijon"/>
@@ -79,7 +79,7 @@
<Hex name="L8" tile="-1" city="Limoges"/>
<Hex name="L10" tile="0" cost="60"/>
<Hex name="L12" tile="0" cost="60"/>
- <Hex name="L14" tile="14" city="Lyon" orientation="5"/>
+ <Hex name="L14" tile="-26007" city="Lyon"/>
<Hex name="L16" tile="0"/>
<Hex name="M3" tile="-26003" city="Bordeaux"/>
<Hex name="M5" tile="0" cost="40"/>
Modified: trunk/18xx/data/1826/TileSet.xml
===================================================================
--- trunk/18xx/data/1826/TileSet.xml 2011-06-25 14:14:47 UTC (rev 1585)
+++ trunk/18xx/data/1826/TileSet.xml 2011-06-25 15:37:01 UTC (rev 1586)
@@ -4,16 +4,16 @@
<Tile id="0"/>
<Tile id="-1"/>
<Tile id="-10"/>
- <Tile id="57"/>
<Tile id="-901"/>
<Tile id="-902"/>
<Tile id="-903"/>
- <Tile id="14"/>
- <Tile id="619"/>
- <Tile id="5"/>
<Tile id="-26001"/>
<Tile id="-26002"/>
<Tile id="-26003"/>
+ <Tile id="-26004"/>
+ <Tile id="-26005"/>
+ <Tile id="-26006"/>
+ <Tile id="-26007"/>
<Tile id="-103"/>
<Tile id="-105"/>
Modified: trunk/18xx/data/1826/Tiles.xml
===================================================================
--- trunk/18xx/data/1826/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585)
+++ trunk/18xx/data/1826/Tiles.xml 2011-06-25 15:37:01 UTC (rev 1586)
@@ -7,11 +7,6 @@
<Tile colour="white" id="-10" name="1 city">
<Station id="city1" position="302" slots="1" type="City"/>
</Tile>
- <Tile colour="yellow" id="57" name="57">
- <Station id="city1" position="0" slots="1" type="City" value="20"/>
- <Track from="city1" gauge="normal" to="side3"/>
- <Track from="city1" gauge="normal" to="side0"/>
- </Tile>
<Tile colour="red" id="-901" name="OM 1 way">
<Station id="city1" position="0" type="OffMapCity" value="-1"/>
<Track from="city1" gauge="normal" to="side2"/>
@@ -27,25 +22,6 @@
<Track from="city1" gauge="normal" to="side2"/>
<Track from="city1" gauge="normal" to="side1"/>
</Tile>
- <Tile colour="green" id="14" name="14">
- <Station id="city1" position="0" slots="2" type="City" value="30"/>
- <Track from="city1" gauge="normal" to="side1"/>
- <Track from="city1" gauge="normal" to="side3"/>
- <Track from="city1" gauge="normal" to="side4"/>
- <Track from="city1" gauge="normal" to="side0"/>
- </Tile>
- <Tile colour="green" id="619" name="619">
- <Station id="city1" position="0" slots="2" type="City" value="30"/>
- <Track from="city1" gauge="normal" to="side0"/>
- <Track from="city1" gauge="normal" to="side2"/>
- <Track from="city1" gauge="normal" to="side4"/>
- <Track from="city1" gauge="normal" to="side5"/>
- </Tile>
- <Tile colour="yellow" id="5" name="5">
- <Station id="city1" position="0" slots="1" type="City" value="20"/>
- <Track from="city1" gauge="normal" to="side1"/>
- <Track from="city1" gauge="normal" to="side2"/>
- </Tile>
<Tile colour="yellow" id="-26001" name="Paris">
<Station id="city1" position="003" slots="1" type="City" value="50"/>
<Station id="city2" position="103" slots="1" type="City" value="50"/>
@@ -60,7 +36,7 @@
<Track from="city5" gauge="normal" to="side4"/>
<Track from="city6" gauge="normal" to="side5"/>
</Tile>
- <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg">
+ <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg">
<Station id="city1" position="0" slots="1" type="City" value="40"/>
<Track from="city1" gauge="normal" to="side0"/>
<Track from="city1" gauge="normal" to="side1"/>
@@ -72,6 +48,30 @@
<Track from="city1" gauge="normal" to="side1"/>
<Track from="city1" gauge="normal" to="side3"/>
</Tile>
+ <Tile colour="yellow" id="-26004" name="Lille">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side4"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="yellow" id="-26005" name="Orleans">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="green" id="-26006" name="Brussels">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side5"/>
+ </Tile>
+ <Tile colour="green" id="-26007" name="Lyon">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side5"/>
+ </Tile>
<Tile colour="fixed" id="-103" name="MF 103">
<Station id="city1" position="0" slots="1" type="City" value="40"/>
<Track from="city1" gauge="normal" to="side2"/>
Modified: trunk/18xx/tiles/TileDictionary.xml
===================================================================
--- trunk/18xx/tiles/TileDictionary.xml 2011-06-25 14:14:47 UTC (rev 1585)
+++ trunk/18xx/tiles/TileDictionary.xml 2011-06-25 15:37:01 UTC (rev 1586)
@@ -23926,7 +23926,7 @@
<ID>-26002</ID>
<shape>tsHexagon</shape>
<level>tlMapFixed</level>
- <name>Nantes/Sstrasbourg</name>
+ <name>Nantes/Strasbourg</name>
<junctions>
<junction>
<junType>jtCity</junType>
@@ -23988,4 +23988,136 @@
</connection>
</connections>
</tile>
+ <tile>
+ <ID>-26004</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapUpgradableToGreen</level>
+ <name>Lille</name>
+ <junctions>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>20</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideE</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-26005</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapUpgradableToGreen</level>
+ <name>Orleans</name>
+ <junctions>
+ <junction>
+ <junType>jtCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>20</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-26006</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapUpgradableToBrown</level>
+ <name>Brussels</name>
+ <junctions>
+ <junction>
+ <junType>jtDoubleCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>30</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideB</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideC</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideF</position2>
+ </connection>
+ </connections>
+ </tile>
+ <tile>
+ <ID>-26007</ID>
+ <shape>tsHexagon</shape>
+ <level>tlMapUpgradableToBrown</level>
+ <name>Lyon</name>
+ <junctions>
+ <junction>
+ <junType>jtDoubleCity</junType>
+ <position>tpCenter</position>
+ <revenue>
+ <value>30</value>
+ <position>tp3CornerA</position>
+ </revenue>
+ </junction>
+ </junctions>
+ <connections>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideA</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideC</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideD</position2>
+ </connection>
+ <connection>
+ <conType>ctNormal</conType>
+ <position1>tpCenter</position1>
+ <position2>tp4SideF</position2>
+ </connection>
+ </connections>
+ </tile>
</tiles>
\ No newline at end of file
Modified: trunk/18xx/tiles/Tiles.xml
===================================================================
--- trunk/18xx/tiles/Tiles.xml 2011-06-25 14:14:47 UTC (rev 1585)
+++ trunk/18xx/tiles/Tiles.xml 2011-06-25 15:37:01 UTC (rev 1586)
@@ -4196,7 +4196,7 @@
<Track from="city5" gauge="normal" to="side4"/>
<Track from="city6" gauge="normal" to="side5"/>
</Tile>
- <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg">
+ <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg">
<Station id="city1" position="0" slots="1" type="City" value="40"/>
<Track from="city1" gauge="normal" to="side0"/>
<Track from="city1" gauge="normal" to="side1"/>
@@ -4208,4 +4208,28 @@
<Track from="city1" gauge="normal" to="side1"/>
<Track from="city1" gauge="normal" to="side3"/>
</Tile>
+ <Tile colour="yellow" id="-26004" name="Lille">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side4"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="yellow" id="-26005" name="Orleans">
+ <Station id="city1" position="0" slots="1" type="City" value="20"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ </Tile>
+ <Tile colour="green" id="-26006" name="Brussels">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side1"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side5"/>
+ </Tile>
+ <Tile colour="green" id="-26007" name="Lyon">
+ <Station id="city1" position="0" slots="2" type="City" value="30"/>
+ <Track from="city1" gauge="normal" to="side0"/>
+ <Track from="city1" gauge="normal" to="side2"/>
+ <Track from="city1" gauge="normal" to="side3"/>
+ <Track from="city1" gauge="normal" to="side5"/>
+ </Tile>
</Tiles>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-26 15:09:20
|
Revision: 1590
http://rails.svn.sourceforge.net/rails/?rev=1590&view=rev
Author: evos
Date: 2011-06-26 15:09:14 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
18GA: last fine details
Modified Paths:
--------------
trunk/18xx/data/18GA/TileSet.xml
trunk/18xx/data/18GA/Tiles.xml
trunk/18xx/data/GamesList.xml
trunk/18xx/tiles/TileDictionary.xml
trunk/18xx/tiles/Tiles.xml
trunk/18xx/tiles/svg/tile1455.svg
Modified: trunk/18xx/data/18GA/TileSet.xml
===================================================================
--- trunk/18xx/data/18GA/TileSet.xml 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/data/18GA/TileSet.xml 2011-06-26 15:09:14 UTC (rev 1590)
@@ -49,14 +49,18 @@
<Tile id="5" quantity="2">
<Upgrade id="14,15" hex="-D10,G13" />
<Upgrade id="1453" hex="D10" />
- <Upgrade id="1454" hex="G13" />
+ <IfOption name="Variant" value="Basegame">
+ <Upgrade id="1454" hex="G13" />
+ </IfOption>
</Tile>
<!-- Gentle-curve city (20) -->
<Tile id="6" quantity="2">
<Upgrade id="14,15" hex="-D10,G13" />
<Upgrade id="1453" hex="D10" />
- <Upgrade id="1454" hex="G13" />
+ <IfOption name="Variant" value="Basegame">
+ <Upgrade id="1454" hex="G13" />
+ </IfOption>
</Tile>
<!-- Sharp curve -->
@@ -78,7 +82,9 @@
<Tile id="57" quantity="4">
<Upgrade id="14,15" hex="-D10,-G13" />
<Upgrade id="1453" hex="D10" />
- <Upgrade id="1454" hex="G13" />
+ <IfOption name="Variant" value="Basegame">
+ <Upgrade id="1454" hex="G13" />
+ </IfOption>
</Tile>
<!-- Gentle-curve dit (10) -->
@@ -181,10 +187,12 @@
<Upgrade id="1456" />
</Tile>
- <!-- City (30), exits N,NW,SW, "Savannah" -->
- <Tile id="1454" extId="454" quantity="1">
- <Upgrade id="1459" />
- </Tile>
+ <IfOption name="Variant" value="Basegame">
+ <!-- City (30), exits N,NW,SW, "Savannah" -->
+ <Tile id="1454" extId="454" quantity="1">
+ <Upgrade id="1459" />
+ </Tile>
+ </IfOption>
<!-- Brown Tiles -->
@@ -233,7 +241,9 @@
<!-- 5-way city (50), "Macon" -->
<Tile id="1458" extId="458" quantity="1" />
- <!-- City (60), exits N,NW,SW, "Savannah" -->
- <Tile id="1459" extId="459" quantity="1" />
+ <IfOption name="Variant" value="Basegame">
+ <!-- City (60), exits N,NW,SW, "Savannah" -->
+ <Tile id="1459" extId="459" quantity="1" />
+ </IfOption>
</TileManager>
Modified: trunk/18xx/data/18GA/Tiles.xml
===================================================================
--- trunk/18xx/data/18GA/Tiles.xml 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/data/18GA/Tiles.xml 2011-06-26 15:09:14 UTC (rev 1590)
@@ -13,7 +13,7 @@
<Track from="city1" gauge="normal" to="side1"/>
</Tile>
<Tile colour="fixed" id="-1143" name="Bham1851">
- <Station id="city1" position="0" type="City"/>
+ <Station id="city1" position="0" type="Town"/>
<Track from="side5" gauge="normal" to="city1"/>
<Track from="city1" gauge="normal" to="side0"/>
<Track from="city1" gauge="normal" to="side1"/>
@@ -248,9 +248,9 @@
<Track from="side4" gauge="normal" to="side0"/>
</Tile>
<Tile colour="brown" id="1455" name="GA455">
- <Station id="city1" position="502" slots="1" type="City" value="60"/>
- <Station id="city2" position="102" slots="1" type="City" value="60"/>
- <Station id="city3" position="302" slots="1" type="City" value="60"/>
+ <Station id="city1" position="502" slots="1" type="City" value="70"/>
+ <Station id="city2" position="102" slots="1" type="City" value="70"/>
+ <Station id="city3" position="302" slots="1" type="City" value="70"/>
<Track from="city2" gauge="normal" to="side1"/>
<Track from="city2" gauge="normal" to="side4"/>
<Track from="city1" gauge="normal" to="side5"/>
@@ -274,7 +274,7 @@
<Track from="city1" gauge="normal" to="side4"/>
</Tile>
<Tile colour="brown" id="1458" name="GA458">
- <Station id="city1" position="0" slots="1" type="City" value="50"/>
+ <Station id="city1" position="0" slots="2" type="City" value="50"/>
<Track from="city1" gauge="normal" to="side1"/>
<Track from="city1" gauge="normal" to="side2"/>
<Track from="city1" gauge="normal" to="side3"/>
Modified: trunk/18xx/data/GamesList.xml
===================================================================
--- trunk/18xx/data/GamesList.xml 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/data/GamesList.xml 2011-06-26 15:09:14 UTC (rev 1590)
@@ -128,7 +128,6 @@
Published 2004 by Deep Thought Games, LLC
Not yet implemented:
-- High mountain yellow to green upgrade cost ($60)
- Bankruptcy rules (game currently hangs when a player goes bankrupt)
</Description>
<Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" />
@@ -140,6 +139,21 @@
<Players minimum="2" maximum="6"/>
</Game>
+ <Game name="18GA">
+ <Note>Fully Playable</Note>
+ <Description>18GA - The Railroads Come to Georgia
+ Copyright 2000, 2007, Mark Derrick and John David Galt</Description>
+ <Option name="Variant" values="Basegame,Cotton Port" default="Basegame" />
+ <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" />
+ <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" />
+ <Option name="NoMapMode" type="toggle" default="no" />
+ <Option name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/>
+ <Option name="UnlimitedTiles" type="toggle" default="no"/>
+ <Option name="LeaveAuctionOnPass" type="toggle" default="no"/>
+ <Option name="TwoPlayersCertLimit70Percent" type="toggle" default="no"/>
+ <Players minimum="2" maximum="5"/>
+ </Game>
+
<Game name="18Kaas">
<Note>Fully playable</Note>
<Description>18Kaas (Netherlands)
@@ -250,7 +264,7 @@
</Game>
<Game name="1826">
<Note>Prototype</Note>
- <Description>1826</Description>
+ <Description>1826 - Railroading in France and Belgium from 1826</Description>
<Players minimum="2" maximum="6" />
</Game>
<Game name="18JR">
@@ -275,22 +289,10 @@
<Description>18VA</Description>
<Players minimum="2" maximum="5" />
</Game>
- <Game name="18GA">
- <Note>Prototype</Note>
- <Description>18GA</Description>
- <Option name="Variant" values="Basegame,Cotton Port" default="Basegame" />
- <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" />
- <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" />
- <Option name="NoMapMode" type="toggle" default="no" />
- <Option name="UnlimitedTopTrains" parm="8" type="toggle" default="no"/>
- <Option name="UnlimitedTiles" type="toggle" default="no"/>
- <Option name="LeaveAuctionOnPass" type="toggle" default="no"/>
- <Option name="TwoPlayersCertLimit70Percent" type="toggle" default="no"/>
- <Players minimum="2" maximum="5"/>
- </Game>
+
<Game name="18TN">
<Note>Prototype</Note>
- <Description>18TN</Description>
+ <Description>18TN - The Railroads Come to Tennessee</Description>
<Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" />
<Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" />
<Option name="NoMapMode" type="toggle" default="no" />
Modified: trunk/18xx/tiles/TileDictionary.xml
===================================================================
--- trunk/18xx/tiles/TileDictionary.xml 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/tiles/TileDictionary.xml 2011-06-26 15:09:14 UTC (rev 1590)
@@ -10938,7 +10938,7 @@
<junType>jtCity</junType>
<position>tp2SideF</position>
<revenue>
- <value>60</value>
+ <value>70</value>
<position>tp3CornerE</position>
</revenue>
</junction>
@@ -10946,7 +10946,7 @@
<junType>jtCity</junType>
<position>tp2SideB</position>
<revenue>
- <value>60</value>
+ <value>70</value>
<position>tp3CornerE</position>
</revenue>
</junction>
@@ -10954,7 +10954,7 @@
<junType>jtCity</junType>
<position>tp2SideD</position>
<revenue>
- <value>60</value>
+ <value>70</value>
<position>tp3CornerE</position>
</revenue>
</junction>
@@ -23926,7 +23926,7 @@
<ID>-26002</ID>
<shape>tsHexagon</shape>
<level>tlMapFixed</level>
- <name>Nantes/Strasbourg</name>
+ <name>Nantes/Sstrasbourg</name>
<junctions>
<junction>
<junType>jtCity</junType>
@@ -23988,136 +23988,4 @@
</connection>
</connections>
</tile>
- <tile>
- <ID>-26004</ID>
- <shape>tsHexagon</shape>
- <level>tlMapUpgradableToGreen</level>
- <name>Lille</name>
- <junctions>
- <junction>
- <junType>jtCity</junType>
- <position>tpCenter</position>
- <revenue>
- <value>20</value>
- <position>tp3CornerA</position>
- </revenue>
- </junction>
- </junctions>
- <connections>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideE</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideD</position2>
- </connection>
- </connections>
- </tile>
- <tile>
- <ID>-26005</ID>
- <shape>tsHexagon</shape>
- <level>tlMapUpgradableToGreen</level>
- <name>Orleans</name>
- <junctions>
- <junction>
- <junType>jtCity</junType>
- <position>tpCenter</position>
- <revenue>
- <value>20</value>
- <position>tp3CornerA</position>
- </revenue>
- </junction>
- </junctions>
- <connections>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideA</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideD</position2>
- </connection>
- </connections>
- </tile>
- <tile>
- <ID>-26006</ID>
- <shape>tsHexagon</shape>
- <level>tlMapUpgradableToBrown</level>
- <name>Brussels</name>
- <junctions>
- <junction>
- <junType>jtDoubleCity</junType>
- <position>tpCenter</position>
- <revenue>
- <value>30</value>
- <position>tp3CornerA</position>
- </revenue>
- </junction>
- </junctions>
- <connections>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideB</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideC</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideD</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideF</position2>
- </connection>
- </connections>
- </tile>
- <tile>
- <ID>-26007</ID>
- <shape>tsHexagon</shape>
- <level>tlMapUpgradableToBrown</level>
- <name>Lyon</name>
- <junctions>
- <junction>
- <junType>jtDoubleCity</junType>
- <position>tpCenter</position>
- <revenue>
- <value>30</value>
- <position>tp3CornerA</position>
- </revenue>
- </junction>
- </junctions>
- <connections>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideA</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideC</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideD</position2>
- </connection>
- <connection>
- <conType>ctNormal</conType>
- <position1>tpCenter</position1>
- <position2>tp4SideF</position2>
- </connection>
- </connections>
- </tile>
-</tiles>
\ No newline at end of file
+</tiles>
Modified: trunk/18xx/tiles/Tiles.xml
===================================================================
--- trunk/18xx/tiles/Tiles.xml 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/tiles/Tiles.xml 2011-06-26 15:09:14 UTC (rev 1590)
@@ -1912,9 +1912,9 @@
<Track from="city1" gauge="normal" to="side4"/>
</Tile>
<Tile colour="brown" id="1455" name="GA455">
- <Station id="city1" position="502" slots="1" type="City" value="60"/>
- <Station id="city2" position="102" slots="1" type="City" value="60"/>
- <Station id="city3" position="302" slots="1" type="City" value="60"/>
+ <Station id="city1" position="502" slots="1" type="City" value="70"/>
+ <Station id="city2" position="102" slots="1" type="City" value="70"/>
+ <Station id="city3" position="302" slots="1" type="City" value="70"/>
<Track from="city2" gauge="normal" to="side1"/>
<Track from="city2" gauge="normal" to="side4"/>
<Track from="city1" gauge="normal" to="side5"/>
@@ -4196,7 +4196,7 @@
<Track from="city5" gauge="normal" to="side4"/>
<Track from="city6" gauge="normal" to="side5"/>
</Tile>
- <Tile colour="fixed" id="-26002" name="Nantes/Strasbourg">
+ <Tile colour="fixed" id="-26002" name="Nantes/Sstrasbourg">
<Station id="city1" position="0" slots="1" type="City" value="40"/>
<Track from="city1" gauge="normal" to="side0"/>
<Track from="city1" gauge="normal" to="side1"/>
@@ -4208,28 +4208,4 @@
<Track from="city1" gauge="normal" to="side1"/>
<Track from="city1" gauge="normal" to="side3"/>
</Tile>
- <Tile colour="yellow" id="-26004" name="Lille">
- <Station id="city1" position="0" slots="1" type="City" value="20"/>
- <Track from="city1" gauge="normal" to="side4"/>
- <Track from="city1" gauge="normal" to="side3"/>
- </Tile>
- <Tile colour="yellow" id="-26005" name="Orleans">
- <Station id="city1" position="0" slots="1" type="City" value="20"/>
- <Track from="city1" gauge="normal" to="side0"/>
- <Track from="city1" gauge="normal" to="side3"/>
- </Tile>
- <Tile colour="green" id="-26006" name="Brussels">
- <Station id="city1" position="0" slots="2" type="City" value="30"/>
- <Track from="city1" gauge="normal" to="side1"/>
- <Track from="city1" gauge="normal" to="side2"/>
- <Track from="city1" gauge="normal" to="side3"/>
- <Track from="city1" gauge="normal" to="side5"/>
- </Tile>
- <Tile colour="green" id="-26007" name="Lyon">
- <Station id="city1" position="0" slots="2" type="City" value="30"/>
- <Track from="city1" gauge="normal" to="side0"/>
- <Track from="city1" gauge="normal" to="side2"/>
- <Track from="city1" gauge="normal" to="side3"/>
- <Track from="city1" gauge="normal" to="side5"/>
- </Tile>
</Tiles>
\ No newline at end of file
Modified: trunk/18xx/tiles/svg/tile1455.svg
===================================================================
--- trunk/18xx/tiles/svg/tile1455.svg 2011-06-26 08:53:32 UTC (rev 1589)
+++ trunk/18xx/tiles/svg/tile1455.svg 2011-06-26 15:09:14 UTC (rev 1590)
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#B46301" stroke="#B46301" stroke-width="1" stroke-linejoin="round"/><text x="245" y="318" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Arial" font-size="34">1455</text><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 269,128 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">60</text><text x="183" y="49" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="TimpaniHeavy" font-size="51">Atla nta</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="#B46301" stroke="#B46301" stroke-width="1" stroke-linejoin="round"/><text x="245" y="318" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Arial" font-size="34" font-weight="bold">1455</text><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="12"/><path d="M 269,128 L 343,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 343,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 269,128 L 49,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 49,85" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 123,128 L 343,255" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#FFFFFF" stroke-width="34" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,340" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><path d="M 196,255 L 196,0" fill="none" stroke="#000000" stroke-width="26" stroke-linecap="butt" stroke-linejoin="round"/><circle cx="123" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><circle cx="269" cy="128" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><circle cx="196" cy="255" r="51" fill="#FFFFFF" stroke="#000000" stroke-width="4"/><ellipse rx="38" ry="34" cx="123" cy="297" fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linejoin="round"/><text x="123" y="297" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="Bookman Old Style" font-size="51">70</text><text x="183" y="49" dy="0.3em" fill="#000000" stroke="#000000" text-anchor="middle" font-family="TimpaniHeavy" font-size="51">Atla nta</text><path d=" M 98,0 L 294,0 L 392,170 L 294,340 L 98,340 L 0,170 Z" fill="none" stroke="black" stroke-width="1" stroke-linejoin="round"/></svg>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-28 17:08:35
|
Revision: 1594
http://rails.svn.sourceforge.net/rails/?rev=1594&view=rev
Author: evos
Date: 2011-06-28 17:08:29 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
Added Phase name to Game Status panel
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/rails/game/PhaseManager.java
trunk/18xx/rails/ui/swing/GameStatus.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-28 08:16:12 UTC (rev 1593)
+++ trunk/18xx/LocalisedText.properties 2011-06-28 17:08:29 UTC (rev 1594)
@@ -454,6 +454,7 @@
PaysTo={0} pays {1} to {2}
Payout={0} receives {1} for {2} {3}% shares
PaysForTokens={0} pays {1} to Bank for {2} tokens
+PHASE=Phase
PLAYERS=Players
POOL=Pool
PRES_CERT_NAME={0} {1}% president share
Modified: trunk/18xx/rails/game/PhaseManager.java
===================================================================
--- trunk/18xx/rails/game/PhaseManager.java 2011-06-28 08:16:12 UTC (rev 1593)
+++ trunk/18xx/rails/game/PhaseManager.java 2011-06-28 17:08:29 UTC (rev 1594)
@@ -5,6 +5,7 @@
import org.apache.log4j.Logger;
+import rails.game.model.ModelObject;
import rails.game.state.State;
import rails.util.Tag;
@@ -57,6 +58,10 @@
public PhaseI getCurrentPhase() {
return (PhaseI) currentPhase.get();
}
+
+ public ModelObject getCurrentPhaseModel() {
+ return currentPhase;
+ }
public int getCurrentPhaseIndex() {
return getCurrentPhase().getIndex();
Modified: trunk/18xx/rails/ui/swing/GameStatus.java
===================================================================
--- trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 08:16:12 UTC (rev 1593)
+++ trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 17:08:29 UTC (rev 1594)
@@ -73,6 +73,7 @@
protected Field playerCertCount[];
protected int playerCertCountXOffset, playerCertCountYOffset;
protected int certLimitXOffset, certLimitYOffset;
+ protected int phaseXOffset, phaseYOffset;
protected Field bankCash;
protected int bankCashXOffset, bankCashYOffset;
protected Field poolTrains;
@@ -228,6 +229,8 @@
playerCertCountYOffset = ++lastY;
certLimitXOffset = certInPoolXOffset;
certLimitYOffset = playerCertCountYOffset;
+ phaseXOffset = certInPoolXOffset + 2;
+ phaseYOffset = playerCertCountYOffset;
bankCashXOffset = certInPoolXOffset;
bankCashYOffset = playerPrivatesYOffset;
poolTrainsXOffset = bankCashXOffset + 2;
@@ -489,6 +492,13 @@
certLimitXOffset,
certLimitYOffset, 1, 1, WIDE_TOP, true);
+ // Phase
+ addField(new Caption(LocalText.getText("PHASE")), phaseXOffset - 1,
+ phaseYOffset, 1, 1, WIDE_TOP + WIDE_LEFT, true);
+ addField(new Field(gameUIManager.getGameManager().getPhaseManager().getCurrentPhaseModel()),
+ phaseXOffset,
+ phaseYOffset, 1, 1, WIDE_TOP, true);
+
// Bank
addField(new Caption(LocalText.getText("BANK")), bankCashXOffset - 1,
bankCashYOffset - 1, 1, 2, WIDE_TOP + WIDE_LEFT, true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-06-30 15:19:19
|
Revision: 1595
http://rails.svn.sourceforge.net/rails/?rev=1595&view=rev
Author: evos
Date: 2011-06-30 15:19:12 +0000 (Thu, 30 Jun 2011)
Log Message:
-----------
Implemented 1830 Coalfields right buying option.
It is implemented using a new generic "rights" object. Each company can have a separate set of rights.
To make this work, public company initialization had to be refactored. 'Dummy' companies per type are no longer needed.
New 'Rights' columns have been added to the OR and GameStatus windows if needed. 'Coalfields' is shown for each company that has that right.
Caveat: Undoing a Coalfields right by action does not reset the UI. This cannot be implemented in the usual way as long HashMapState does not extend ModelObject.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/1830/CompanyManager.xml
trunk/18xx/rails/common/GuiDef.java
trunk/18xx/rails/game/CompanyManager.java
trunk/18xx/rails/game/CompanyType.java
trunk/18xx/rails/game/CompanyTypeI.java
trunk/18xx/rails/game/Game.java
trunk/18xx/rails/game/GameManager.java
trunk/18xx/rails/game/GameManagerI.java
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/PublicCompany.java
trunk/18xx/rails/game/PublicCompanyI.java
trunk/18xx/rails/game/special/SpecialProperty.java
trunk/18xx/rails/game/special/SpecialPropertyI.java
trunk/18xx/rails/game/state/HashMapState.java
trunk/18xx/rails/ui/swing/GameStatus.java
trunk/18xx/rails/ui/swing/ORPanel.java
trunk/18xx/rails/util/ListAndFixSavedFiles.java
Added Paths:
-----------
trunk/18xx/rails/game/model/RightsModel.java
trunk/18xx/rails/game/special/SpecialRight.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/LocalisedText.properties 2011-06-30 15:19:12 UTC (rev 1595)
@@ -40,6 +40,7 @@
BUY_WHICH_TRAIN=Buy which train?
# Note: in the next item, {0} MUST be in front
BuyPrivatePrompt={0} from {1} for {2}
+BuyRight=Buy {0} right for {1}
BankIsBrokenDisplayText=Bank is broken. Play continues until {0}
BankIsBrokenReportText=Bank is broken
gameOverPlaySetOfORs=the current set of operating rounds is finished.
@@ -56,6 +57,7 @@
BuysBonusTokenFrom={0} buys a {1} +{2} bonus token from {3} for {4}
BuysItemFor={0} buys {1} for {2}
BuysPrivateFromFor={0} buys private {1} from {2} for {3}
+BuysRight={0} buys the ''{1}'' right for {2}
BuysTrain={0} buys a {1}-train from {2} for {3}.
BuysTrainUsingSP={0} buys a {1}-train from {2} for {3} using {4}.
BYFloatsAt=Bayern floats at
@@ -64,6 +66,7 @@
CanOperate={0} can operate this round
CannotOperate={0} cannot operate this round
CannotBuyAnything={0} cannot buy anything
+CannotBuyRight={1} cannot buy '{1}' right for {2}: {3}
CERT_NAME={0} {1}% share
CLOSE=Close
CloseMinor=Close minor {0}
@@ -526,6 +529,7 @@
RevenueStationsIgnoreMinors=, Cities = {0}
ReceivesFor={0} receives {1} for {2}.
RevenueWithNoTrains={0} owns no trains, so revenue is {1}.
+RIGHTS=Rights
RotateTile=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press the No Tile button.
RouteAwareness=support for tile and token lays
RunsWithBorrowedTrain={0} runs with a borrowed {1}-train and must withhold revenue
Modified: trunk/18xx/data/1830/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1830/CompanyManager.xml 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/data/1830/CompanyManager.xml 2011-06-30 15:19:12 UTC (rev 1595)
@@ -22,6 +22,14 @@
<Certificate shares="1" number="8"/>
<Trains limit="4,4,3,2"/>
<CanUseSpecialProperties/>
+ <IfOption name="Variant" value="Coalfields,Coalfields&Reading">
+ <CanUseSpecialProperties/>
+ <SpecialProperties>
+ <SpecialProperty condition="ifOwnedByCompany" when="orTurn" class="rails.game.special.SpecialRight">
+ <SpecialRight name="Coalfields" cost="140"/>
+ </SpecialProperty>
+ </SpecialProperties>
+ </IfOption>
</CompanyType>
<Company name="SVNRR" type="Private" basePrice="20" revenue="5"
longname="Schuylkill Valley Navigation & Railroad Company">
Modified: trunk/18xx/rails/common/GuiDef.java
===================================================================
--- trunk/18xx/rails/common/GuiDef.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/common/GuiDef.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -37,6 +37,7 @@
CAN_ANY_COMPANY_BUY_PRIVATES,
DO_BONUS_TOKENS_EXIST,
HAS_ANY_COMPANY_LOANS,
+ HAS_ANY_RIGHTS,
NO_MAP_MODE,
REVENUE_SUGGEST,
ROUTE_HIGHLIGHT
Modified: trunk/18xx/rails/game/CompanyManager.java
===================================================================
--- trunk/18xx/rails/game/CompanyManager.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/CompanyManager.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -74,6 +74,9 @@
// Localised here as it has no permanent use
Map<String, CompanyTypeI> mCompanyTypes
= new HashMap<String, CompanyTypeI>();
+
+ //NEW//
+ Map<String, Tag> typeTags = new HashMap<String, Tag>();
for (Tag compTypeTag : tag.getChildren(CompanyTypeI.ELEMENT_ID)) {
// Extract the attributes of the Component
@@ -101,6 +104,8 @@
// Further parsing is done within CompanyType
companyType.configureFromXML(compTypeTag);
+ //NEW//
+ typeTags.put(name, compTypeTag);
}
/* Read and configure the companies */
@@ -125,7 +130,9 @@
}
try {
- CompanyI company = cType.createCompany(name, companyTag);
+ //NEW//CompanyI company = cType.createCompany(name, companyTag);
+ Tag typeTag = typeTags.get(type);
+ CompanyI company = cType.createCompany(name, typeTag, companyTag);
/* Private or public */
if (company instanceof PrivateCompanyI) {
Modified: trunk/18xx/rails/game/CompanyType.java
===================================================================
--- trunk/18xx/rails/game/CompanyType.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/CompanyType.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -24,8 +24,6 @@
protected String className;
protected int capitalisation = PublicCompanyI.CAPITALISE_FULL;
- private CompanyI dummyCompany;
-
protected List<CompanyI> companies = new ArrayList<CompanyI>();
/**
@@ -46,44 +44,26 @@
* @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)
*/
public void configureFromXML(Tag tag) throws ConfigurationException {
-
- /* Create a dummy company implementing this company type */
- try {
- dummyCompany = (Company) Class.forName(className).newInstance();
- } catch (Exception e) {
- throw new ConfigurationException(LocalText.getText(
- "ClassCannotBeInstantiated", className), e);
- }
- dummyCompany.init("", this);
- dummyCompany.configureFromXML(tag);
-
- /*
- * Must be rewritten to a new tag String capitalMode =
- * XmlUtils.extractStringAttribute(nnp, "capitalisation", "full");
- * setCapitalisation(capitalMode);
- */
-
+ //No longer needed.
}
public void finishConfiguration (GameManagerI gameManager) {
}
- public CompanyI createCompany(String name, Tag tag)
- throws ConfigurationException {
+ public CompanyI createCompany(String name, Tag typeTag, Tag tag)
+ throws ConfigurationException {
CompanyI newCompany = null;
try {
- newCompany = (CompanyI) dummyCompany.clone();
- if (newCompany == null) {
- throw new ConfigurationException("Cannot clone company " + name);
- }
- newCompany.init(name, this);
- newCompany.configureFromXML(tag);
- companies.add(newCompany);
- } catch (CloneNotSupportedException e) {
- DisplayBuffer.add(LocalText.getText("CantCloneCompany",
- name, this.name ));
+ newCompany = (Company) Class.forName(className).newInstance();
+ } catch (Exception e) {
+ throw new ConfigurationException(LocalText.getText(
+ "ClassCannotBeInstantiated", className), e);
}
+ newCompany.init(name, this);
+ newCompany.configureFromXML(typeTag);
+ newCompany.configureFromXML(tag);
+ companies.add(newCompany);
return newCompany;
}
@@ -126,7 +106,4 @@
return capitalisation;
}
- public CompanyI getDummyCompany() {
- return dummyCompany;
- }
}
Modified: trunk/18xx/rails/game/CompanyTypeI.java
===================================================================
--- trunk/18xx/rails/game/CompanyTypeI.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/CompanyTypeI.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -28,7 +28,7 @@
// public void configureFromXML(Element el) throws ConfigurationException;
- public CompanyI createCompany(String name, Tag tag)
+ public CompanyI createCompany(String name, Tag typeTag, Tag tag)
throws ConfigurationException;
/**
@@ -48,6 +48,4 @@
public void setCapitalisation(String mode);
public int getCapitalisation();
-
- public CompanyI getDummyCompany();
}
\ No newline at end of file
Modified: trunk/18xx/rails/game/Game.java
===================================================================
--- trunk/18xx/rails/game/Game.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/Game.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -258,13 +258,14 @@
return null;
}
GameManagerI gameManager = game.getGameManager();
- int numberOfActions = 0;
log.debug("Starting to execute loaded actions");
gameManager.setReloading(true);
Object actionObject = null;
+ int actionIndex = 0;
+
while (true) { // Single-pass loop.
try {
actionObject = ois.readObject();
@@ -276,8 +277,8 @@
// Old-style: one List of PossibleActions
List<PossibleAction> executedActions =
(List<PossibleAction>) actionObject;
- numberOfActions = executedActions.size();
for (PossibleAction action : executedActions) {
+ ++actionIndex;
try {
if (!gameManager.processOnReload(action)) {
log.error ("Load interrupted");
@@ -285,14 +286,14 @@
break;
}
} catch (Exception e) {
- log.fatal("Action '"+action+"' reload exception", e);
+ log.fatal("Action "+actionIndex+" '"+action+"' reload exception", e);
throw new Exception ("Reload exception", e);
}
}
} else if (actionObject instanceof PossibleAction) {
// New style: separate PossibleActionsObjects, since Rails 1.3.1
while (actionObject instanceof PossibleAction) {
- numberOfActions++;
+ ++actionIndex;
try {
if (!gameManager.processOnReload((PossibleAction)actionObject)) {
log.error ("Load interrupted");
@@ -300,7 +301,7 @@
break;
}
} catch (Exception e) {
- log.fatal("Action '"+((PossibleAction)actionObject).toString()
+ log.fatal("Action "+actionIndex+" '"+((PossibleAction)actionObject).toString()
+"' reload exception", e);
throw new Exception ("Reload exception", e);
}
Modified: trunk/18xx/rails/game/GameManager.java
===================================================================
--- trunk/18xx/rails/game/GameManager.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/GameManager.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -1706,6 +1706,10 @@
return false;
}
}
+
+ public void setGuiParameter (GuiDef.Parm key, boolean value) {
+ guiParameters.put (key, value);
+ }
public void setGameParameter (GameDef.Parm key, Object value) {
gameParameters.put(key, value);
Modified: trunk/18xx/rails/game/GameManagerI.java
===================================================================
--- trunk/18xx/rails/game/GameManagerI.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/GameManagerI.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -188,6 +188,7 @@
public abstract String getClassName(GuiDef.ClassName key);
+ public void setGuiParameter (GuiDef.Parm key, boolean value);
public abstract Object getGuiParameter(GuiDef.Parm key);
public Object getGameParameter (GameDef.Parm key);
public void setGameParameter (GameDef.Parm key, Object value);
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -241,6 +241,11 @@
} else if (selectedAction instanceof ClosePrivate) {
result = executeClosePrivate((ClosePrivate)selectedAction);
+
+ } else if (selectedAction instanceof UseSpecialProperty
+ && ((UseSpecialProperty)selectedAction).getSpecialProperty() instanceof SpecialRight) {
+
+ result = buyRight ((UseSpecialProperty)selectedAction);
} else if (selectedAction instanceof NullAction) {
@@ -2305,6 +2310,44 @@
return numberOfLoans * operatingCompany.get().getValuePerLoan();
}
+ protected boolean buyRight (UseSpecialProperty action) {
+
+ String errMsg = null;
+
+ SpecialPropertyI sp = action.getSpecialProperty();
+ if (!(sp instanceof SpecialRight)) {
+ errMsg = "Wrong right property class: "+sp.toString();
+ }
+
+ SpecialRight right = (SpecialRight) sp;
+ String rightName = right.getName();
+ String rightValue = right.getValue();
+
+ if (errMsg != null) {
+ DisplayBuffer.add(LocalText.getText("CannotBuyRight",
+ action.getCompanyName(),
+ rightName,
+ Bank.format(right.getCost()),
+ errMsg));
+
+ return false;
+ }
+
+ moveStack.start(true);
+
+ operatingCompany.get().setRight(rightName, rightValue);
+ new CashMove (operatingCompany.get(), bank, right.getCost());
+
+ ReportBuffer.add(LocalText.getText("BuysRight",
+ operatingCompany.get().getName(),
+ rightName,
+ Bank.format(right.getCost())));
+
+ sp.setExercised();
+
+ return true;
+ }
+
/*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/
/**
@@ -2486,10 +2529,13 @@
// Are there other step-independent special properties owned by the company?
List<SpecialPropertyI> orsps = operatingCompany.get().getPortfolio().getAllSpecialProperties();
+ List<SpecialPropertyI> compsps = operatingCompany.get().getSpecialProperties();
+ if (compsps != null) orsps.addAll(compsps);
+
if (orsps != null) {
for (SpecialPropertyI sp : orsps) {
if (!sp.isExercised() && sp.isUsableIfOwnedByCompany()
- && sp.isUsableDuringOR()) {
+ && sp.isUsableDuringOR(step)) {
if (sp instanceof SpecialTokenLay) {
if (getStep() != GameDef.OrStep.LAY_TOKEN) {
possibleActions.add(new LayBaseToken((SpecialTokenLay)sp));
@@ -2505,7 +2551,7 @@
if (orsps != null) {
for (SpecialPropertyI sp : orsps) {
if (!sp.isExercised() && sp.isUsableIfOwnedByPlayer()
- && sp.isUsableDuringOR()) {
+ && sp.isUsableDuringOR(step)) {
if (sp instanceof SpecialTokenLay) {
if (getStep() != GameDef.OrStep.LAY_TOKEN) {
possibleActions.add(new LayBaseToken((SpecialTokenLay)sp));
Modified: trunk/18xx/rails/game/PublicCompany.java
===================================================================
--- trunk/18xx/rails/game/PublicCompany.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/PublicCompany.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -4,11 +4,11 @@
import java.awt.Color;
import java.util.*;
+import rails.common.GuiDef;
import rails.game.action.SetDividend;
import rails.game.model.*;
import rails.game.move.*;
-import rails.game.special.SellBonusToken;
-import rails.game.special.SpecialPropertyI;
+import rails.game.special.*;
import rails.game.state.*;
import rails.util.*;
@@ -274,6 +274,11 @@
protected Bank bank;
protected StockMarketI stockMarket;
protected MapManager mapManager;
+
+ /** Rights */
+ protected HashMapState<String, String> rights = null;
+ protected RightsModel rightsModel = new RightsModel();
+
/**
* The constructor. The way this class is instantiated does not allow
@@ -607,6 +612,7 @@
("mustTradeTrainsAtFixedPrice", mustTradeTrainsAtFixedPrice);
canClose = optionsTag.getAttributeAsBoolean("canClose", canClose);
}
+
}
/** Initialisation, to be called directly after instantiation (cloning) */
@@ -652,29 +658,8 @@
canSharePriceVary = new BooleanState (name+"_CanSharePriceVary", true);
}
- if (turnsWithExtraTileLaysInit != null) {
- turnsWithExtraTileLays = new HashMap<String, IntegerState>();
- for (String colour : turnsWithExtraTileLaysInit.keySet()) {
- turnsWithExtraTileLays.put(colour, new IntegerState(
- name + "_" + colour + "_ExtraTileTurns",
- turnsWithExtraTileLaysInit.get(colour)));
- }
- }
+ }
- PublicCompanyI dummyCompany = (PublicCompanyI) type.getDummyCompany();
- if (dummyCompany != null) {
- fgHexColour = dummyCompany.getHexFgColour();
- bgHexColour = dummyCompany.getHexBgColour();
- }
-
- if (maxNumberOfLoans != 0) {
- currentNumberOfLoans = new IntegerState (name+"_Loans", 0);
- currentLoanValue = new MoneyModel (name+"_LoanValue", 0);
- currentLoanValue.setOption(MoneyModel.SUPPRESS_ZERO);
- }
-
- }
-
public void setIndex (int index) {
publicNumber = index;
}
@@ -690,6 +675,21 @@
stockMarket = gameManager.getStockMarket();
mapManager = gameManager.getMapManager();
+ if (turnsWithExtraTileLaysInit != null) {
+ turnsWithExtraTileLays = new HashMap<String, IntegerState>();
+ for (String colour : turnsWithExtraTileLaysInit.keySet()) {
+ turnsWithExtraTileLays.put(colour, new IntegerState(
+ name + "_" + colour + "_ExtraTileTurns",
+ turnsWithExtraTileLaysInit.get(colour)));
+ }
+ }
+
+ if (maxNumberOfLoans != 0) {
+ currentNumberOfLoans = new IntegerState (name+"_Loans", 0);
+ currentLoanValue = new MoneyModel (name+"_LoanValue", 0);
+ currentLoanValue.setOption(MoneyModel.SUPPRESS_ZERO);
+ }
+
if (hasStockPrice && Util.hasValue(startSpace)) {
parPrice.setPrice(stockMarket.getStockSpace(
startSpace));
@@ -756,6 +756,15 @@
infoText += parentInfoText;
parentInfoText = "";
+
+ // Can companies acquire special rights (such as in 1830 Coalfields)?
+ if (specialProperties != null) {
+ for (SpecialPropertyI sp : specialProperties) {
+ if (sp instanceof SpecialRight) {
+ gameManager.setGuiParameter (GuiDef.Parm.HAS_ANY_RIGHTS, true);
+ }
+ }
+ }
}
/** Reset turn objects */
@@ -1973,11 +1982,32 @@
public MoneyModel getLoanValueModel () {
return currentLoanValue;
}
+
+ public RightsModel getRightsModel () {
+ return rightsModel;
+ }
public boolean canClose() {
return canClose;
}
-
+
+ public void setRight (String nameOfRight, String value) {
+ if (rights == null) {
+ rights = new HashMapState<String, String>(name+"_Rights");
+ rightsModel.init (rights);
+ }
+ rights.put(nameOfRight, value);
+ rightsModel.update();
+ }
+
+ public boolean hasRight (String nameOfRight) {
+ return rights != null && rights.hasKey(nameOfRight);
+ }
+
+ public String getRight (String nameOfRight) {
+ return rights != null ? rights.get(nameOfRight) : null;
+ }
+
@Override
public Object clone() {
@@ -1996,6 +2026,9 @@
if (certificates != null) {
((PublicCompanyI) clone).setCertificates(certificates);
}
+ if (specialProperties != null) {
+ ((PublicCompany) clone).specialProperties = new ArrayList<SpecialPropertyI>(specialProperties);
+ }
return clone;
}
Modified: trunk/18xx/rails/game/PublicCompanyI.java
===================================================================
--- trunk/18xx/rails/game/PublicCompanyI.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/PublicCompanyI.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -342,10 +342,15 @@
public int getMaxLoansPerRound();
public int getValuePerLoan();
public MoneyModel getLoanValueModel ();
+ public RightsModel getRightsModel ();
public int sharesOwnedByPlayers();
public String getExtraShareMarks ();
+ public void setRight (String nameOfRight, String value);
+ public boolean hasRight (String nameOfRight);
+ public String getRight (String nameOfRight);
+
public ModelObject getInGameModel ();
public ModelObject getIsClosedModel ();
Added: trunk/18xx/rails/game/model/RightsModel.java
===================================================================
--- trunk/18xx/rails/game/model/RightsModel.java (rev 0)
+++ trunk/18xx/rails/game/model/RightsModel.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -0,0 +1,37 @@
+/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/model/RightsModel.java,v 1.6 2008/06/04 19:00:37 evos Exp $*/
+package rails.game.model;
+
+import rails.game.state.HashMapState;
+import tools.Util;
+
+public class RightsModel extends ModelObject {
+
+ private HashMapState<String, String> rights;
+
+ public RightsModel() {
+ }
+
+ /** Split off from the constructor to allow the rights map to exist only if needed */
+ public void init (HashMapState<String, String> rights) {
+ this.rights = rights;
+ }
+
+ public String getText() {
+
+ if (rights == null) return "";
+
+ StringBuilder buf = new StringBuilder("<html>");
+ for (String name : rights.viewKeySet()) {
+ if (buf.length() > 6) buf.append("<br>");
+ buf.append(name);
+ String value = rights.get(name);
+ if (Util.hasValue(value)) buf.append("=").append(value);
+ }
+ if (buf.length() > 6) {
+ buf.append("</html>");
+ }
+ return buf.toString();
+
+ }
+
+}
Property changes on: trunk/18xx/rails/game/model/RightsModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/18xx/rails/game/special/SpecialProperty.java
===================================================================
--- trunk/18xx/rails/game/special/SpecialProperty.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/special/SpecialProperty.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -169,8 +169,18 @@
}
- public boolean isUsableDuringOR() {
- return usableDuringOR;
+ public boolean isUsableDuringOR(GameDef.OrStep step) {
+
+ if (usableDuringOR) return true;
+
+ switch (step) {
+ case LAY_TRACK:
+ return usableDuringTileLayingStep;
+ case LAY_TOKEN:
+ return usableDuringTokenLayingStep;
+ default:
+ return false;
+ }
}
public void setUsableDuringOR(boolean usableDuringOR) {
Modified: trunk/18xx/rails/game/special/SpecialPropertyI.java
===================================================================
--- trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/special/SpecialPropertyI.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -1,8 +1,7 @@
/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialPropertyI.java,v 1.12 2010/03/16 21:21:59 evos Exp $ */
package rails.game.special;
-import rails.game.CompanyI;
-import rails.game.ConfigurableComponentI;
+import rails.game.*;
import rails.game.move.Moveable;
import rails.game.move.MoveableHolder;
@@ -25,7 +24,7 @@
public void setUsableIfOwnedByPlayer(boolean usableIfOwnedByPlayer);
- public boolean isUsableDuringOR();
+ public boolean isUsableDuringOR(GameDef.OrStep step);
public void setUsableDuringOR(boolean usableDuringOR);
Added: trunk/18xx/rails/game/special/SpecialRight.java
===================================================================
--- trunk/18xx/rails/game/special/SpecialRight.java (rev 0)
+++ trunk/18xx/rails/game/special/SpecialRight.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -0,0 +1,76 @@
+/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialRight.java,v 1.19 2010/05/05 21:37:18 evos Exp $ */
+package rails.game.special;
+
+import rails.game.*;
+import rails.util.*;
+
+public class SpecialRight extends SpecialProperty {
+
+ /** The public company of which a share can be obtained. */
+ protected String rightName;
+ protected String rightDefaultValue;
+ protected String rightValue;
+ protected int cost;
+
+ @Override
+ public void configureFromXML(Tag tag) throws ConfigurationException {
+
+ super.configureFromXML(tag);
+
+ Tag rightTag = tag.getChild("SpecialRight");
+ if (rightTag == null) {
+ throw new ConfigurationException("<SpecialRight> tag missing");
+ }
+
+ rightName = rightTag.getAttributeAsString("name");
+ if (!Util.hasValue(rightName))
+ throw new ConfigurationException(
+ "SpecialRight: no Right name specified");
+
+ rightDefaultValue = rightValue = rightTag.getAttributeAsString("defaultValue", null);
+
+ cost = rightTag.getAttributeAsInteger("cost", 0);
+ }
+
+ public boolean isExecutionable() {
+
+ return originalCompany.getPortfolio().getOwner() instanceof Player;
+ }
+
+
+ public String getName() {
+ return rightName;
+ }
+
+ public String getDefaultValue() {
+ return rightDefaultValue;
+ }
+
+ public String getValue() {
+ return rightValue;
+ }
+
+ public void setValue(String rightValue) {
+ this.rightValue = rightValue;
+ }
+
+ public int getCost() {
+ return cost;
+ }
+
+ @Override
+ public String toString() {
+ return "Buy '" + rightName + "' right for " + Bank.format(cost);
+ }
+
+ @Override
+ public String toMenu() {
+ return LocalText.getText("BuyRight",
+ rightName,
+ Bank.format(cost));
+ }
+
+ public String getInfo() {
+ return toMenu();
+ }
+}
Property changes on: trunk/18xx/rails/game/special/SpecialRight.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/18xx/rails/game/state/HashMapState.java
===================================================================
--- trunk/18xx/rails/game/state/HashMapState.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/game/state/HashMapState.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -59,6 +59,10 @@
new RemoveFromMap<K,V>(map, key);
}
+ public boolean hasKey(K key) {
+ return map.containsKey(key);
+ }
+
public void clear() {
// Two-step process to avoid concurrent modification exception
List<K> keys = new ArrayList<K>();
Modified: trunk/18xx/rails/ui/swing/GameStatus.java
===================================================================
--- trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-28 17:08:29 UTC (rev 1594)
+++ trunk/18xx/rails/ui/swing/GameStatus.java 2011-06-30 15:19:12 UTC (rev 1595)
@@ -61,6 +61,8 @@
protected int compPrivatesXOffset, compPrivatesYOffset;
protected Field compLoans[];
protected int compLoansXOffset, compLoansYOffset;
+ protected int rightsXOffset, rightsYOffset;
+ protected Field rights[];
protected Field playerCash[];
protected ClickField playerCashButton[];
protected int playerCashXOffset, playerCas...
[truncated message content] |
|
From: <wak...@us...> - 2011-07-03 20:06:48
|
Revision: 1598
http://rails.svn.sourceforge.net/rails/?rev=1598&view=rev
Author: wakko666
Date: 2011-07-03 20:06:38 +0000 (Sun, 03 Jul 2011)
Log Message:
-----------
Refactor GameInfo XML parsing
Modified Paths:
--------------
trunk/18xx/data/GamesList.xml
trunk/18xx/rails/algorithms/RevenueAdapter.java
trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
trunk/18xx/rails/algorithms/RevenueManager.java
trunk/18xx/rails/algorithms/RevenueTrainRun.java
trunk/18xx/rails/game/Bank.java
trunk/18xx/rails/game/BonusToken.java
trunk/18xx/rails/game/Company.java
trunk/18xx/rails/game/CompanyManager.java
trunk/18xx/rails/game/CompanyType.java
trunk/18xx/rails/game/CompanyTypeI.java
trunk/18xx/rails/game/ComponentManager.java
trunk/18xx/rails/game/ConfigurableComponentI.java
trunk/18xx/rails/game/EndOfGameRound.java
trunk/18xx/rails/game/Game.java
trunk/18xx/rails/game/GameManager.java
trunk/18xx/rails/game/MapHex.java
trunk/18xx/rails/game/MapManager.java
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/Phase.java
trunk/18xx/rails/game/PhaseManager.java
trunk/18xx/rails/game/PlayerManager.java
trunk/18xx/rails/game/Portfolio.java
trunk/18xx/rails/game/PrivateCompany.java
trunk/18xx/rails/game/PublicCertificate.java
trunk/18xx/rails/game/PublicCompany.java
trunk/18xx/rails/game/ReportBuffer.java
trunk/18xx/rails/game/Round.java
trunk/18xx/rails/game/ShareSellingRound.java
trunk/18xx/rails/game/StartPacket.java
trunk/18xx/rails/game/StartRound.java
trunk/18xx/rails/game/StartRound_1830.java
trunk/18xx/rails/game/StartRound_1835.java
trunk/18xx/rails/game/StockMarket.java
trunk/18xx/rails/game/StockRound.java
trunk/18xx/rails/game/StockSpaceType.java
trunk/18xx/rails/game/Tile.java
trunk/18xx/rails/game/TileI.java
trunk/18xx/rails/game/TileManager.java
trunk/18xx/rails/game/TrainCertificateType.java
trunk/18xx/rails/game/TrainManager.java
trunk/18xx/rails/game/TrainType.java
trunk/18xx/rails/game/TreasuryShareRound.java
trunk/18xx/rails/game/action/LayBonusToken.java
trunk/18xx/rails/game/correct/CashCorrectionManager.java
trunk/18xx/rails/game/correct/CorrectionManager.java
trunk/18xx/rails/game/correct/CorrectionModeAction.java
trunk/18xx/rails/game/correct/MapCorrectionManager.java
trunk/18xx/rails/game/move/MoveStack.java
trunk/18xx/rails/game/special/ExchangeForShare.java
trunk/18xx/rails/game/special/LocatedBonus.java
trunk/18xx/rails/game/special/SellBonusToken.java
trunk/18xx/rails/game/special/SpecialProperty.java
trunk/18xx/rails/game/special/SpecialRight.java
trunk/18xx/rails/game/special/SpecialTileLay.java
trunk/18xx/rails/game/special/SpecialTokenLay.java
trunk/18xx/rails/game/special/SpecialTrainBuy.java
trunk/18xx/rails/game/specific/_1825/StartRound_1825.java
trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java
trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java
trunk/18xx/rails/game/specific/_1835/StockRound_1835.java
trunk/18xx/rails/game/specific/_1851/StartRound_1851.java
trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java
trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java
trunk/18xx/rails/game/specific/_1856/PublicCompany_CGR.java
trunk/18xx/rails/game/specific/_1856/StockRound_1856.java
trunk/18xx/rails/game/specific/_1880/StartRound_1880.java
trunk/18xx/rails/game/specific/_1880/StockRound_1880.java
trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java
trunk/18xx/rails/game/specific/_18AL/NameTrains.java
trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java
trunk/18xx/rails/game/specific/_18AL/NamedTrainToken.java
trunk/18xx/rails/game/specific/_18AL/OperatingRound_18AL.java
trunk/18xx/rails/game/specific/_18EU/FinalMinorExchangeRound.java
trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java
trunk/18xx/rails/game/specific/_18EU/OperatingRound_18EU.java
trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java
trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java
trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java
trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java
trunk/18xx/rails/game/specific/_18Kaas/RuhrRevenueModifier.java
trunk/18xx/rails/test/GameTest.java
trunk/18xx/rails/ui/swing/AbstractReportWindow.java
trunk/18xx/rails/ui/swing/AutoSaveLoadDialog.java
trunk/18xx/rails/ui/swing/ConfigWindow.java
trunk/18xx/rails/ui/swing/GameSetupWindow.java
trunk/18xx/rails/ui/swing/GameStatus.java
trunk/18xx/rails/ui/swing/GameUIManager.java
trunk/18xx/rails/ui/swing/ImageLoader.java
trunk/18xx/rails/ui/swing/ORPanel.java
trunk/18xx/rails/ui/swing/ORUIManager.java
trunk/18xx/rails/ui/swing/ORWindow.java
trunk/18xx/rails/ui/swing/RemainingTilesWindow.java
trunk/18xx/rails/ui/swing/ReportWindow.java
trunk/18xx/rails/ui/swing/ReportWindowDynamic.java
trunk/18xx/rails/ui/swing/Scale.java
trunk/18xx/rails/ui/swing/StartRoundWindow.java
trunk/18xx/rails/ui/swing/StatusWindow.java
trunk/18xx/rails/ui/swing/UpgradesPanel.java
trunk/18xx/rails/ui/swing/WindowSettings.java
trunk/18xx/rails/ui/swing/elements/CheckBoxDialog.java
trunk/18xx/rails/ui/swing/elements/ConfirmationDialog.java
trunk/18xx/rails/ui/swing/elements/MessageDialog.java
trunk/18xx/rails/ui/swing/elements/RadioButtonDialog.java
trunk/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java
trunk/18xx/rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java
trunk/18xx/rails/ui/swing/gamespecific/_18AL/NameTrainsDialog.java
trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java
trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameUIManager_18EU.java
trunk/18xx/rails/ui/swing/gamespecific/_18EU/StatusWindow_18EU.java
trunk/18xx/rails/ui/swing/hexmap/HexMap.java
trunk/18xx/rails/ui/swing/hexmap/HexMapImage.java
trunk/18xx/rails/util/ListAndFixSavedFiles.java
trunk/18xx/rails/util/RunGame.java
trunk/18xx/rails/util/Util.java
trunk/18xx/test/TestGame.java
trunk/18xx/test/TestGameBuilder.java
trunk/18xx/tools/ConvertTilesXML.java
trunk/18xx/tools/MakeGameTileSets.java
trunk/18xx/tools/XmlUtils.java
Added Paths:
-----------
trunk/18xx/rails/common/LocalText.java
trunk/18xx/rails/common/MoneyFormatter.java
trunk/18xx/rails/common/ResourceLoader.java
trunk/18xx/rails/common/parser/
trunk/18xx/rails/common/parser/Config.java
trunk/18xx/rails/common/parser/ConfigItem.java
trunk/18xx/rails/common/parser/ConfigurationException.java
trunk/18xx/rails/common/parser/GameInfo.java
trunk/18xx/rails/common/parser/GameInfoParser.java
trunk/18xx/rails/common/parser/GameOption.java
trunk/18xx/rails/common/parser/Tag.java
trunk/18xx/rails/common/parser/XMLParser.java
trunk/18xx/rails/common/parser/XMLTags.java
Removed Paths:
-------------
trunk/18xx/rails/game/ConfigurationException.java
trunk/18xx/rails/game/GameOption.java
trunk/18xx/rails/game/GamesInfo.java
trunk/18xx/rails/util/Config.java
trunk/18xx/rails/util/ConfigItem.java
trunk/18xx/rails/util/Format.java
trunk/18xx/rails/util/LocalText.java
trunk/18xx/rails/util/ResourceLoader.java
trunk/18xx/rails/util/Tag.java
Modified: trunk/18xx/data/GamesList.xml
===================================================================
--- trunk/18xx/data/GamesList.xml 2011-06-30 18:56:00 UTC (rev 1597)
+++ trunk/18xx/data/GamesList.xml 2011-07-03 20:06:38 UTC (rev 1598)
@@ -318,17 +318,33 @@
</Game>
- <Credits>Rails is a computer implementation of a number of railroad board games,
-that are collectively known as the "18xx" railway game system.
-Rails is a Sourceforge project.
-Project founder: Brett Lentz.
-Developers: Erik Vos, Stefan Frey and Brett Lentz.
+ <Credits>Rails is a computer implementation of a number of board games.
+ These games all have a railroad theme. They are collectively known as "18xx"
+ games due to the naming scheme used by many games in the genre.
-The 18xx railway game system was originated by Francis Tresham and Hartland Trefoil Ltd.
+Contributors:
+ Erik Vos
+ Stefan Frey
+ Freek Dijkstra
+ Scott Peterson
+ Adam Badura
+ Phil Davies
+ Bill Rosgen
+ Martin Brumm
+ Chris Shaffer
+ Brett Lentz
All rights reserved by the respective owners of the original games
(see the Game Notes per game for specific acknowledgements).
-No challenge to their status is intended.
+
+No challenge to the original author's or publisher's rights, licensing, or status is intended.
+
Rails is intended as a play aid for owners of each respective boardgame.
+
+The Rails application and source code are distributed under
+version 2 of the GNU Public License (GPL).
+
+A copy of the GPL should have been shipped with the game files and is also available here:
+ http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
</Credits>
</GamesList>
Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-06-30 18:56:00 UTC (rev 1597)
+++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -17,6 +17,7 @@
import org.jgrapht.Graphs;
import org.jgrapht.graph.SimpleGraph;
+import rails.common.LocalText;
import rails.game.GameManagerI;
import rails.game.MapHex;
import rails.game.PhaseI;
@@ -24,7 +25,6 @@
import rails.game.TrainI;
import rails.game.TrainType;
import rails.ui.swing.hexmap.HexMap;
-import rails.util.LocalText;
public final class RevenueAdapter implements Runnable {
Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-06-30 18:56:00 UTC (rev 1597)
+++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -5,15 +5,15 @@
import org.apache.log4j.Logger;
+import rails.common.parser.ConfigurationException;
+import rails.common.parser.Tag;
import rails.game.ConfigurableComponentI;
-import rails.game.ConfigurationException;
import rails.game.GameManagerI;
import rails.game.MapHex;
import rails.game.PhaseI;
import rails.game.PhaseManager;
import rails.game.TrainManager;
import rails.game.TrainType;
-import rails.util.Tag;
/**
* defines a template for a revenue bonus at creation time of rails objects
Modified: trunk/18xx/rails/algorithms/RevenueManager.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueManager.java 2011-06-30 18:56:00 UTC (rev 1597)
+++ trunk/18xx/rails/algorithms/RevenueManager.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -7,12 +7,12 @@
import org.apache.log4j.Logger;
+import rails.common.LocalText;
+import rails.common.parser.ConfigurationException;
+import rails.common.parser.Tag;
import rails.game.ConfigurableComponentI;
-import rails.game.ConfigurationException;
import rails.game.GameManagerI;
import rails.game.state.ArrayListState;
-import rails.util.LocalText;
-import rails.util.Tag;
/**
* Coordinates and stores all elements related to revenue calulcation,
Modified: trunk/18xx/rails/algorithms/RevenueTrainRun.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-06-30 18:56:00 UTC (rev 1597)
+++ trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -12,8 +12,8 @@
import rails.algorithms.NetworkVertex.StationType;
import rails.algorithms.NetworkVertex.VertexType;
+import rails.common.LocalText;
import rails.ui.swing.hexmap.HexMap;
-import rails.util.LocalText;
/**
* Links the results from the revenue calculator to the rails program
Copied: trunk/18xx/rails/common/LocalText.java (from rev 1597, trunk/18xx/rails/util/LocalText.java)
===================================================================
--- trunk/18xx/rails/common/LocalText.java (rev 0)
+++ trunk/18xx/rails/common/LocalText.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -0,0 +1,153 @@
+/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/LocalText.java,v 1.7 2010/03/23 18:45:16 stefanfrey Exp $*/
+package rails.common;
+
+import java.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.log4j.Logger;
+
+import rails.common.parser.Config;
+import rails.util.Util;
+
+public class LocalText extends ResourceBundle {
+
+ private static final String TEST_LOCALE = "te_ST";
+
+ protected static String language = "en";
+
+ protected static String country = "";
+
+ protected static String localeCode = language;
+
+ protected static Locale locale;
+
+ protected static ResourceBundle localisedText;
+
+ protected static Logger log =
+ Logger.getLogger(LocalText.class.getPackage().getName());
+
+ public static String getText(String key) {
+ return getText(key, (Object[]) null);
+ }
+
+ public static String getText(String key, Object parameter) {
+ return getText(key, new Object[] { parameter });
+ }
+
+ public static String getText(String key, Object... parameters) {
+ /* If the text is not found, return the key in brackets */
+ return getTextExecute(key, "<" + key + ">", true, parameters);
+ }
+
+ public static String getTextWithDefault(String key, String defaultText) {
+ return getTextExecute(key, defaultText, false, (Object[]) null);
+ }
+
+ // actual procedure to retrieve the local text
+ private static String getTextExecute(String key, String defaultText, boolean errorOnMissing, Object... parameters) {
+ String result = "";
+
+ if (key == null || key.length() == 0) return "";
+
+ /* Load the texts */
+ if (localisedText == null) {
+ /*
+ * Check what locale has been configured, if any. If not, we use the
+ * default assigned above.
+ */
+ String item;
+ if (Util.hasValue(item = Config.get("language"))) {
+ language = item.toLowerCase();
+ }
+ if (Util.hasValue(item = Config.get("country"))) {
+ country = item.toUpperCase();
+ localeCode = language + "_" + country;
+ }
+ if (Util.hasValue(item = Config.get("locale"))) {
+ localeCode = item;
+ if (localeCode.length() >= 2)
+ language = localeCode.substring(0, 2);
+ if (localeCode.length() >= 5)
+ country = localeCode.substring(3, 5);
+ }
+ log.debug("Language=" + language + ", country=" + country
+ + ", locale=" + localeCode);
+
+ /* Create the locale and get the resource bundle. */
+ locale = new Locale(language, country);
+
+ try {
+ localisedText =
+ ResourceBundle.getBundle("LocalisedText", locale);
+ } catch (MissingResourceException e) {
+ System.err.println("Unable to locate LocalisedText resource: "
+ + e);
+ }
+ }
+
+ /* If the key contains a space, something is wrong, check who did that! */
+ if (key.indexOf(" ") > -1) {
+ try {
+ throw new Exception("Invalid resource key '" + key + "'");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // special treatment for test locale
+ if (localeCode.equals(TEST_LOCALE)) {
+ StringBuffer s = new StringBuffer(key);
+ if (parameters != null)
+ for (Object o:parameters)
+ s.append("," + o.toString());
+ return s.toString();
+ }
+
+ /* Find the text */
+ try {
+ result = localisedText.getString(key);
+ } catch (Exception e) {
+ if (errorOnMissing) {
+ System.out.println("Missing text for key " + key + " in locale "
+ + locale.getDisplayName() + " (" + localeCode
+ + ")");
+ }
+ return defaultText;
+ }
+
+ if (parameters != null) {
+ result = MessageFormat.format(result, parameters);
+ }
+
+ return result;
+
+ }
+
+ public static void setLocale(String localeCode) {
+
+ LocalText.localeCode = localeCode;
+ String[] codes = localeCode.split("_");
+ if (codes.length > 0) language = codes[0];
+ if (codes.length > 1) country = codes[1];
+
+ // reset localised text
+ localisedText = null;
+ }
+
+ public Enumeration<String> getKeys() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ protected Object handleGetObject(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Copied: trunk/18xx/rails/common/MoneyFormatter.java (from rev 1597, trunk/18xx/rails/util/Format.java)
===================================================================
--- trunk/18xx/rails/common/MoneyFormatter.java (rev 0)
+++ trunk/18xx/rails/common/MoneyFormatter.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -0,0 +1,30 @@
+/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/Format.java,v 1.3 2008/06/04 19:00:39 evos Exp $*/
+package rails.common;
+
+import rails.common.parser.Config;
+import rails.util.Util;
+
+public class MoneyFormatter {
+
+ private static final String DEFAULT_MONEY_FORMAT = "$@";
+ private static String moneyFormat = null;
+ static {
+ String configFormat = Config.get("money_format");
+ if (Util.hasValue(configFormat) && configFormat.matches(".*@.*")) {
+ moneyFormat = configFormat;
+ }
+ }
+
+ /* This class is never instantiated */
+ private MoneyFormatter() {}
+
+ public static String money(int amount) {
+ if (moneyFormat == null) moneyFormat = DEFAULT_MONEY_FORMAT;
+ return moneyFormat.replaceFirst("@", String.valueOf(amount));
+ }
+
+ public static void setMoneyFormat(String format) {
+ moneyFormat = format;
+ }
+
+}
Copied: trunk/18xx/rails/common/ResourceLoader.java (from rev 1597, trunk/18xx/rails/util/ResourceLoader.java)
===================================================================
--- trunk/18xx/rails/common/ResourceLoader.java (rev 0)
+++ trunk/18xx/rails/common/ResourceLoader.java 2011-07-03 20:06:38 UTC (rev 1598)
@@ -0,0 +1,581 @@
+/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $*/
+package rails.common;
+
+import java.awt.Font;
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.net.Socket;
+import java.util.*;
+
+import javax.swing.text.*;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Class ResourceLoader is an utility class to load a resource from a filename
+ * and a list of directory.
+ *
+ * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $
+ * @author Romain Dolbeau
+ * @author David Ripton
+ */
+
+public final class ResourceLoader {
+
+ /**
+ * Class ColossusClassLoader allows for class loading outside the CLASSPATH,
+ * i.e. from the various variant directories.
+ *
+ * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $
+ * @author Romain Dolbeau
+ */
+ private static class RailsClassLoader extends ClassLoader {
+ List<String> directories = null;
+
+ protected static Logger log =
+ Logger.getLogger(RailsClassLoader.class.getPackage().getName());
+
+ RailsClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ RailsClassLoader() {
+ super();
+ }
+
+ @Override
+ public Class<?> findClass(String className)
+ throws ClassNotFoundException {
+ try {
+ int index = className.lastIndexOf(".");
+ String shortClassName = className.substring(index + 1);
+ if (index == -1) {
+ log.error("Loading of class \"" + className
+ + "\" failed (no dot in class name)");
+ return null;
+ }
+ InputStream classDataIS =
+ getInputStream(shortClassName + ".class", directories);
+ if (classDataIS == null) {
+ log.error("Couldn't find the class file anywhere ! ("
+ + shortClassName + ".class)");
+ throw new FileNotFoundException("missing " + shortClassName
+ + ".class");
+ }
+ byte[] classDataBytes = new byte[classDataIS.available()];
+ classDataIS.read(classDataBytes);
+ return defineClass(className, classDataBytes, 0,
+ classDataBytes.length);
+ } catch (Exception e) {
+ return super.findClass(className);
+ }
+ }
+
+ void setDirectories(List<String> d) {
+ directories = d;
+ }
+ }
+
+ public static final String keyContentType = "ResourceLoaderContentType";
+ public static final String defaultFontName = "Lucida Sans Bold";
+ public static final int defaultFontStyle = Font.PLAIN;
+ public static final int defaultFontSize = 12;
+ public static final Font defaultFont =
+ new Font(defaultFontName, defaultFontStyle, defaultFontSize);
+
+ // File.separator does not work in jar files, except in Unix.
+ // A hardcoded '/' works in Unix, Windows, MacOS X, and jar files.
+ private static final String pathSeparator = "/";
+ private static final ClassLoader baseCL =
+ rails.common.ResourceLoader.class.getClassLoader();
+ private static final RailsClassLoader cl = new RailsClassLoader(baseCL);
+
+ private static final Map<String, Object> fileCache =
+ Collections.synchronizedMap(new HashMap<String, Object>());
+
+ private final static String sep = "~";
+
+ protected static Logger log =
+ Logger.getLogger(ResourceLoader.class.getPackage().getName());
+
+ private static String server = null;
+ private static int serverPort = 0;
+
+ public static void setDataServer(String server, int port) {
+ ResourceLoader.server = server;
+ ResourceLoader.serverPort = port;
+ }
+
+ /**
+ * Give the String to mark directories.
+ *
+ * @return The String to mark directories.
+ */
+ public static String getPathSeparator() {
+ return pathSeparator;
+ }
+
+ /** empty the cache so that all files have to be reloaded */
+ public synchronized static void purgeFileCache() {
+ log.debug("Purging File Cache.");
+ fileCache.clear();
+ }
+
+ /**
+ * Return the first InputStream from file of name filename in the list of
+ * directories, tell the getInputStream not to complain if not found.
+ *
+ * @param filename Name of the file to load.
+ * @param directories List of directories to search (in order).
+ * @return The InputStream, or null if it was not found.
+ */
+ public static InputStream getInputStreamIgnoreFail(String filename,
+ List<String> directories) {
+ return getInputStream(filename, directories, server != null, false,
+ true);
+ }
+
+ /**
+ * Return the first InputStream from file of name filename in the list of
+ * directories.
+ *
+ * @param filename Name of the file to load.
+ * @param directories List of directories to search (in order).
+ * @return The InputStream, or null if it was not found.
+ */
+ public static InputStream getInputStream(String filename, List<String> directories) {
+ return getInputStream(filename, directories, server != null, false,
+ false);
+ }
+
+ /**
+ * Return the first InputStream from file of name filename in the list of
+ * directories.
+ *
+ * @param filename Name of the file to load.
+ * @param directories List of directories to search (in order).
+ * @param remote Ask the server for the stream.
+ * @param cachedOnly Only look in the cache file, do not try to load the
+ * file from permanent storage.
+ * @param ignoreFail (=don't complain) if file not found
+ * @return The InputStream, or null if it was not found.
+ */
+ public static InputStream getInputStream(String filename, List<String> directories,
+ boolean remote, boolean cachedOnly, boolean ignoreFail) {
+ String mapKey = getMapKey(filename, directories);
+ Object cached = fileCache.get(mapKey);
+ byte[] data = null;
+
+ if ((cached == null) && cachedOnly) {
+ if (!ignoreFail) {
+ log.warn("Requested file " + filename
+ + " is requested cached-only but is not is cache.");
+ }
+ return null;
+ }
+
+ if ((cached == null) && ((!remote) || (server == null))) {
+ synchronized (fileCache) {
+ InputStream stream = null;
+ java.util.Iterator<String> it = directories.iterator();
+ while (it.hasNext() && (stream == null)) {
+ Object o = it.next();
+ if (o instanceof String) {
+ String path = (String) o;
+ String fullPath =
+ path + pathSeparator + fixFilename(filename);
+
+ log.debug("Trying to locate InputStream: " + path
+ + pathSeparator + filename);
+ try {
+ File tempFile = new File(fullPath);
+ stream = new FileInputStream(tempFile);
+ } catch (Exception e) {
+ stream = cl.getResourceAsStream(fullPath);
+ }
+ }
+ }
+ if (stream == null) {
+ if (!remote && ignoreFail) {
+ // If someone locally requests it as ignoreFail,
+ // let's assume a remote requester later sees it the
+ // same way.
+ // Right now, the remote-requesting is not able to
+ // submit the "ignore-fail" property...
+ // @TODO: submit that properly?
+ // fileCacheIgnoreFail.put(mapKey, new Boolean(true));
+ }
+ if (!ignoreFail) {
+ log.warn("getInputStream:: "
+ + " Couldn't get InputStream for file "
+ + filename + " in " + directories
+ + (cachedOnly ? " (cached only)" : ""));
+ // @TODO this sounds more serious than just a warning in
+ // the logs
+ // Anyway now at least MarkersLoader does not complain
+ // any more...
+ }
+ } else {
+ data = getBytesFromInputStream(stream);
+ fileCache.put(mapKey, data);
+ }
+ }
+ } else {
+ synchronized (fileCache) {
+ if (cached != null) {
+ data = (byte[]) cached;
+ } else {
+ try {
+ Socket fileSocket = new Socket(server, serverPort);
+ InputStream is = fileSocket.getInputStream();
+
+ if (is == null) {
+ log.warn("getInputStream:: "
+ + " Couldn't get InputStream from socket"
+ + " for file " + filename + " in "
+ + directories
+ + (cachedOnly ? " (cached only)" : ""));
+ // @TODO this sounds more serious than just a
+ // warning in the logs
+ } else {
+ PrintWriter out =
+ new PrintWriter(
+ fileSocket.getOutputStream(), true);
+
+ if (ignoreFail) {
+ // Not in this version yet (05/2007).
+ // New clients could not talk with old server.
+ // Take this into full use somewhat later.
+ // out.print(
+ // Constants.fileServerIgnoreFailSignal + sep);
+ }
+ out.print(filename);
+ java.util.Iterator<String> it = directories.iterator();
+ while (it.hasNext()) {
+ out.print(sep + it.next());
+ }
+ out.println();
+ data = getBytesFromInputStream(is);
+ if (data != null && data.length == 0 && !ignoreFail) {
+ log.warn("Got empty contents for file "
+ ...
[truncated message content] |
|
From: <ste...@us...> - 2011-07-05 17:03:29
|
Revision: 1604
http://rails.svn.sourceforge.net/rails/?rev=1604&view=rev
Author: stefanfrey
Date: 2011-07-05 17:03:23 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Refactored the load code into a new Class GameLoader
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/rails/game/Game.java
trunk/18xx/rails/game/GameManager.java
trunk/18xx/rails/util/ListAndFixSavedFiles.java
Added Paths:
-----------
trunk/18xx/rails/util/GameLoader.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-07-04 23:34:57 UTC (rev 1603)
+++ trunk/18xx/LocalisedText.properties 2011-07-05 17:03:23 UTC (rev 1604)
@@ -354,11 +354,11 @@
LaysTileAtFor={0} lays tile #{1} at hex {2}/{3} for {4}
LDIncome=LD income is
LeaveAuctionOnPass=Leave private auction on pass
-LoadFailed=Load failed, reason: {0}
+LoadFailed=Load failed.\n\Reason = {0}\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li...
LoadGame=Load Game
LoadRecentGame=Load Recent
LOAD=Load
-LoadInterrupted=Load interrupted at this point, you can continue play from here
+LoadInterrupted=Load interrupted at this point, you can continue play from here.\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li...
LoansNotAllowed={0} may not take any loans
Major=Major
MAP=Map
Modified: trunk/18xx/rails/game/Game.java
===================================================================
--- trunk/18xx/rails/game/Game.java 2011-07-04 23:34:57 UTC (rev 1603)
+++ trunk/18xx/rails/game/Game.java 2011-07-05 17:03:23 UTC (rev 1604)
@@ -13,6 +13,7 @@
import rails.common.parser.GameFileParser;
import rails.common.parser.GameOption;
import rails.game.action.PossibleAction;
+import rails.util.GameLoader;
public class Game {
public static final String version = "1.4.1+";
@@ -118,9 +119,32 @@
return true;
}
+
+
+ public static Game load(String filepath) {
+
+ // use GameLoader object to load game
+ GameLoader gameLoader = new GameLoader();
+ gameLoader.loadGameData(filepath);
+ try{
+ gameLoader.initGame();
+ gameLoader.loadActionsAndComments();
+ } catch (ConfigurationException e) {
+ log.fatal("Load failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
+ }
+ try{
+ gameLoader.replayGame();
+ } catch (Exception e) {
+ log.fatal("Replay failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
+ }
+ return gameLoader.getGame();
+ }
+
@SuppressWarnings("unchecked")
- public static Game load(String filepath) {
+ public static Game load_old(String filepath) {
Game game = null;
Modified: trunk/18xx/rails/game/GameManager.java
===================================================================
--- trunk/18xx/rails/game/GameManager.java 2011-07-04 23:34:57 UTC (rev 1603)
+++ trunk/18xx/rails/game/GameManager.java 2011-07-05 17:03:23 UTC (rev 1604)
@@ -1049,8 +1049,8 @@
return true;
}
+ /** allows callback from GameLoader */
public void finishLoading () {
-
guiHints.clearVisibilityHints();
}
@@ -1141,72 +1141,44 @@
}
return result;
}
-
- @SuppressWarnings("unchecked")
+ /**
+ * tries to reload the current game
+ * executes the additional action(s)
+ */
protected boolean reload(GameAction reloadAction) {
-
+ log.info("Reloading started");
+
+ /* Use gameLoader to load the game data */
+ GameLoader gameLoader = new GameLoader();
String filepath = reloadAction.getFilepath();
- log.info("Reloading game from file " + filepath);
- String filename = filepath.replaceAll(".*[/\\\\]", "");
+ gameLoader.loadGameData(filepath);
+
+ /* followed by actions and comments */
+ try{
+ gameLoader.loadActionsAndComments();
+ } catch (ConfigurationException e) {
+ log.fatal("Load failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
+ }
+ log.debug("Starting to compare loaded actions");
+
+ /* gameLoader actions get compared to the executed actions of the current game */
+ List<PossibleAction> savedActions = gameLoader.getActions();
+
+ setReloading(true);
+
+ // Check size
+ if (savedActions.size() < executedActions.size()) {
+ DisplayBuffer.add(LocalText.getText("LoadFailed",
+ "loaded file has less actions than current game"));
+ return true;
+ }
+
+ // Check action identity
+ int index = 0;
+ PossibleAction executedAction;
try {
- ObjectInputStream ois =
- new ObjectInputStream(new FileInputStream(
- new File(filepath)));
-
- // See Game.load(). Here we don't do as much checking. */
- Object object = ois.readObject();
- if (object instanceof String) {
- log.info("Reading Rails "+(String)object+" saved file "+filename);
- object = ois.readObject();
- } else {
- log.info("Reading Rails (pre-1.0.7) saved file "+filename);
- }
- if (object instanceof String) {
- log.info("File was saved at "+(String)object);
- object = ois.readObject();
- }
- String name = (String) ois.readObject();
- log.debug("Saved game="+name);
- Map<String, String> selectedGameOptions =
- (Map<String, String>) ois.readObject();
- List<String> playerNames = (List<String>) ois.readObject();
-
- log.debug("Starting to compare loaded actions");
-
- List<PossibleAction> savedActions;
- int numberOfActions = 0;
- setReloading(true);
-
- Object actionObject = ois.readObject();
- if (actionObject instanceof List) {
- // Old-style: one List of PossibleActions
- savedActions = (List<PossibleAction>) actionObject;
- numberOfActions = savedActions.size();
- } else {
- // New style: separate PossibleActionsObjects, since Rails 1.3.1
- savedActions = new ArrayList<PossibleAction>();
- while (actionObject instanceof PossibleAction) {
- savedActions.add((PossibleAction) actionObject);
- numberOfActions++;
- try {
- actionObject = ois.readObject();
- } catch (EOFException e) {
- break;
- }
- }
- }
-
- // Check size
- if (numberOfActions < executedActions.size()) {
- DisplayBuffer.add(LocalText.getText("LoadFailed",
- "loaded file has less actions than current game"));
- return true;
- }
-
- // Check action identity
- int index = 0;
- PossibleAction executedAction;
for (PossibleAction savedAction : savedActions) {
if (index < executedActions.size()) {
executedAction = executedActions.get(index);
@@ -1230,40 +1202,25 @@
}
}
index++;
- }
-
- if (actionObject instanceof SortedMap) {
- ReportBuffer.setCommentItems((SortedMap<Integer, String>) actionObject);
- log.debug("Found sorted map");
- } else {
- try {
- object = ois.readObject();
- if (object instanceof SortedMap) {
- ReportBuffer.setCommentItems((SortedMap<Integer, String>) object);
- }
- } catch (IOException e) {
- // continue without comments, if any IOException occurs
- // sometimes not only the EOF Exception is raised
- // but also the java.io.StreamCorruptedException: invalid type code
- }
- }
-
- ois.close();
- ois = null;
-
- setReloading(false);
- finishLoading();
- log.info("Reloading finished");
-
+ }
} catch (Exception e) {
log.error("Reload failed", e);
DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
return true;
}
+
+
+ setReloading(false);
+ finishLoading();
+ // use new comments (without checks)
+ ReportBuffer.setCommentItems(gameLoader.getComments());
+
+ log.info("Reloading finished");
return true;
}
+
protected boolean export(GameAction exportAction) {
String filename = exportAction.getFilepath();
Added: trunk/18xx/rails/util/GameLoader.java
===================================================================
--- trunk/18xx/rails/util/GameLoader.java (rev 0)
+++ trunk/18xx/rails/util/GameLoader.java 2011-07-05 17:03:23 UTC (rev 1604)
@@ -0,0 +1,252 @@
+package rails.util;
+
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+
+import rails.common.DisplayBuffer;
+import rails.common.LocalText;
+import rails.common.parser.ConfigurationException;
+import rails.game.Game;
+import rails.game.GameManager;
+import rails.game.GameManagerI;
+import rails.game.ReportBuffer;
+import rails.game.action.PossibleAction;
+
+/**
+ * @author freystef
+ *
+ */
+public class GameLoader {
+
+ protected static Logger log =
+ Logger.getLogger(Game.class.getPackage().getName());
+
+ private boolean dataLoadDone;
+ private boolean initialized;
+
+ private ObjectInputStream ois;
+
+ private String saveVersion;
+ private String saveDate;
+ private Long saveFileVersionID;
+ private String saveGameName;
+ private Map<String, String> selectedGameOptions;
+ private List<String> playerNames;
+ private List<PossibleAction> listOfActions;
+ private SortedMap<Integer, String> userComments;
+
+ private Game loadedGame;
+
+ public String getGameData() {
+ StringBuilder s = new StringBuilder();
+ s.append("Rails saveVersion = " + saveVersion + "\n");
+ s.append("File was saved at " + saveDate + "\n");
+ s.append("Saved versionID=" + saveFileVersionID + "\n");
+ s.append("Save game=" + saveGameName + "\n");
+ for (String key : selectedGameOptions.keySet()) {
+ s.append("Option "+key+"="+selectedGameOptions.get(key)+ "\n");
+ }
+ int i=1;
+ for (String player : playerNames) {
+ s.append("Player "+(i++)+": "+player + "\n");
+ }
+ return s.toString();
+ }
+
+ public Game getGame() {
+ return loadedGame;
+ }
+
+ public List<PossibleAction> getActions() {
+ return listOfActions;
+ }
+
+ public SortedMap<Integer, String> getComments() {
+ return userComments;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void loadGameData(String filepath) {
+
+ dataLoadDone = true;
+ log.info("Loading game from file " + filepath);
+ String filename = filepath.replaceAll(".*[/\\\\]", "");
+
+ try {
+ ois = new ObjectInputStream(new FileInputStream(
+ new File(filepath)));
+
+ Object object = ois.readObject();
+ if (object instanceof String) {
+ // New in 1.0.7: Rails version & save date/time.
+ saveVersion = (String)object;
+ object = ois.readObject();
+ } else {
+ // Allow for older saved file versions.
+ saveVersion = "pre-1.0.7";
+ }
+
+ log.info("Reading Rails " + saveVersion +" saved file "+filename);
+
+ if (object instanceof String) {
+ saveDate = (String)object;
+ log.info("File was saved at "+ saveDate);
+ object = ois.readObject();
+ }
+
+ // read versionID for serialization compatibility
+ saveFileVersionID = (Long) object;
+ log.debug("Saved versionID="+saveFileVersionID+" (object="+object+")");
+ long GMsaveFileVersionID = GameManager.saveFileVersionID;
+
+ if (saveFileVersionID != GMsaveFileVersionID) {
+ throw new Exception("Save version " + saveFileVersionID
+ + " is incompatible with current version "
+ + GMsaveFileVersionID);
+ }
+
+ // read name of saved game
+ saveGameName = (String) ois.readObject();
+ log.debug("Saved game="+ saveGameName);
+
+ // read selected game options and player names
+ selectedGameOptions = (Map<String, String>) ois.readObject();
+ log.debug("Selected game options = " + selectedGameOptions);
+ playerNames = (List<String>) ois.readObject();
+ log.debug("Player names = " + playerNames);
+
+ } catch (Exception e) {
+ log.fatal("Load failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
+ }
+
+
+ }
+
+ public Game initGame() throws ConfigurationException {
+
+ // check if initial load was done
+ if (!dataLoadDone) {
+ throw new ConfigurationException("No game was loaded");
+ }
+
+ // initialize loadedGame
+ loadedGame = new Game(saveGameName, playerNames, selectedGameOptions);
+
+ if (!loadedGame.setup()) {
+ loadedGame = null;
+ throw new ConfigurationException("Error in setting up " + saveGameName);
+ }
+
+ String startError = loadedGame.start();
+ if (startError != null) {
+ DisplayBuffer.add(startError);
+ }
+
+ return loadedGame;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public boolean loadActionsAndComments() throws ConfigurationException {
+ if (!dataLoadDone) {
+ throw new ConfigurationException("No game was loaded");
+ }
+ // Read game actions into listOfActions
+ try {
+ // read next object in stream
+ Object actionObject = null;
+ while (true) { // Single-pass loop.
+ try {
+ actionObject = ois.readObject();
+ } catch (EOFException e) {
+ // Allow saved file at start of game (with no actions).
+ break;
+
+ }
+ if (actionObject instanceof List) {
+ // Until Rails 1.3: one List of PossibleAction
+ listOfActions = (List<PossibleAction>) actionObject;
+ } else if (actionObject instanceof PossibleAction) {
+ listOfActions = new ArrayList<PossibleAction>();
+ // Since Rails 1.3.1: separate PossibleActionsObjects
+ while (actionObject instanceof PossibleAction) {
+ listOfActions.add((PossibleAction)actionObject);
+ try {
+ actionObject = ois.readObject();
+ } catch (EOFException e) {
+ break;
+ }
+ }
+ }
+ break;
+ }
+ /**
+ todo: the code below is far from perfect, but robust
+ */
+
+ // init user comments to have a defined object in any case
+ userComments = new TreeMap<Integer,String>();
+
+ // at the end of file user comments are added as SortedMap
+ if (actionObject instanceof SortedMap) {
+ userComments = (SortedMap<Integer, String>) actionObject;
+ log.debug("file load: found user comments");
+ } else {
+ try {
+ Object object = ois.readObject();
+ if (object instanceof SortedMap) {
+ userComments = (SortedMap<Integer, String>) actionObject;
+ log.debug("file load: found user comments");
+ }
+ } catch (IOException e) {
+ // continue without comments, if any IOException occurs
+ // sometimes not only the EOF Exception is raised
+ // but also the java.io.StreamCorruptedException: invalid type code
+ }
+ }
+ ois.close();
+ ois = null;
+ initialized = true;
+ } catch (Exception e) {
+ log.fatal("Load failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
+ initialized = false;
+ }
+ return initialized;
+ }
+
+ public void replayGame() throws Exception {
+ if (!initialized) {
+ throw new ConfigurationException("No game was loaded/initialized");
+ }
+
+ GameManagerI gameManager = loadedGame.getGameManager();
+ log.debug("Starting to execute loaded actions");
+ gameManager.setReloading(true);
+
+ for (PossibleAction action : listOfActions) {
+ if (!gameManager.processOnReload(action)) {
+ log.error ("Load interrupted");
+ DisplayBuffer.add(LocalText.getText("LoadInterrupted"));
+ break;
+ }
+ }
+
+ gameManager.setReloading(false);
+ ReportBuffer.setCommentItems(userComments);
+
+ // callback to GameManager
+ gameManager.finishLoading();
+ }
+}
Property changes on: trunk/18xx/rails/util/GameLoader.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/18xx/rails/util/ListAndFixSavedFiles.java
===================================================================
--- trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-04 23:34:57 UTC (rev 1603)
+++ trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-07-05 17:03:23 UTC (rev 1604)
@@ -36,6 +36,7 @@
private List<Object> savedObjects = new ArrayList<Object>(512);
private List<PossibleAction> executedActions;
+ private SortedMap<Integer,String> userComments;
private int vbarPos;
@@ -156,100 +157,33 @@
JFileChooser jfc = new JFileChooser();
jfc.setCurrentDirectory(new File(saveDirectory));
-
+
if (jfc.showOpenDialog(getContentPane()) == JFileChooser.APPROVE_OPTION) {
File selectedFile = jfc.getSelectedFile();
filepath = selectedFile.getPath();
saveDirectory = selectedFile.getParent();
+
+ // use GameLoader object to load game
+ GameLoader gameLoader = new GameLoader();
- log.debug("Loading game from file " + filepath);
- String filename = filepath.replaceAll(".*[/\\\\]", "");
-
- try {
- ObjectInputStream ois =
- new ObjectInputStream(new FileInputStream(
- new File(filepath)));
-
- // New in 1.0.7: Rails version & save date/time.
- // Allow for older saved file versions.
-
- Object object = ois.readObject();
- savedObjects.add(object);
- if (object instanceof String) {
- add((String)object+" saved file "+filename);
- object = ois.readObject();
- savedObjects.add(object);
- } else {
- add("Reading Rails (pre-1.0.7) saved file "+filename);
- }
- if (object instanceof String) {
- add("File was saved at "+(String)object);
- object = ois.readObject();
- savedObjects.add(object);
- }
-
- long versionID = (Long) object;
- add("Saved versionID="+versionID+" (object="+object+")");
- long saveFileVersionID = GameManager.saveFileVersionID;
- String name = (String) ois.readObject();
- savedObjects.add(name);
- add("Saved game="+name);
-
- Map<String, String> selectedGameOptions =
- (Map<String, String>) ois.readObject();
- savedObjects.add(selectedGameOptions);
- for (String key : selectedGameOptions.keySet()) {
- add("Option "+key+"="+selectedGameOptions.get(key));
- }
-
- List<String> playerNames = (List<String>) ois.readObject();
- savedObjects.add(playerNames);
- int i=1;
- for (String player : playerNames) {
- add("Player "+(i++)+": "+player);
- }
-
- Game game = new Game(name, playerNames, selectedGameOptions);
-
- if (!game.setup()) {
- throw new ConfigurationException("Error in setting up " + name);
- }
-
- Object firstActionObject = ois.readObject();
- if (firstActionObject instanceof List) {
- // Old-style: one List of PossibleActions
- executedActions =
- (List<PossibleAction>) firstActionObject;
- savedObjects.add(executedActions);
- } else {
- // New style: separate PossibleActionsObjects, since Rails 1.3.1
- executedActions = new ArrayList<PossibleAction>();
- PossibleAction action = (PossibleAction) firstActionObject;
- while (true) {
- savedObjects.add (action);
- executedActions.add(action);
- try {
- action = (PossibleAction) ois.readObject();
- } catch (EOFException e) {
- break;
- } catch (ClassCastException e) {
- log.error ("Aborting on non-action object: "+ e.getMessage());
- break;
- }
- }
- }
+ gameLoader.loadGameData(filepath);
+ add(gameLoader.getGameData());
+ try{
+ gameLoader.initGame();
+ gameLoader.loadActionsAndComments();
+ executedActions = gameLoader.getActions();
+ userComments = gameLoader.getComments();
setReportText(true);
-
- ois.close();
- } catch (Exception e) {
- System.out.println(e.getMessage());
- e.printStackTrace();
+
+ } catch (ConfigurationException e) {
+ log.fatal("Load failed", e);
+ DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage()));
}
}
}
-
+
public void add (String text) {
if (text.length() > 0) {
headerText.append(text);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-07-06 13:13:56
|
Revision: 1606
http://rails.svn.sourceforge.net/rails/?rev=1606&view=rev
Author: evos
Date: 2011-07-06 13:13:50 +0000 (Wed, 06 Jul 2011)
Log Message:
-----------
Phase management step 1: added <NewPhase> tag to 18TN.
Added phases 3?\194?\189 and 6?\194?\189.
Fixed incorrect 2- and 3-train obsolescence for 18TN.
Modified Paths:
--------------
trunk/18xx/data/18TN/CompanyManager.xml
trunk/18xx/data/18TN/Game.xml
trunk/18xx/rails/game/TrainCertificateType.java
trunk/18xx/rails/game/TrainManager.java
Modified: trunk/18xx/data/18TN/CompanyManager.xml
===================================================================
--- trunk/18xx/data/18TN/CompanyManager.xml 2011-07-06 05:39:16 UTC (rev 1605)
+++ trunk/18xx/data/18TN/CompanyManager.xml 2011-07-06 13:13:50 UTC (rev 1606)
@@ -13,17 +13,15 @@
<Float percentage="60"/>
<ShareUnit percentage="10"/>
<BaseTokens>
- <!-- HomeBase lay options: "whenStarted", "whenFloated", "firstOR" (default) -->
<HomeBase lay="firstOR"/>
- <!-- LayCost methods: only "sequence" (1830 style) implemented so far (default) -->
<LayCost method="sequence" cost="0,40,100"/>
</BaseTokens>
<Certificate type="President" shares="2"/>
<Certificate shares="1" number="8"/>
- <Trains limit="4,4,3,2"/>
+ <Trains limit="4,4,4,3,2"/>
<CanUseSpecialProperties/>
<TileLays>
- <Number colour="yellow" phase="3,4,5,6,8" number="2"/>
+ <Number colour="yellow" phase="3,3½,4,5,6,6½,8" number="2"/>
</TileLays>
</CompanyType>
Modified: trunk/18xx/data/18TN/Game.xml
===================================================================
--- trunk/18xx/data/18TN/Game.xml 2011-07-06 05:39:16 UTC (rev 1605)
+++ trunk/18xx/data/18TN/Game.xml 2011-07-06 13:13:50 UTC (rev 1606)
@@ -66,6 +66,7 @@
cities="double" if city-revenue is doubled (e.g. 1826 TGV).
-->
</Defaults>
+ <!--
<TrainType name="2" majorStops="2" cost="80" quantity="5" obsoleting="yes"/>
<TrainType name="3" majorStops="3" cost="180" quantity="5" obsoleting="yes" startPhase="3"/>
<TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes" startPhase="4"
@@ -77,6 +78,27 @@
</TrainType>
<TrainType name="8" majorStops="8" cost="700" quantity="7" startPhase="8"
rustedTrain="4" />
+ -->
+ <TrainType name="2" majorStops="2" cost="80" quantity="5"/>
+ <TrainType name="3" majorStops="3" cost="180" quantity="5">
+ <NewPhase phaseName="3"/>
+ <NewPhase phaseName="3½" trainIndex="4"/>
+ </TrainType>
+ <TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes"
+ rustedTrain="2">
+ <NewPhase phaseName="4"/>
+ </TrainType>
+ <TrainType name="5" majorStops="5" cost="450" quantity="2">
+ <NewPhase phaseName="5"/>
+ </TrainType>
+ <TrainType name="6" majorStops="6" cost="630" quantity="2" rustedTrain="3">
+ <NewPhase phaseName="6"/>
+ <NewPhase phaseName="6½" trainIndex="2"/>
+ <Sub index="2" rustedTrain="4"/>
+ </TrainType>
+ <TrainType name="8" majorStops="8" cost="700" quantity="7" rustedTrain="4">
+ <NewPhase phaseName="8"/>
+ </TrainType>
</Component>
<Component name="PhaseManager" class="rails.game.PhaseManager">
<!-- Note: released and rusted trains are now specified per TrainType
@@ -93,6 +115,9 @@
<Privates sellingAllowed="yes"/>
<OperatingRounds number="2"/>
</Phase>
+ <Phase name="3½">
+ <Tiles colour="yellow,green"/>
+ </Phase>
<Phase name="4">
<Tiles colour="yellow,green"/>
</Phase>
@@ -105,6 +130,9 @@
<Phase name="6">
<Tiles colour="yellow,green,brown"/>
</Phase>
+ <Phase name="6½">
+ <Tiles colour="yellow,green,brown"/>
+ </Phase>
<Phase name="8">
<Tiles colour="yellow,green,brown"/>
</Phase>
Modified: trunk/18xx/rails/game/TrainCertificateType.java
===================================================================
--- trunk/18xx/rails/game/TrainCertificateType.java 2011-07-06 05:39:16 UTC (rev 1605)
+++ trunk/18xx/rails/game/TrainCertificateType.java 2011-07-06 13:13:50 UTC (rev 1606)
@@ -22,6 +22,8 @@
protected List<TrainType> potentialTrainTypes = new ArrayList<TrainType>(2);
+ protected Map<Integer, String> newPhaseNames;
+
protected Map<Integer, String> rustedTrainTypeNames = null;
protected Map<Integer, TrainCertificateType> rustedTrainType = null;
@@ -38,9 +40,6 @@
protected String trainClassName = "rails.game.Train";
protected Class<? extends Train> trainClass;
-
- protected int lastIndex = 0;
-
// State variables
protected IntegerState numberBoughtFromIPO;
protected BooleanState available;
@@ -99,12 +98,28 @@
for (Tag sub : tag.getChildren("Sub")) {
int index = sub.getAttributeAsInteger("index");
rustedTrainTypeName1 = sub.getAttributeAsString("rustedTrain");
- if (rustedTrainTypeNames == null) {
- rustedTrainTypeNames = new HashMap<Integer, String>();
- }
- rustedTrainTypeNames.put(index, rustedTrainTypeName1);
+ if (rustedTrainTypeNames == null) {
+ rustedTrainTypeNames = new HashMap<Integer, String>();
}
+ rustedTrainTypeNames.put(index, rustedTrainTypeName1);
}
+ }
+
+ // New style phase changes (to replace 'startPhase' attribute and <Sub> tag)
+ List<Tag> newPhaseTags = tag.getChildren("NewPhase");
+ if (newPhaseTags != null) {
+ int index;
+ String phaseName;
+ newPhaseNames = new HashMap<Integer, String>();
+ for (Tag newPhaseTag : newPhaseTags) {
+ phaseName = newPhaseTag.getAttributeAsString("phaseName");
+ if (!Util.hasValue(phaseName)) {
+ throw new ConfigurationException ("TrainType "+name+" has NewPhase without phase name");
+ }
+ index = newPhaseTag.getAttributeAsInteger("trainIndex", 1);
+ newPhaseNames.put(index, phaseName);
+ }
+ }
// Exchangeable
Tag swapTag = tag.getChild("Exchange");
@@ -139,6 +154,10 @@
}
}
+ public Map<Integer, String> getNewPhaseNames() {
+ return newPhaseNames;
+ }
+
public TrainI createTrain () throws ConfigurationException {
TrainI train;
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-07-06 05:39:16 UTC (rev 1605)
+++ trunk/18xx/rails/game/TrainManager.java 2011-07-06 13:13:50 UTC (rev 1606)
@@ -54,6 +54,10 @@
/** Required for the sell-train-to-foreigners feature of some games */
protected BooleanState anyTrainBought = new BooleanState ("AnyTrainBought", false);
+
+ // Triggered phase changes
+ protected Map<TrainCertificateType, Map<Integer, Phase>> newPhases
+ = new HashMap<TrainCertificateType, Map<Integer, Phase>>();
// Non-game attributes
protected Portfolio ipo, pool, unavailable;
@@ -167,6 +171,11 @@
}
}
+ Map<Integer, String> newPhaseNames;
+ Phase phase;
+ String phaseName;
+ PhaseManager phaseManager = gameManager.getPhaseManager();
+
for (TrainCertificateType certType : trainCertTypes) {
certType.finishConfiguration(gameManager);
@@ -189,6 +198,20 @@
addTrain(train);
unavailable.addTrain(train);
}
+
+ // Register any phase changes
+ newPhaseNames = certType.getNewPhaseNames();
+ if (newPhaseNames != null && !newPhaseNames.isEmpty()) {
+ for (int index : newPhaseNames.keySet()) {
+ phaseName = newPhaseNames.get(index);
+ phase = (Phase)phaseManager.getPhaseByName(phaseName);
+ if (phase == null) {
+ throw new ConfigurationException ("New phase '"+phaseName+"' does not exist");
+ }
+ if (newPhases.get(certType) == null) newPhases.put(certType, new HashMap<Integer, Phase>());
+ newPhases.get(certType).put(index, phase);
+ }
+ }
}
@@ -301,6 +324,14 @@
trainAvailabilityChanged = true;
}
}
+
+ // New style phase changes, can be triggered by any bought train.
+ Phase newPhase;
+ if (newPhases.get(boughtType) != null
+ && (newPhase = newPhases.get(boughtType).get(trainIndex)) != null) {
+ gameManager.getPhaseManager().setPhase(newPhase);
+ phaseHasChanged = true;
+ }
TrainCertificateType rustedType = boughtType.getRustedTrainType(trainIndex);
if (rustedType != null && !rustedType.hasRusted()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ste...@us...> - 2011-07-07 04:57:01
|
Revision: 1608
http://rails.svn.sourceforge.net/rails/?rev=1608&view=rev
Author: stefanfrey
Date: 2011-07-07 04:56:55 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Added support for Rights in Revenue Calculation.
Important ToDo: Still hardcoded rights location.
Modified Paths:
--------------
trunk/18xx/data/1830/Game.xml
trunk/18xx/rails/game/PublicCompany.java
trunk/18xx/rails/game/special/SpecialRight.java
Modified: trunk/18xx/data/1830/Game.xml
===================================================================
--- trunk/18xx/data/1830/Game.xml 2011-07-07 04:53:35 UTC (rev 1607)
+++ trunk/18xx/data/1830/Game.xml 2011-07-07 04:56:55 UTC (rev 1608)
@@ -240,4 +240,7 @@
<Tiles colour="yellow,green,brown"/>
</Phase>
</Component>
+ <Component name="RevenueManager" class="rails.algorithms.RevenueManager">
+<!-- Required for coalfield rights '-->
+ </Component>
</ComponentManager>
\ No newline at end of file
Modified: trunk/18xx/rails/game/PublicCompany.java
===================================================================
--- trunk/18xx/rails/game/PublicCompany.java 2011-07-07 04:53:35 UTC (rev 1607)
+++ trunk/18xx/rails/game/PublicCompany.java 2011-07-07 04:56:55 UTC (rev 1608)
@@ -768,6 +768,8 @@
// Initialize rights here to prevent overhead if not used,
// but if rights are used, the GUI needs it from the start.
if (rights == null) rights = new HashMapState<String, String>(name+"_Rights");
+ // TODO: This is only a workaround for the missing finishConfiguration of special properties (SFY)
+ sp.finishConfiguration(gameManager);
}
}
}
Modified: trunk/18xx/rails/game/special/SpecialRight.java
===================================================================
--- trunk/18xx/rails/game/special/SpecialRight.java 2011-07-07 04:53:35 UTC (rev 1607)
+++ trunk/18xx/rails/game/special/SpecialRight.java 2011-07-07 04:56:55 UTC (rev 1608)
@@ -1,13 +1,19 @@
/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialRight.java,v 1.19 2010/05/05 21:37:18 evos Exp $ */
package rails.game.special;
+import java.util.Set;
+
+import rails.algorithms.NetworkVertex;
+import rails.algorithms.RevenueAdapter;
+import rails.algorithms.RevenueBonus;
+import rails.algorithms.RevenueStaticModifier;
import rails.common.LocalText;
import rails.common.parser.ConfigurationException;
import rails.common.parser.Tag;
import rails.game.*;
import rails.util.*;
-public class SpecialRight extends SpecialProperty {
+public class SpecialRight extends SpecialProperty implements RevenueStaticModifier {
/** The public company of which a share can be obtained. */
protected String rightName;
@@ -35,6 +41,14 @@
cost = rightTag.getAttributeAsInteger("cost", 0);
}
+ @Override
+ public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException {
+ super.finishConfiguration(gameManager);
+
+ // add them to the call list of the RevenueManager
+ gameManager.getRevenueManager().addStaticModifier(this);
+ }
+
public boolean isExecutionable() {
return originalCompany.getPortfolio().getOwner() instanceof Player;
@@ -76,4 +90,18 @@
public String getInfo() {
return toMenu();
}
+
+ /**
+ * modify revenue calculation of the
+ * TODO: rights is missing a location field, currently hardcoded for 1830 coalfields
+ */
+ public void modifyCalculator(RevenueAdapter revenueAdapter) {
+ // 1. check operating company if it has the right then it is excluded from the removal
+ if (revenueAdapter.getCompany().hasRight(rightName)) return;
+
+ // 2. find vertices to hex and remove those
+ MapHex hex = GameManager.getInstance().getMapManager().getHex("L10");
+ Set<NetworkVertex> verticesToRemove = NetworkVertex.getVerticesByHex(revenueAdapter.getVertices(), hex);
+ revenueAdapter.getGraph().removeAllVertices(verticesToRemove);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-07-07 19:23:39
|
Revision: 1610
http://rails.svn.sourceforge.net/rails/?rev=1610&view=rev
Author: evos
Date: 2011-07-07 19:23:32 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Phase management step 2:
Moved rusted and released trains from <Train> to <Phase>.
This has been implemented in the code, but applied to 18TN and 1856 only (the old method still works).
Also split some report lines that started with a newline into a blank line and a line without newline (as per SF).
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/1856/Game.xml
trunk/18xx/data/18TN/Game.xml
trunk/18xx/rails/game/OperatingRound.java
trunk/18xx/rails/game/Phase.java
trunk/18xx/rails/game/PhaseI.java
trunk/18xx/rails/game/PhaseManager.java
trunk/18xx/rails/game/Portfolio.java
trunk/18xx/rails/game/StockRound.java
trunk/18xx/rails/game/TrainManager.java
trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java
trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java
trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/LocalisedText.properties 2011-07-07 19:23:32 UTC (rev 1610)
@@ -142,13 +142,13 @@
CompanyDoesNotExist=Company {0} does not exist
CompanyDoesNotOwnTrain=Company {0} does not own a {1}-train
CompanyDoesNotPayDividend={0} does not pay a dividend
-CompanyHasLoans=\n{0} ({1}) has {2} loans of {3}, total is {4}
-CompanyHasShares=\n{0} has {1} shares of {2}% each
+CompanyHasLoans={0} ({1}) has {2} loans of {3}, total is {4}
+CompanyHasShares={0} has {1} shares of {2}% each
CompanyHasNoType=Company {0} has no type defined
CompanyHasUnknownType=Company {0} has an undefined type {1}
CompanyMustOwnATrain={0} must own a train
CompanyMustPayLoanInterest={0} must pay {1} loan interest
-CompanyOperates=\n{0} ({1}) operates.
+CompanyOperates={0} ({1}) operates.
CompanyPaysLoanInterest={0} pays {1} as {2}% interest over {3} loans of {4}
CompanyPaysOutFull={0} pays out full dividend of {1}
CompanyRepaysLoans={0} pays {1} (of {2}) to repay {3} loan(s) of {4} from its treasury
@@ -243,15 +243,15 @@
EDIT=Edit
EMERGENCY_SHARE_SELLING_TITLE=Rails: Game Status - SELLING SHARES FOR EMERGENCY CASH RAISING
END_OF_GAME_CLOSE_ALL_WINDOWS=Close all windows
-END_SR=\nAll players have passed, end of SR {0}
+END_SR=All players have passed, end of SR {0}
EndOfExchangeRound=All minors are closed, end of Exchange Round
-EndOfFormationRound=\nEnd of {0} formation round, resuming {1}
-EndOfFormationRoundNoInterrupt=\nEnd of {0} formation round
+EndOfFormationRound=End of {0} formation round, resuming {1}
+EndOfFormationRoundNoInterrupt=End of {0} formation round
ENTER_PRICE_OR_CANCEL=Enter a valid price or hit Cancel
ERROR=Error
EXCHANGED=exchanged
EXPORT=Export Map
-EndOfOperatingRound=\nEnd of Operating Round {0}
+EndOfOperatingRound=End of Operating Round {0}
EnterRevenue=Enter the earnings of the operating company
EnterSearch=Enter search target
EoGFinalRanking=Final ranking
@@ -550,7 +550,7 @@
SelectCheapTrain=You can buy a cheaper new train by using {0}.
SelectStationForToken={0}, select a station on hex {1} for the {2} home base token
SelectStationForTokenOption=Place token in station {0} with tracks to {1}
-SelectForAuctioning=\n{0} selects {1} for auctioning
+SelectForAuctioning={0} selects {1} for auctioning
SELL=Sell
SELL_SHARE_LOG={0} sells a {1}% share of {2} to Pool for {3}.
SELL_SHARES_LOG={0} sells {1} {2}% shares ({3}%) of {4} to Pool for {5}.
Modified: trunk/18xx/data/1856/Game.xml
===================================================================
--- trunk/18xx/data/1856/Game.xml 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/data/1856/Game.xml 2011-07-07 19:23:32 UTC (rev 1610)
@@ -52,14 +52,20 @@
<Score towns="yes"/>
</Defaults>
<TrainType name="2" majorStops="2" cost="100" quantity="6"/>
- <TrainType name="3" majorStops="3" cost="225" quantity="5" startPhase="2"/>
- <TrainType name="4" majorStops="4" cost="350" quantity="4" startPhase="3"
- rustedTrain="2"/>
- <TrainType name="5" majorStops="5" cost="550" quantity="3" startPhase="4"/>
- <TrainType name="6" majorStops="6" cost="700" quantity="2" startPhase="5"
- rustedTrain="3" releasedTrain="D"/>
- <TrainType name="D" majorStops="99" cost="1100" quantity="-1" startPhase="6"
- rustedTrain="4">
+ <TrainType name="3" majorStops="3" cost="225" quantity="5">
+ <NewPhase phaseName="2"/>
+ </TrainType>
+ <TrainType name="4" majorStops="4" cost="350" quantity="4">
+ <NewPhase phaseName="3"/>
+ </TrainType>
+ <TrainType name="5" majorStops="5" cost="550" quantity="3">
+ <NewPhase phaseName="4"/>
+ </TrainType>
+ <TrainType name="6" majorStops="6" cost="700" quantity="2">
+ <NewPhase phaseName="5"/>
+ </TrainType>
+ <TrainType name="D" majorStops="99" cost="1100" quantity="-1">
+ <NewPhase phaseName="6"/>
<Exchange cost="750"/>
</TrainType>
</Component>
@@ -76,7 +82,7 @@
<Privates sellingAllowed="yes"/>
</Phase>
<Phase name="3">
- <Tiles colour="yellow,green"/>
+ <Trains rusted="2"/>
</Phase>
<Phase name="4">
<Tiles colour="yellow,green,brown"/>
@@ -86,10 +92,11 @@
</Phase>
<Phase name="5">
<Tiles colour="yellow,green,brown,grey"/>
+ <Trains rusted="3" released="D"/>
<Loans allowed="no"/>
</Phase>
<Phase name="6">
- <Tiles colour="yellow,green,brown,grey"/>
+ <Trains rusted="4"/>
<OffBoardRevenue step="3"/>
</Phase>
</Component>
Modified: trunk/18xx/data/18TN/Game.xml
===================================================================
--- trunk/18xx/data/18TN/Game.xml 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/data/18TN/Game.xml 2011-07-07 19:23:32 UTC (rev 1610)
@@ -84,19 +84,17 @@
<NewPhase phaseName="3"/>
<NewPhase phaseName="3½" trainIndex="4"/>
</TrainType>
- <TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes"
- rustedTrain="2">
+ <TrainType name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes">
<NewPhase phaseName="4"/>
</TrainType>
<TrainType name="5" majorStops="5" cost="450" quantity="2">
<NewPhase phaseName="5"/>
</TrainType>
- <TrainType name="6" majorStops="6" cost="630" quantity="2" rustedTrain="3">
+ <TrainType name="6" majorStops="6" cost="630" quantity="2">
<NewPhase phaseName="6"/>
<NewPhase phaseName="6½" trainIndex="2"/>
- <Sub index="2" rustedTrain="4"/>
- </TrainType>
- <TrainType name="8" majorStops="8" cost="700" quantity="7" rustedTrain="4">
+ </TrainType>
+ <TrainType name="8" majorStops="8" cost="700" quantity="7">
<NewPhase phaseName="8"/>
</TrainType>
</Component>
@@ -116,10 +114,9 @@
<OperatingRounds number="2"/>
</Phase>
<Phase name="3½">
- <Tiles colour="yellow,green"/>
</Phase>
<Phase name="4">
- <Tiles colour="yellow,green"/>
+ <Trains rusted="2"/>
</Phase>
<Phase name="5">
<Tiles colour="yellow,green,brown"/>
@@ -128,13 +125,12 @@
<OffBoardRevenue step="2"/>
</Phase>
<Phase name="6">
- <Tiles colour="yellow,green,brown"/>
+ <Trains rusted="3"/>
</Phase>
<Phase name="6½">
- <Tiles colour="yellow,green,brown"/>
+ <Trains rusted="4"/>
</Phase>
<Phase name="8">
- <Tiles colour="yellow,green,brown"/>
</Phase>
</Component>
</ComponentManager>
\ No newline at end of file
Modified: trunk/18xx/rails/game/OperatingRound.java
===================================================================
--- trunk/18xx/rails/game/OperatingRound.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/OperatingRound.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -1302,6 +1302,7 @@
protected void initTurn() {
log.debug("Starting turn of "+operatingCompany.get().getName());
+ ReportBuffer.add(" ");
ReportBuffer.add(LocalText.getText("CompanyOperates",
operatingCompany.get().getName(),
operatingCompany.get().getPresident().getName()));
@@ -1645,6 +1646,7 @@
// priv.checkClosingIfExercised(true);
//}
+ ReportBuffer.add(" ");
ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber));
// Update the worth increase per player
Modified: trunk/18xx/rails/game/Phase.java
===================================================================
--- trunk/18xx/rails/game/Phase.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/Phase.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -45,6 +45,17 @@
/** Items to close if a phase gets activated */
protected List<Closeable> closedObjects = null;
+
+ /** Train types to rust or obsolete if a phase gets activated */
+ protected List<TrainCertificateType> rustedTrains;
+ String rustedTrainNames;
+
+ /** Train types to release (make available for buying) if a phase gets activated */
+ protected List<TrainCertificateType> releasedTrains;
+ String releasedTrainNames;
+
+ private TrainManager trainManager;
+ private Portfolio lastTrainBuyer;
protected String extraInfo = "";
@@ -123,6 +134,8 @@
Tag trainsTag = tag.getChild("Trains");
if (trainsTag != null) {
+ rustedTrainNames = trainsTag.getAttributeAsString("rusted", null);
+ releasedTrainNames = trainsTag.getAttributeAsString("released", null);
trainTradingAllowed =
trainsTag.getAttributeAsBoolean("tradingAllowed",
trainTradingAllowed);
@@ -159,8 +172,36 @@
}
- public void finishConfiguration (GameManagerI gameManager) {}
+ public void finishConfiguration (GameManagerI gameManager)
+ throws ConfigurationException {
+
+ trainManager = gameManager.getTrainManager();
+ TrainCertificateType type;
+
+ if (rustedTrainNames != null) {
+ rustedTrains = new ArrayList<TrainCertificateType>(2);
+ for (String typeName : rustedTrainNames.split(",")) {
+ type = trainManager.getCertTypeByName(typeName);
+ if (type == null) {
+ throw new ConfigurationException (" Unknown rusted train type '"+typeName+"' for phase '"+name+"'");
+ }
+ rustedTrains.add(type);
+ type.setPermanent(false);
+ }
+ }
+ if (releasedTrainNames != null) {
+ releasedTrains = new ArrayList<TrainCertificateType>(2);
+ for (String typeName : releasedTrainNames.split(",")) {
+ type = trainManager.getCertTypeByName(typeName);
+ if (type == null) {
+ throw new ConfigurationException (" Unknown released train type '"+typeName+"' for phase '"+name+"'");
+ }
+ releasedTrains.add(type);
+ }
+ }
+ }
+
/** Called when a phase gets activated */
public void activate() {
log.debug("Phase " + name + " activated");
@@ -170,8 +211,24 @@
object.close();
}
}
+
+ if (rustedTrains != null && !rustedTrains.isEmpty()) {
+ for (TrainCertificateType type : rustedTrains) {
+ trainManager.rustTrainType(type, lastTrainBuyer);
+ }
+ }
+
+ if (releasedTrains != null && !releasedTrains.isEmpty()) {
+ for (TrainCertificateType type : releasedTrains) {
+ trainManager.makeTrainAvailable(type);
+ }
+ }
}
+ public void setLastTrainBuyer(Portfolio lastTrainBuyer) {
+ this.lastTrainBuyer = lastTrainBuyer;
+ }
+
public String getInfo() {
return extraInfo;
}
@@ -233,6 +290,14 @@
return numberOfOperatingRounds;
}
+ public List<TrainCertificateType> getRustedTrains() {
+ return rustedTrains;
+ }
+
+ public List<TrainCertificateType> getReleasedTrains() {
+ return releasedTrains;
+ }
+
/**
* @return Returns the offBoardRevenueStep.
*/
Modified: trunk/18xx/rails/game/PhaseI.java
===================================================================
--- trunk/18xx/rails/game/PhaseI.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/PhaseI.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -39,4 +39,6 @@
public String getParameterAsString (String key);
public int getParameterAsInteger (String key);
+
+ public void setLastTrainBuyer(Portfolio lastTrainBuyer);
}
Modified: trunk/18xx/rails/game/PhaseManager.java
===================================================================
--- trunk/18xx/rails/game/PhaseManager.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/PhaseManager.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -51,10 +51,16 @@
}
}
- public void finishConfiguration (GameManagerI gameManager) {
+ public void finishConfiguration (GameManagerI gameManager)
+ throws ConfigurationException {
this.gameManager = gameManager;
+
+ for (Phase phase : phaseList) {
+ phase.finishConfiguration(gameManager);
+ }
+
PhaseI initialPhase = phaseList.get(0);
- setPhase(initialPhase);
+ setPhase(initialPhase, null);
}
public PhaseI getCurrentPhase() {
@@ -69,12 +75,13 @@
return getCurrentPhase().getIndex();
}
- public void setPhase(String name) {
- setPhase(phaseMap.get(name));
+ public void setPhase(String name, Portfolio lastTrainBuyer) {
+ setPhase(phaseMap.get(name), lastTrainBuyer);
}
- protected void setPhase(PhaseI phase) {
+ protected void setPhase(PhaseI phase, Portfolio lastTrainBuyer) {
if (phase != null) {
+ phase.setLastTrainBuyer (lastTrainBuyer);
currentPhase.set(phase);
// TODO Redundant, should be replaced by phase.activate()
Modified: trunk/18xx/rails/game/Portfolio.java
===================================================================
--- trunk/18xx/rails/game/Portfolio.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/Portfolio.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -544,7 +544,9 @@
if (trainsOfType != null && !trainsOfType.isEmpty()) {
for (TrainI train : trainsOfType) {
if (b.length() > 0) b.append(" ");
+ if (train.isObsolete()) b.append("[");
b.append(train.getName());
+ if (train.isObsolete()) b.append("]");
}
}
}
Modified: trunk/18xx/rails/game/StockRound.java
===================================================================
--- trunk/18xx/rails/game/StockRound.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/StockRound.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -1312,6 +1312,7 @@
@Override
protected void finishRound () {
+ ReportBuffer.add(" ");
ReportBuffer.add(LocalText.getText("END_SR",
String.valueOf(getStockRoundNumber())));
Modified: trunk/18xx/rails/game/TrainManager.java
===================================================================
--- trunk/18xx/rails/game/TrainManager.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/TrainManager.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -308,7 +308,7 @@
String newPhase = boughtType.getStartedPhaseName();
if (newPhase != null) {
- gameManager.getPhaseManager().setPhase(newPhase);
+ gameManager.getPhaseManager().setPhase(newPhase, train.getHolder());
phaseHasChanged = true;
}
@@ -329,7 +329,7 @@
Phase newPhase;
if (newPhases.get(boughtType) != null
&& (newPhase = newPhases.get(boughtType).get(trainIndex)) != null) {
- gameManager.getPhaseManager().setPhase(newPhase);
+ gameManager.getPhaseManager().setPhase(newPhase, train.getHolder());
phaseHasChanged = true;
}
Modified: trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java
===================================================================
--- trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -435,6 +435,7 @@
@Override
protected void finishRound() {
RoundI interruptedRound = gameManager.getInterruptedRound();
+ ReportBuffer.add(" ");
if (interruptedRound != null) {
ReportBuffer.add(LocalText.getText("EndOfFormationRound", PR_ID,
interruptedRound.getRoundName()));
Modified: trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java
===================================================================
--- trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -152,6 +152,8 @@
numberOfLoans,
Bank.format(valuePerLoan),
Bank.format(numberOfLoans * valuePerLoan));
+ ReportBuffer.add(" ");
+ DisplayBuffer.add(" ", false);
ReportBuffer.add(message);
DisplayBuffer.add(message, false);
@@ -428,6 +430,8 @@
}
message = LocalText.getText("CompanyHasShares",
cgr.getName(), 100/cgr.getShareUnit(), cgr.getShareUnit());
+ DisplayBuffer.add(" ");
+ ReportBuffer.add(" ");
DisplayBuffer.add(message);
ReportBuffer.add(message);
Modified: trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java
===================================================================
--- trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java 2011-07-07 12:58:55 UTC (rev 1609)
+++ trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java 2011-07-07 19:23:32 UTC (rev 1610)
@@ -244,6 +244,7 @@
setStep(OPEN_STEP);
}
+ ReportBuffer.add(" ");
ReportBuffer.add(LocalText.getText("SelectForAuctioning",
playerName,
item.getName() ));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ev...@us...> - 2011-07-08 10:08:11
|
Revision: 1611
http://rails.svn.sourceforge.net/rails/?rev=1611&view=rev
Author: evos
Date: 2011-07-08 10:08:04 +0000 (Fri, 08 Jul 2011)
Log Message:
-----------
Added location attribute to SpecialRight
Modified Paths:
--------------
trunk/18xx/data/1830/CompanyManager.xml
trunk/18xx/rails/game/special/SpecialRight.java
Modified: trunk/18xx/data/1830/CompanyManager.xml
===================================================================
--- trunk/18xx/data/1830/CompanyManager.xml 2011-07-07 19:23:32 UTC (rev 1610)
+++ trunk/18xx/data/1830/CompanyManager.xml 2011-07-08 10:08:04 UTC (rev 1611)
@@ -26,7 +26,7 @@
<CanUseSpecialProperties/>
<SpecialProperties>
<SpecialProperty condition="ifOwnedByCompany" when="orTurn" class="rails.game.special.SpecialRight">
- <SpecialRight name="Coalfields" cost="140"/>
+ <SpecialRight name="Coalfields" cost="140" location="L10"/>
</SpecialProperty>
</SpecialProperties>
</IfOption>
Modified: trunk/18xx/rails/game/special/SpecialRight.java
===================================================================
--- trunk/18xx/rails/game/special/SpecialRight.java 2011-07-07 19:23:32 UTC (rev 1610)
+++ trunk/18xx/rails/game/special/SpecialRight.java 2011-07-08 10:08:04 UTC (rev 1611)
@@ -1,7 +1,7 @@
/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/special/SpecialRight.java,v 1.19 2010/05/05 21:37:18 evos Exp $ */
package rails.game.special;
-import java.util.Set;
+import java.util.*;
import rails.algorithms.NetworkVertex;
import rails.algorithms.RevenueAdapter;
@@ -19,7 +19,9 @@
protected String rightName;
protected String rightDefaultValue;
protected String rightValue;
- protected int cost;
+ protected int cost = 0;
+ protected String locationNames;
+ protected List<MapHex> locations;
@Override
public void configureFromXML(Tag tag) throws ConfigurationException {
@@ -39,6 +41,8 @@
rightDefaultValue = rightValue = rightTag.getAttributeAsString("defaultValue", null);
cost = rightTag.getAttributeAsInteger("cost", 0);
+
+ locationNames = rightTag.getAttributeAsString("location", null);
}
@Override
@@ -47,6 +51,19 @@
// add them to the call list of the RevenueManager
gameManager.getRevenueManager().addStaticModifier(this);
+
+ if (locationNames != null) {
+ locations = new ArrayList<MapHex>();
+ MapManager mmgr = gameManager.getMapManager();
+ MapHex hex;
+ for (String hexName : locationNames.split(",")) {
+ hex = mmgr.getHex(hexName);
+ if (hex == null) {
+ throw new ConfigurationException ("Unknown hex '"+hexName+"' for Special Right");
+ }
+ locations.add (hex);
+ }
+ }
}
public boolean isExecutionable() {
@@ -75,9 +92,21 @@
return cost;
}
+ public String getLocationNames() {
+ return locationNames;
+ }
+
+ public List<MapHex> getLocations() {
+ return locations;
+ }
+
@Override
public String toString() {
- return "Buy '" + rightName + "' right for " + Bank.format(cost);
+ StringBuilder b = new StringBuilder();
+ b.append(cost > 0 ? "Buy '" : "Get '").append(rightName).append("'");
+ if (locationNames != null) b.append(" at ").append(locationNames);
+ if (cost > 0) b.append(" for ").append(Bank.format(cost));
+ return b.toString();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ste...@us...> - 2011-07-16 06:23:26
|
Revision: 1614
http://rails.svn.sourceforge.net/rails/?rev=1614&view=rev
Author: stefanfrey
Date: 2011-07-16 06:23:19 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Added TGVmodifier revenue for 1826 support.
Updated dynamic modifier and include more doc and text.
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/data/1870/Game.xml
trunk/18xx/rails/algorithms/NetworkTrain.java
trunk/18xx/rails/algorithms/RevenueAdapter.java
trunk/18xx/rails/algorithms/RevenueCalculator.java
trunk/18xx/rails/algorithms/RevenueDynamicModifier.java
trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java
trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java
trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java
trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java
Added Paths:
-----------
trunk/18xx/rails/game/specific/_1826/
trunk/18xx/rails/game/specific/_1826/TGVModifier.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/LocalisedText.properties 2011-07-16 06:23:19 UTC (rev 1614)
@@ -236,6 +236,7 @@
DoesNotForm={0} does not form
DoesNotHaveTheShares=Does not have the shares
Done=Done
+DoubleHeadingModifier1825={0} are two {1}-trains running as a {2}-train (double heading).
ShortORExecuted=A short OR has been held, in which only the sold privates have paid out.
DuplicateTileID=Duplicate tile {0} in Tiles.xml
DuplicateTilesetID=Duplicate tile {0} in TileSet.xml
@@ -620,6 +621,7 @@
TRAINS=Trains
TakeLoanPrompt=Will {0} take a loan of {1}?
TakeLoans=Take loan(s)
+TGVModifier=TGV trains run on separate tracks.
ThisItemIsAuctionedNow=This item is auctioned now
TileAlreadyHasToken=Tile {0} already has a base token of company {1}
TileColorMissing=Missing color in tile {0}
Modified: trunk/18xx/data/1870/Game.xml
===================================================================
--- trunk/18xx/data/1870/Game.xml 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/data/1870/Game.xml 2011-07-16 06:23:19 UTC (rev 1614)
@@ -88,5 +88,9 @@
<Tiles colour="yellow,green,brown,grey"/>
<OffBoardRevenue step="3"/>
</Phase>
+ </Component>
+ <Component name="RevenueManager" class="rails.algorithms.RevenueManager">
+ <Modifier class="rails.game.specific._1826.TGVModifier" />
</Component>
+
</ComponentManager>
\ No newline at end of file
Modified: trunk/18xx/rails/algorithms/NetworkTrain.java
===================================================================
--- trunk/18xx/rails/algorithms/NetworkTrain.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/algorithms/NetworkTrain.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -15,11 +15,11 @@
private final boolean ignoreMinors;
private final int multiplyMajors;
private final int multiplyMinors;
- private final String trainName;
+ private String trainName;
private final TrainI railsTrain;
- public NetworkTrain(int majors, int minors, boolean ignoreMinors,
+ private NetworkTrain(int majors, int minors, boolean ignoreMinors,
int multiplyMajors, int multiplyMinors, String trainName, TrainI train) {
this.majors = majors;
this.minors = minors;
@@ -49,12 +49,18 @@
trainName, railsTrain);
}
- static NetworkTrain createFromString(String trainString) {
+ public static NetworkTrain createFromString(String trainString) {
String t = trainString.trim();
int cities = 0; int towns = 0; boolean ignoreTowns = false; int multiplyCities = 1; int multiplyTowns = 1;
if (t.equals("D")) {
log.info("RA: found Diesel train");
cities = 99;
+ } else if (t.equals("TGV")) {
+ log.info("RA: found TGV train");
+ cities = 3;
+ ignoreTowns = true;
+ multiplyCities = 2;
+ multiplyTowns = 0;
} else if (t.contains("+")) {
log.info("RA: found Plus train");
cities = Integer.parseInt(t.split("\\+")[0]); // + train
@@ -110,6 +116,10 @@
return ignoreMinors;
}
+ public void setTrainName(String name) {
+ trainName = name;
+ }
+
public String getTrainName() {
return trainName;
}
Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -560,15 +560,31 @@
}
public int calculateRevenue() {
- return calculateRevenue(0, trains.size() - 1);
+ // allow dynamic modifiers to have their own revenue calculation method
+ boolean isModified = false;
+ int value = 0;
+ for (RevenueDynamicModifier modifier:dynamicModifiers) {
+ if (modifier.providesOwnCalculateRevenue()) {
+ isModified = true;
+ value += modifier.calculateRevenue(this);
+ }
+ }
+ // if no modifier was used, standard method is to evaluate all trains
+ if (isModified) {
+ return value;
+ } else {
+ return calculateRevenue(0, trains.size() - 1);
+ }
}
public int calculateRevenue(int startTrain, int finalTrain) {
- optimalRun = null;
if (startTrain < 0 || finalTrain >= trains.size() || startTrain > finalTrain) {
return 0;
}
- rc.initialPredictionRuns(startTrain, finalTrain);
+ // the optimal run might change
+ optimalRun = null;
+ rc.initRuns(startTrain, finalTrain);
+ rc.executePredictions(startTrain, finalTrain);
int value = rc.calculateRevenue(startTrain, finalTrain);
return value;
}
Modified: trunk/18xx/rails/algorithms/RevenueCalculator.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueCalculator.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/algorithms/RevenueCalculator.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -142,6 +142,7 @@
trainStackPos = new int[nbTrains];
trainBottomActive = new boolean[nbTrains];
trainStartEdge = new int[nbTrains];
+ maxCumulatedTrainRevenues = new int[nbTrains];
bonusValue = new int[nbBonuses];
bonusRequiresVertices = new int[nbBonuses];
@@ -324,21 +325,31 @@
log.info("maxCumulatedTrainRevenues = " + Arrays.toString(maxCumulatedTrainRevenues));
}
- final void initialPredictionRuns(final int startTrain, final int finalTrain) {
-
+ final void initRuns(final int startTrain, final int finalTrain) {
+ log.info("RC: init runs from " + startTrain + " to " + finalTrain);
if (startTrain > finalTrain) return;
this.startTrainSet = startTrain;
this.finalTrainSet = finalTrain;
- useRevenuePrediction = true;
- this.maxCumulatedTrainRevenues = new int[nbTrains];
- for (int i=0; i < nbTrains; i++) {
+
+ // initialize all trains and currentValues
+ for (int i = startTrain; i < finalTrain; i++) {
currentBestRun[i][0] = -1;
}
+ currentBestValue = 0;
+
+ }
+ final void executePredictions(final int startTrain, final int finalTrain) {
+ useRevenuePrediction = true;
+
+ if (startTrain > finalTrain) return;
+
initRevenueValues(startTrain, finalTrain);
- if (startTrain == finalTrain) return;
+ if (startTrain == finalTrain) {
+ return;
+ }
// start prediction runs
nbEvaluations = 0; nbPredictions = 0; nbEdgesTravelled = 0;
@@ -380,17 +391,8 @@
final int calculateRevenue(final int startTrain, final int finalTrain) {
log.info("RC: calculateRevenue trains from " + startTrain + " to " + finalTrain);
- if (!useRevenuePrediction) {
- for (int i=0; i < nbTrains; i++) {
- currentBestRun[i][0] = -1;
- }
- }
-
- this.startTrainSet = startTrain;
- this.finalTrainSet = finalTrain;
-
this.startTrain = startTrain;
- this.finalTrainSet = finalTrain;
+ this.finalTrain = finalTrain;
runTrain(startTrain);
Modified: trunk/18xx/rails/algorithms/RevenueDynamicModifier.java
===================================================================
--- trunk/18xx/rails/algorithms/RevenueDynamicModifier.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/algorithms/RevenueDynamicModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -3,30 +3,64 @@
import java.util.List;
/**
- * Classes that change properties of the revenue calculation
- * after the actual calculation started implement the dynamic modifier.
+ * A dynamic modifier allows to change revenue calculation
+ * during the revenue calculation
+ *
+ * For any modfication that only change the setup (e.g. adding bonuses, change train attributes)
+ * the simpler {@link RevenueStaticModifier} is preferred.
*
* They have to register themselves to the RevenueManager via the GameManager instance.
+ *
+ * Caveats:
+ * Usually only one instance of a dynamic modifier is needed.
+ * The interaction between several dynamic modifiers can be complicated.
+ *
+ *
* @author freystef
- *
*/
public interface RevenueDynamicModifier {
- /** after the setup of the revenueAdapter, but before the actual calculation
- * if return is false => deactivate */
+ /** method called after the setup of the revenueAdapter, but before the actual calculation
+ * @return true => active, false => deactivate */
public boolean prepareModifier(RevenueAdapter revenueAdapter);
- /** returns the value used for prediction */
+ /**
+ * Allows to change the value for the prediction
+ * If several dynamic modifiers are active simultaneously, their prediction values are added up.
+ * @return value used to change the prediction
+ */
public int predictionValue();
- /** returns the value used for evaluation (at the runs supplied) */
+ /**
+ * Allows to change the value for the supplied runs from the revenue calculator
+ * @param runs Current run of the revenue calculator
+ * @param optimalRuns true => after optimization, false => during optimization
+ * @return value used to change the run results
+ */
public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns);
- /** allows to adjust the run list of the optimal train run output */
+ /**
+ * Allows to adjust the run list of the optimal train run output
+ * @param optimalRuns Optimized run from the revenue calculator
+ * */
public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns);
+
+ /**
+ * If the modifier uses its own method for revenue calculation
+ */
+ public boolean providesOwnCalculateRevenue();
+
+ /**
+ * Allows to replace the usual calculation process (evaluate all trains simultaneously)
+ * If several dynamic modifier have their own method, their prediction values are added up.
+ * @return optimal value
+ */
+ public int calculateRevenue(RevenueAdapter revenueAdpater);
- /** returns the results as pretty prints */
- public String prettyPrint(RevenueAdapter adapter);
+ /**
+ * Allows to append additional text
+ * @return String output for display in Rails */
+ public String prettyPrint(RevenueAdapter revenueAdapter);
}
Modified: trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java
===================================================================
--- trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -8,21 +8,23 @@
import rails.algorithms.RevenueAdapter;
import rails.algorithms.RevenueDynamicModifier;
import rails.algorithms.RevenueTrainRun;
+import rails.common.LocalText;
+import rails.game.TrainManager;
/**
- * 1825 modifiers:
- * Trains have to start and end in a major station
- * Allows two 2-trains to run as a 3-train (double heading)
+ * Double heading modifier
+ * Allows two trains to run as a longer train (double heading)
*/
public class DoubleHeadingModifier implements RevenueDynamicModifier {
- private final static String TRAIN_2_NAME = "2";
- private final static String DUALHEAD_NAME = "2&2";
+ private final static String TRAIN_SINGLE = "2";
+ private final static String DOUBLEHEAD_NAME = "2&2";
+ private final static String TRAIN_DOUBLE = "3";
public boolean prepareModifier(RevenueAdapter revenueAdapter) {
int nbTrain2 = 0;
for (NetworkTrain train:revenueAdapter.getTrains()) {
- // checks name of traintype
- if (train.getRailsTrainType().getName().equals(TRAIN_2_NAME)) {
+ // checks name of train
+ if (train.getTrainName().equals(TRAIN_SINGLE)) {
nbTrain2 ++;
}
}
@@ -30,7 +32,8 @@
// add dualhead 3 train for each of a pair of 2-trains
boolean hasDualHead = false;
while (nbTrain2 >= 2) {
- NetworkTrain dualHead = new NetworkTrain(3, 0, false, 1, 1, DUALHEAD_NAME, null);
+ NetworkTrain dualHead = NetworkTrain.createFromString(TRAIN_DOUBLE);
+ dualHead.setTrainName(DOUBLEHEAD_NAME);
revenueAdapter.addTrain(dualHead);
hasDualHead = true;
nbTrain2 -= 2;
@@ -53,7 +56,7 @@
// find and sort the train2Revenues
List<RevenueTrainRun> train2Runs = new ArrayList<RevenueTrainRun>();
for (RevenueTrainRun run:runs) {
- if (run.getTrain().getTrainName().equals(TRAIN_2_NAME)) {
+ if (run.getTrain().getTrainName().equals(TRAIN_SINGLE)) {
train2Runs.add(run);
}
}
@@ -64,7 +67,7 @@
// find DualHeads and remove two 2-train revenues
for (RevenueTrainRun run:runs) {
// only if train has non zero value
- if (run.getTrain().getTrainName().equals(DUALHEAD_NAME) && run.getRunValue() !=0) {
+ if (run.getTrain().getTrainName().equals(DOUBLEHEAD_NAME) && run.getRunValue() !=0) {
// two trains get removed
index2Runs += 2;
}
@@ -97,16 +100,25 @@
// remove double heading trains that do not generate value
List<RevenueTrainRun> removeDoubleHeading = new ArrayList<RevenueTrainRun>();
for (RevenueTrainRun run:optimalRuns) {
- if (run.getTrain().getTrainName().equals(DUALHEAD_NAME) && run.getRunValue() == 0) {
+ if (run.getTrain().getTrainName().equals(DOUBLEHEAD_NAME) && run.getRunValue() == 0) {
removeDoubleHeading.add(run);
}
}
optimalRuns.removeAll(removeDoubleHeading);
}
+ public boolean providesOwnCalculateRevenue() {
+ // does not
+ return false;
+ }
+
+ public int calculateRevenue(RevenueAdapter revenueAdpater) {
+ // zero does no change
+ return 0;
+ }
+
public String prettyPrint(RevenueAdapter adapter) {
- // nothing to print
- return null;
+ return LocalText.getText("DoubleHeadingModifier1825", DOUBLEHEAD_NAME, TRAIN_SINGLE, TRAIN_DOUBLE);
}
}
Modified: trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java
===================================================================
--- trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -48,7 +48,16 @@
run.getRunVertices().clear();
}
}
+ public boolean providesOwnCalculateRevenue() {
+ // does not
+ return false;
+ }
+ public int calculateRevenue(RevenueAdapter revenueAdpater) {
+ // zero does no change
+ return 0;
+ }
+
public String prettyPrint(RevenueAdapter adapter) {
// nothing to do
return null;
Added: trunk/18xx/rails/game/specific/_1826/TGVModifier.java
===================================================================
--- trunk/18xx/rails/game/specific/_1826/TGVModifier.java (rev 0)
+++ trunk/18xx/rails/game/specific/_1826/TGVModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -0,0 +1,82 @@
+package rails.game.specific._1826;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import rails.algorithms.NetworkTrain;
+import rails.algorithms.RevenueAdapter;
+import rails.algorithms.RevenueDynamicModifier;
+import rails.algorithms.RevenueTrainRun;
+import rails.common.LocalText;
+
+/**
+ * TGV is a train that runs on independent track (defined in Game 1826)
+ * implementation allows several tgv trains
+ * @author freystef
+ */
+public class TGVModifier implements RevenueDynamicModifier {
+
+ final private String TGV_NAME = "TGV";
+
+ private int nbTGV = 0; // store the number of tgv
+
+ public boolean prepareModifier(RevenueAdapter revenueAdapter) {
+
+ // separate trains into tgv and others
+ List<NetworkTrain> allTrains = revenueAdapter.getTrains();
+ List<NetworkTrain> tgvTrains = new ArrayList<NetworkTrain>();
+ List<NetworkTrain> otherTrains = new ArrayList<NetworkTrain>();
+ for (NetworkTrain train:allTrains) {
+ // checks name of train
+ if (train.getTrainName().equals(TGV_NAME)) {
+ tgvTrains.add(train);
+ } else {
+ otherTrains.add(train);
+ }
+ }
+
+ // change list that tgv trains are the first ones, if there are tgvs ...
+ nbTGV = tgvTrains.size();
+ if (nbTGV != 0) {
+ allTrains.clear();
+ allTrains.addAll(tgvTrains);
+ allTrains.addAll(otherTrains);
+ return true;
+ } else { // ... otherwise deactivate modifier
+ return false;
+ }
+ }
+
+ public int predictionValue() {
+ // nothing to do here
+ return 0;
+ }
+
+ public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns) {
+ // nothing to do here
+ return 0;
+ }
+
+ public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) {
+ // nothing to do
+ }
+
+ public boolean providesOwnCalculateRevenue() {
+ return true;
+ }
+
+ public int calculateRevenue(RevenueAdapter revenueAdapter) {
+ // tgv run separately (see prepare modifier above)
+ int value = 0;
+ value = revenueAdapter.calculateRevenue(0, nbTGV-1);
+ // add the other trains
+ value += revenueAdapter.calculateRevenue(nbTGV, revenueAdapter.getTrains().size()-1);
+ return value;
+ }
+
+ public String prettyPrint(RevenueAdapter adapter) {
+ return LocalText.getText("TGVModifier");
+ }
+
+
+}
Property changes on: trunk/18xx/rails/game/specific/_1826/TGVModifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java
===================================================================
--- trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -118,6 +118,16 @@
// do nothing here (all is done by changing the evaluation value)
}
+ public boolean providesOwnCalculateRevenue() {
+ // does not
+ return false;
+ }
+
+ public int calculateRevenue(RevenueAdapter revenueAdpater) {
+ // zero does no change
+ return 0;
+ }
+
public String prettyPrint(RevenueAdapter revenueAdapter) {
List<RevenueTrainRun> runs = revenueAdapter.getOptimalRun();
StringBuffer prettyPrint = new StringBuffer();
Modified: trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java
===================================================================
--- trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java 2011-07-09 12:07:23 UTC (rev 1613)
+++ trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java 2011-07-16 06:23:19 UTC (rev 1614)
@@ -49,6 +49,15 @@
return maxValue;
}
+ public boolean providesOwnCalculateRevenue() {
+ // does not
+ return false;
+ }
+
+ public int calculateRevenue(RevenueAdapter revenueAdpater) {
+ // zero does no change
+ return 0;
+ }
public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) {
// do nothing here (all is done by changing the evaluation value)
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|