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 Chemins de Fer Belges " type="Major" tokens="5" fgColour="000000" bgColour="DDAA00"> - </Company> - <Company name="NS" longname="Nederlandsche Spoorwegen" type="Major" tokens="5" fgColour="0000FF" bgColour="FFDD00"> - </Company> - <Company name="KBS" longname="Königlich-Bayerische Staatseisenbahn" type="Major" tokens="5" fgColour="000000" bgColour="C0E0FF"> - </Company> - <Company name="KPEV" longname="Königlich-Preussische Eisenbahn-Verwaltung" type="Major" tokens="5" fgColour="000000" bgColour="2255FF"> - </Company> - <Company name="KKÖB" longname="Kaiserlich-Königliche Österreichische Staatsbahn" type="Major" tokens="5" fgColour="000000" bgColour="FFFF00"> - </Company> - <Company name="FS" longname="Ferrovie dello Stato" type="Major" tokens="5" fgColour="FFFFFF" bgColour="00AA00"> - </Company> - <Company name="SNCF" longname="Société Nationale des Chemins de Fer Français" type="Major" tokens="5" fgColour="FFFFFF" bgColour="FF0000"> - </Company> - <Company name="DR" longname="Deutsche Reichsbahn" type="Major" tokens="5" fgColour="FFFFFF" bgColour="000000"> - </Company> - - <StartPacket roundClass="rails.game.specific._18EU.StartRound_18EU"> - <Bidding initial="0" minimum="5" increment="5"/> - <Item name="1" type="Minor" basePrice="100"/> - <Item name="2" type="Minor" basePrice="100"/> - <Item name="3" type="Minor" basePrice="100"/> - <Item name="4" type="Minor" basePrice="100"/> - <Item name="5" type="Minor" basePrice="100"/> - <Item name="6" type="Minor" basePrice="100"/> - <Item name="7" type="Minor" basePrice="100"/> - <Item name="8" type="Minor" basePrice="100"/> - <Item name="9" type="Minor" basePrice="100"/> - <Item name="10" type="Minor" basePrice="100"/> - <Item name="11" type="Minor" basePrice="100"/> - <Item name="12" type="Minor" basePrice="100"/> - <Item name="13" type="Minor" basePrice="100"/> - <Item name="14" type="Minor" basePrice="100"/> - <Item name="15" type="Minor" basePrice="100"/> - </StartPacket> -</CompanyManager> +<?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 limit="2,2,1" mandatory="no"/> + <InitialTrain type="2" cost="0" tradeable="yes"/> + </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 limit="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 Chemins de Fer Belges " + type="Major" tokens="5" fgColour="000000" bgColour="DDAA00"> + </Company> + <Company name="NS" longname="Nederlandsche Spoorwegen" type="Major" tokens="5" + fgColour="0000FF" bgColour="FFDD00"> + </Company> + <Company name="KBS" longname="Königlich-Bayerische Staatseisenbahn" + type="Major" tokens="5" fgColour="000000" bgColour="C0E0FF"> + </Company> + <Company name="KPEV" longname="Königlich-Preussische Eisenbahn-Verwaltung" + type="Major" tokens="5" fgColour="000000" bgColour="2255FF"> + </Company> + <Company name="KKÖB" + longname="Kaiserlich-Königliche Österreichische Staatsbahn" type="Major" + tokens="5" fgColour="000000" bgColour="FFFF00"> + </Company> + <Company name="FS" longname="Ferrovie dello Stato" type="Major" tokens="5" + fgColour="FFFFFF" bgColour="00AA00"> + </Company> + <Company name="SNCF" longname="Société Nationale des Chemins de Fer Français" + type="Major" tokens="5" fgColour="FFFFFF" bgColour="FF0000"> + </Company> + <Company name="DR" longname="Deutsche Reichsbahn" type="Major" tokens="5" + fgColour="FFFFFF" bgColour="000000"> + </Company> + + <StartPacket roundClass="rails.game.specific._18EU.StartRound_18EU"> + <Bidding initial="0" minimum="5" increment="5"/> + <Item name="1" type="Minor" basePrice="100"/> + <Item name="2" type="Minor" basePrice="100"/> + <Item name="3" type="Minor" basePrice="100"/> + <Item name="4" type="Minor" basePrice="100"/> + <Item name="5" type="Minor" basePrice="100"/> + <Item name="6" type="Minor" basePrice="100"/> + <Item name="7" type="Minor" basePrice="100"/> + <Item name="8" type="Minor" basePrice="100"/> + <Item name="9" type="Minor" basePrice="100"/> + <Item name="10" type="Minor" basePrice="100"/> + <Item name="11" type="Minor" basePrice="100"/> + <Item name="12" type="Minor" basePrice="100"/> + <Item name="13" type="Minor" basePrice="100"/> + <Item name="14" type="Minor" basePrice="100"/> + <Item name="15" type="Minor" basePrice="100"/> + </StartPacket> +</CompanyManager> \ No newline at end of file Modified: trunk/18xx/data/18EU/Game.xml =================================================================== --- trunk/18xx/data/18EU/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18EU/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -54,34 +54,34 @@ <Reach base="stops" countTowns="no"/> <Score towns="yes"/> </Defaults> - <Train name="2" majorStops="2" cost="100" amount="15"/> + <Train name="2" majorStops="2" cost="100" quantity="15"/> <Train name="3" majorStops="3" cost="200" startPhase="3" releasedTrain="P"> <IfOption name="Extra3Trains" value="0"> - <Attributes amount="5"/> + <Attributes quantity="5"/> </IfOption> <IfOption name="Extra3Trains" value="1"> - <Attributes amount="6"/> + <Attributes quantity="6"/> </IfOption> <IfOption name="Extra3Trains" value="2"> - <Attributes amount="7"/> + <Attributes quantity="7"/> </IfOption> </Train> <Train name="4" majorStops="4" cost="300" startPhase="4" rustedTrain="2"> <IfOption name="Extra4Trains" value="0"> - <Attributes amount="4"/> + <Attributes quantity="4"/> </IfOption> <IfOption name="Extra4Trains" value="1"> - <Attributes amount="5"/> + <Attributes quantity="5"/> </IfOption> </Train> - <Train name="5" majorStops="5" cost="500" amount="3" startPhase="5"/> - <Train name="6" majorStops="6" cost="600" amount="2" startPhase="6" + <Train name="5" majorStops="5" cost="500" quantity="3" startPhase="5"/> + <Train name="6" majorStops="6" cost="600" quantity="2" startPhase="6" rustedTrain="3"/> - <Train name="8" majorStops="8" cost="800" amount="-1" startPhase="8" + <Train name="8" majorStops="8" cost="800" quantity="-1" startPhase="8" rustedTrain="4"/> <!-- majorStops="-1" indicates that this not a normally running train--> - <Train name="P" initialPortfolio="Pool" majorStops="-1" cost="100" amount="5"/> + <Train name="P" initialPortfolio="Pool" majorStops="-1" cost="100" quantity="5"/> </Component> <Component name="PhaseManager" class="rails.game.PhaseManager"> <Phase name="2" > Modified: trunk/18xx/data/18GA/CompanyManager.xml =================================================================== --- trunk/18xx/data/18GA/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18GA/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -17,7 +17,7 @@ <HomeBase lay="firstOR"/> <LayCost method="sequence" cost="0,40,100"/> </BaseTokens> - <Trains number="4,4,3,2"/> + <Trains limit="4,4,3,2"/> <CanBuyPrivates/> <CanUseSpecialProperties/> </CompanyType> Modified: trunk/18xx/data/18GA/Game.xml =================================================================== --- trunk/18xx/data/18GA/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18GA/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -54,20 +54,20 @@ <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" /> - <Train name="5" majorStops="5" cost="450" amount="2" startPhase="5"/> - <Train name="6" majorStops="6" cost="630" amount="2" startPhase="6" + <Train name="5" majorStops="5" cost="450" quantity="2" startPhase="5"/> + <Train name="6" majorStops="6" cost="630" 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="5"/> + <Attributes quantity="5"/> </IfOption> </Train> </Component> Modified: trunk/18xx/data/18JR/CompanyManager.xml =================================================================== --- trunk/18xx/data/18JR/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18JR/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -18,7 +18,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/18JR/Game.xml =================================================================== --- trunk/18xx/data/18JR/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18JR/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -91,32 +91,32 @@ 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="6" majorStops="6" cost="630" amount="2" startPhase="6" + <Train name="5" majorStops="5" cost="450" quantity="3" startPhase="5"/> + <!--Train name="6" majorStops="6" cost="630" quantity="2" startPhase="6" rustedTrain="3" releasedTrain="D"/--> <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"> - <Attributes amount="3"/> + <Attributes quantity="3"/> </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/18Kaas/CompanyManager.xml =================================================================== --- trunk/18xx/data/18Kaas/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18Kaas/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="SVNRR" type="Private" basePrice="20" revenue="5"> Modified: trunk/18xx/data/18Kaas/Game.xml =================================================================== --- trunk/18xx/data/18Kaas/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18Kaas/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -57,21 +57,21 @@ 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" amount="6" startPhase="D" + <Train name="D" majorStops="99" cost="1100" quantity="6" startPhase="D" rustedTrain="4"> <Exchange cost="800"/> </Train> Modified: trunk/18xx/data/18Scan/CompanyManager.xml =================================================================== --- trunk/18xx/data/18Scan/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18Scan/CompanyManager.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -14,7 +14,7 @@ <BaseTokens> <HomeBase lay="whenStarted"/> </BaseTokens> - <Trains number="2,2,1,0" mandatory="no"/> + <Trains limit="2,2,1,0" mandatory="no"/> </CompanyType> <CompanyType name="Public" class="rails.game.PublicCompany"> @@ -28,7 +28,7 @@ <HomeBase lay="firstOR"/> <LayCost method="sequence" cost="0,40,100"/> </BaseTokens> - <Trains number="4,4,3,2"/> + <Trains limit="4,4,3,2"/> <CanUseSpecialProperties/> </CompanyType> <Company name="Ferry" type="Private" basePrice="120" revenue="20" @@ -66,7 +66,7 @@ </Company> <Company name="SJ" type="Public" tokens="6" fgColour="FFCC11" bgColour="9370DB" longname="Statens Järnvägar"> - <Trains number="3"/> + <Trains limit="3"/> </Company> <StartPacket roundClass="rails.game.StartRound_1830"> Modified: trunk/18xx/data/18Scan/Game.xml =================================================================== --- trunk/18xx/data/18Scan/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18Scan/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -44,14 +44,14 @@ <Reach base="stops" countTowns="no"/> <Score towns="yes"/> </Defaults> - <Train name="2" majorStops="2" cost="100" amount="6"/> - <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="6"/> + <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" releasedTrain="5E"/> - <Train name="5E" majorStops="5" cost="600" amount="2" startPhase="6" releasedTrain="4D" + <Train name="5" majorStops="5" cost="500" quantity="2" startPhase="5" releasedTrain="5E"/> + <Train name="5E" majorStops="5" cost="600" quantity="2" startPhase="6" releasedTrain="4D" rustedTrain="3"/> - <Train name="4D" majorStops="4" cost="800" amount="6" startPhase="4D" + <Train name="4D" majorStops="4" cost="800" quantity="6" startPhase="4D" rustedTrain="4"> </Train> </Component> Modified: trunk/18xx/data/18TN/CompanyManager.xml =================================================================== --- trunk/18xx/data/18TN/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18TN/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/> <TileLays> <Number colour="yellow" phase="3,4,5,6,8" number="2"/> Modified: trunk/18xx/data/18TN/Game.xml =================================================================== --- trunk/18xx/data/18TN/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18TN/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -66,14 +66,14 @@ cities="double" if city-revenue is doubled (e.g. 1826 TGV). --> </Defaults> - <Train name="2" majorStops="2" cost="80" amount="5" obsoleting="yes"/> - <Train name="3" majorStops="3" cost="180" amount="5" obsoleting="yes" startPhase="3"/> - <Train name="4" majorStops="4" cost="300" amount="3" obsoleting="yes" startPhase="4" + <Train name="2" majorStops="2" cost="80" quantity="5" obsoleting="yes"/> + <Train name="3" majorStops="3" cost="180" quantity="5" obsoleting="yes" startPhase="3"/> + <Train name="4" majorStops="4" cost="300" quantity="3" obsoleting="yes" startPhase="4" rustedTrain="2" /> - <Train name="5" majorStops="5" cost="450" amount="2" startPhase="5"/> - <Train name="6" majorStops="6" cost="630" amount="2" startPhase="6" + <Train name="5" majorStops="5" cost="450" quantity="2" startPhase="5"/> + <Train name="6" majorStops="6" cost="630" quantity="2" startPhase="6" rustedTrain="3" /> - <Train name="8" majorStops="8" cost="700" amount="7" startPhase="8" + <Train name="8" majorStops="8" cost="700" quantity="7" startPhase="8" rustedTrain="4" /> </Component> <Component name="PhaseManager" class="rails.game.PhaseManager"> Modified: trunk/18xx/data/18VA/CompanyManager.xml =================================================================== --- trunk/18xx/data/18VA/CompanyManager.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18VA/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> Modified: trunk/18xx/data/18VA/Game.xml =================================================================== --- trunk/18xx/data/18VA/Game.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/18VA/Game.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -71,16 +71,16 @@ cities="double" if city-revenue is doubled (e.g. 1826 TGV). --> </Defaults> - <Train name="2" majorStops="2" cost="100" amount="6"/> - <Train name="3" majorStops="3" cost="200" amount="5" startPhase="3"/> - <Train name="4" majorStops="4" cost="300" amount="4" startPhase="4" + <Train name="2" majorStops="2" cost="100" quantity="6"/> + <Train name="3" majorStops="3" cost="200" quantity="5" startPhase="3"/> + <Train name="4" majorStops="4" cost="300" quantity="4" startPhase="4" rustedTrain="2"/> - <Train name="5" majorStops="5" cost="500" amount="3" startPhase="5" + <Train name="5" majorStops="5" cost="500" quantity="3" startPhase="5" rustedTrain="3"/> <Train name="6" majorStops="6" cost="600" startPhase="6" releasedTrain="4D"> </Train> - <Train name="4D" majorStops="99" cost="800" amount="10" startPhase="4D" + <Train name="4D" majorStops="99" cost="800" quantity="10" startPhase="4D" rustedTrain="4"> </Train> </Component> Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/data/GamesList.xml 2011-05-19 12:13:55 UTC (rev 1562) @@ -28,7 +28,7 @@ - optionally, a default value (only affects a toggle; in a dropdown the first item is always the default). --> - <Option name="Variant" values="Basegame,Pere Marquette,Coalfields,Reading,Coalfields&Reading,Wabash" default="Basegame" /> + <Option name="Variant" values="Basegame,Pere Marquette,Coalfields,Reading,Coalfields&Reading,Simple,Wabash" 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" /> Modified: trunk/18xx/rails/game/PublicCompany.java =================================================================== --- trunk/18xx/rails/game/PublicCompany.java 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/rails/game/PublicCompany.java 2011-05-19 12:13:55 UTC (rev 1562) @@ -256,7 +256,9 @@ protected boolean canClose = true; /** Initial train at floating time */ - protected String initialTrain = null; + protected String initialTrainType = null; + protected int initialTrainCost = 0; + protected boolean initialTrainTradeable = true; /* Loans */ protected int maxNumberOfLoans = 0; @@ -396,11 +398,19 @@ Tag trainsTag = tag.getChild("Trains"); if (trainsTag != null) { - trainLimit = trainsTag.getAttributeAsIntegerArray("number"); + trainLimit = trainsTag.getAttributeAsIntegerArray("limit"); mustOwnATrain = trainsTag.getAttributeAsBoolean("mandatory", mustOwnATrain); - initialTrain = trainsTag.getAttributeAsString("initial"); } + + Tag initialTrainTag = tag.getChild("InitialTrain"); + if (initialTrainTag != null) { + initialTrainType = initialTrainTag.getAttributeAsString("type"); + initialTrainCost = initialTrainTag.getAttributeAsInteger("cost", + initialTrainCost); + initialTrainTradeable = initialTrainTag.getAttributeAsBoolean("tradeable", + initialTrainTradeable); + } Tag firstTrainTag = tag.getChild("FirstTrainCloses"); if (firstTrainTag != null) { @@ -961,11 +971,12 @@ layHomeBaseTokens(); } - if (initialTrain != null) { + if (initialTrainType != null) { TrainManager trainManager = gameManager.getTrainManager(); - TrainTypeI type = trainManager.getTypeByName(initialTrain); + TrainTypeI type = trainManager.getTypeByName(initialTrainType); TrainI train = bank.getIpo().getTrainOfType(type); - buyTrain(train, 0); + buyTrain(train, initialTrainCost); + train.setTradeable(initialTrainTradeable); trainManager.checkTrainAvailability(train, bank.getIpo()); } } Modified: trunk/18xx/rails/game/Train.java =================================================================== --- trunk/18xx/rails/game/Train.java 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/rails/game/Train.java 2011-05-19 12:13:55 UTC (rev 1562) @@ -17,6 +17,9 @@ protected int cityScoreFactor; protected int townScoreFactor; protected int townCountIndicator; + + /** Some specific trains cannot be traded between companies */ + protected boolean tradeable = true; protected String uniqueId; @@ -142,4 +145,12 @@ return getName(); } + public boolean isTradeable() { + return tradeable; + } + + public void setTradeable(boolean tradeable) { + this.tradeable = tradeable; + } + } Modified: trunk/18xx/rails/game/TrainI.java =================================================================== --- trunk/18xx/rails/game/TrainI.java 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/rails/game/TrainI.java 2011-05-19 12:13:55 UTC (rev 1562) @@ -64,5 +64,7 @@ public boolean canBeExchanged(); public String toDisplay(); - + + public boolean isTradeable(); + public void setTradeable(boolean tradeable); } Modified: trunk/18xx/rails/game/TrainType.java =================================================================== --- trunk/18xx/rails/game/TrainType.java 2011-05-16 23:17:44 UTC (rev 1561) +++ trunk/18xx/rails/game/TrainType.java 2011-05-19 12:13:55 UTC (rev 1562) @@ -22,7 +22,7 @@ protected Class<? extends Train> trainClass; protected String name; - protected int amount; + protected int quantity; protected boolean infiniteAmount = false; /** Index: used for sorting trains lists in configured order. */ @@ -117,12 +117,12 @@ } // Amount - amount = tag.getAttributeAsInteger("amount"); - if (amount == -1) { + quantity = tag.getAttributeAsInteger("quantity"); + if (quantity == -1) { infiniteAmount = true; - } else if (amount <= 0) { + } else if (quantity <= 0) { throw new ConfigurationException( - LocalText.getText("InvalidAmount")); + LocalText.getText("InvalidQuantity", String.valueOf(quantity))); } // Major stops @@ -153,7 +153,7 @@ initialPortfolio); } else { name = ""; - amount = 0; + quantity = 0; } // Reach @@ -209,7 +209,7 @@ train = createTrain(); trains.add(train); } else { - for (int i = 0; i < amount; i++) { + for (int i = 0; i < quantity; i++) { train = createTrain (); trains.add(train); } @@ -479,7 +479,7 @@ public String getInfo() { StringBuilder b = new StringBuilder ("<html>"); - b.append(LocalText.getText("TrainInfo", name, Bank.format(cost), amount)); + b.append(LocalText.getText("TrainInfo", name, Bank.format(cost), quantity)); if (Util.hasValue(startedPhaseName)) { appendInfoText(b, LocalText.getText("StartsPhase", startedPhaseName)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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.965,99 645.553,72 629.965,45 614.376,18 583.2,18 552.023,18 536.435,45 520.846,72 536.435,99 552.023,126 " + id="polygon173" + style="fill:#00ccff;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,126 614.376,126 629.965,99 645.553,72 629.965,45 614.376,18 583.2,18 552.023,18 536.435,45 520.846,72 536.435,99 552.023,126 " + id="polygon175" + 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,450 614.376,450 629.965,423 645.553,396 629.965,369 614.376,342 583.2,342 552.023,342 536.435,369 520.846,396 536.435,423 552.023,450 " + id="polygon177" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,450 614.376,450 629.965,423 645.553,396 629.965,369 614.376,342 583.2,342 552.023,342 536.435,369 520.846,396 536.435,423 552.023,450 " + id="polygon179" + 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,558 614.376,558 629.965,531 645.553,504 629.965,477 614.376,450 583.2,450 552.023,450 536.435,477 520.846,504 536.435,531 552.023,558 " + id="polygon181" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,558 614.376,558 629.965,531 645.553,504 629.965,477 614.376,450 583.2,450 552.023,450 536.435,477 520.846,504 536.435,531 552.023,558 " + id="polygon183" + 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,666 614.376,666 629.965,639 645.553,612 629.965,585 614.376,558 583.2,558 552.023,558 536.435,585 520.846,612 536.435,639 552.023,666 " + id="polygon185" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,666 614.376,666 629.965,639 645.553,612 629.965,585 614.376,558 583.2,558 552.023,558 536.435,585 520.846,612 536.435,639 552.023,666 " + id="polygon187" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,396 707.977,396 723.565,369 739.153,342 723.565,315 707.977,288 676.8,288 645.624,288 630.035,315 614.446,342 630.035,369 645.624,396 " + id="polygon189" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,396 707.977,396 723.565,369 739.153,342 723.565,315 707.977,288 676.8,288 645.624,288 630.035,315 614.446,342 630.035,369 645.624,396 " + id="polygon191" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,288 707.977,288 723.565,261 739.153,234 723.565,207 707.977,180 676.8,180 645.624,180 630.035,207 614.446,234 630.035,261 645.624,288 " + id="polygon193" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,288 707.977,288 723.565,261 739.153,234 723.565,207 707.977,180 676.8,180 645.624,180 630.035,207 614.446,234 630.035,261 645.624,288 " + id="polygon195" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,504 707.977,504 723.565,477 739.153,450 723.565,423 707.977,396 676.8,396 645.624,396 630.035,423 614.446,450 630.035,477 645.624,504 " + id="polygon197" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,504 707.977,504 723.565,477 739.153,450 723.565,423 707.977,396 676.8,396 645.624,396 630.035,423 614.446,450 630.035,477 645.624,504 " + id="polygon199" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,612 707.977,612 723.565,585 739.153,558 723.565,531 707.977,504 676.8,504 645.624,504 630.035,531 614.446,558 630.035,585 645.624,612 " + id="polygon201" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,612 707.977,612 723.565,585 739.153,558 723.565,531 707.977,504 676.8,504 645.624,504 630.035,531 614.446,558 630.035,585 645.624,612 " + id="polygon203" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,450 801.577,450 817.165,423 832.753,396 817.165,369 801.577,342 770.4,342 739.224,342 723.635,369 708.046,396 723.635,423 739.224,450 " + id="polygon205" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,450 801.577,450 817.165,423 832.753,396 817.165,369 801.577,342 770.4,342 739.224,342 723.635,369 708.046,396 723.635,423 739.224,450 " + id="polygon207" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,342 801.577,342 817.165,315 832.753,288 817.165,261 801.577,234 770.4,234 739.224,234 723.635,261 708.046,288 723.635,315 739.224,342 " + id="polygon209" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,342 801.577,342 817.165,315 832.753,288 817.165,261 801.577,234 770.4,234 739.224,234 723.635,261 708.046,288 723.635,315 739.224,342 " + id="polygon211" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,234 801.577,234 817.165,207 832.753,180 817.165,153 801.577,126 770.4,126 739.224,126 723.635,153 708.046,180 723.635,207 739.224,234 " + id="polygon213" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,234 801.577,234 817.165,207 832.753,180 817.165,153 801.577,126 770.4,126 739.224,126 723.635,153 708.046,180 723.635,207 739.224,234 " + id="polygon215" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,558 801.577,558 817.165,531 832.753,504 817.165,477 801.577,450 770.4,450 739.224,450 723.635,477 708.046,504 723.635,531 739.224,558 " + id="polygon217" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,558 801.577,558 817.165,531 832.753,504 817.165,477 801.577,450 770.4,450 739.224,450 723.635,477 708.046,504 723.635,531 739.224,558 " + id="polygon219" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,666 801.577,666 817.165,639 832.753,612 817.165,585 801.577,558 770.4,558 739.224,558 723.635,585 708.046,612 723.635,639 739.224,666 " + id="polygon221" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,666 801.577,666 817.165,639 832.753,612 817.165,585 801.577,558 770.4,558 739.224,558 723.635,585 708.046,612 723.635,639 739.224,666 " + id="polygon223" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="302.4,396 333.577,396 349.165,369 364.753,342 349.165,315 333.577,288 302.4,288 271.224,288 255.635,315 240.046,342 255.635,369 271.224,396 " + id="polygon225" + style="fill:#ff0000;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="302.4,396 333.577,396 349.165,369 364.753,342 349.165,315 333.577,288 302.4,288 271.224,288 255.635,315 240.046,342 255.635,369 271.224,396 " + id="polygon227" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="302.4,504 333.577,504 349.165,477 364.753,450 349.165,423 333.577,396 302.4,396 271.224,396 255.635,423 240.046,450 255.635,477 271.224,504 " + id="polygon229" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="302.4,504 333.577,504 349.165,477 364.753,450 349.165,423 333.577,396 302.4,396 271.224,396 255.635,423 240.046,450 255.635,477 271.224,504 " + id="polygon231" + 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,936 895.176,936 910.764,909 926.353,882 910.764,855 895.176,828 863.999,828 832.823,828 817.234,855 801.646,882 817.234,909 832.823,936 " + id="polygon233" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,936 895.176,936 910.764,909 926.353,882 910.764,855 895.176,828 863.999,828 832.823,828 817.234,855 801.646,882 817.234,909 832.823,936 " + id="polygon235" + 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,828 895.176,828 910.764,801 926.353,774 910.764,747 895.176,720 863.999,720 832.823,720 817.234,747 801.646,774 817.234,801 832.823,828 " + id="polygon237" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,828 895.176,828 910.764,801 926.353,774 910.764,747 895.176,720 863.999,720 832.823,720 817.234,747 801.646,774 817.234,801 832.823,828 " + id="polygon239" + 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,1044 895.176,1044 910.764,1017 926.353,990 910.764,963 895.176,936 863.999,936 832.823,936 817.234,963 801.646,990 817.234,1017 832.823,1044 " + id="polygon241" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,1044 895.176,1044 910.764,1017 926.353,990 910.764,963 895.176,936 863.999,936 832.823,936 817.234,963 801.646,990 817.234,1017 832.823,1044 " + id="polygon243" + 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,1152 895.176,1152 910.764,1125 926.353,1098 910.764,1071 895.176,1044 863.999,1044 832.823,1044 817.234,1071 801.646,1098 817.234,1125 832.823,1152 " + id="polygon245" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,1152 895.176,1152 910.764,1125 926.353,1098 910.764,1071 895.176,1044 863.999,1044 832.823,1044 817.234,1071 801.646,1098 817.234,1125 832.823,1152 " + id="polygon247" + 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,1260 895.176,1260 910.764,1233 926.353,1206 910.764,1179 895.176,1152 863.999,1152 832.823,1152 817.234,1179 801.646,1206 817.234,1233 832.823,1260 " + id="polygon249" + style="fill:#ff0000;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,1260 895.176,1260 910.764,1233 926.353,1206 910.764,1179 895.176,1152 863.999,1152 832.823,1152 817.234,1179 801.646,1206 817.234,1233 832.823,1260 " + id="polygon251" + 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,720 895.176,720 910.764,693 926.353,666 910.764,639 895.176,612 863.999,612 832.823,612 817.234,639 801.646,666 817.234,693 832.823,720 " + id="polygon253" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="863.999,720 895.176,720 910.764,693 926.353,666 910.764,639 895.176,612 863.999,612 832.823,612 817.234,639 801.646,666 817.234,693 832.823,720 " + id="polygon255" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="396,882 427.177,882 442.765,855 458.353,828 442.765,801 427.177,774 396,774 364.823,774 349.235,801 333.646,828 349.235,855 364.823,882 " + id="polygon257" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="396,882 427.177,882 442.765,855 458.353,828 442.765,801 427.177,774 396,774 364.823,774 349.235,801 333.646,828 349.235,855 364.823,882 " + id="polygon259" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="396,774 427.177,774 442.765,747 458.353,720 442.765,693 427.177,666 396,666 364.823,666 349.235,693 333.646,720 349.235,747 364.823,774 " + id="polygon261" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="396,774 427.177,774 442.765,747 458.353,720 442.765,693 427.177,666 396,666 364.823,666 349.235,693 333.646,720 349.235,747 364.823,774 " + id="polygon263" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="396,990 427.177,990 442.765,963 458.353,936 442.765,909 427.177,882 396,882 364.823,882 349.235,909 333.646,936 349.235,963 364.823,990 " + id="polygon265" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="396,990 427.177,990 442.765,963 458.353,936 442.765,909 427.177,882 396,882 364.823,882 349.235,909 333.646,936 349.235,963 364.823,990 " + id="polygon267" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="302.4,1044 333.577,1044 349.165,1017 364.753,990 349.165,963 333.577,936 302.4,936 271.224,936 255.635,963 240.046,990 255.635,1017 271.224,1044 " + id="polygon269" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="302.4,1044 333.577,1044 349.165,1017 364.753,990 349.165,963 333.577,936 302.4,936 271.224,936 255.635,963 240.046,990 255.635,1017 271.224,1044 " + id="polygon271" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="302.4,1152 333.577,1152 349.165,1125 364.753,1098 349.165,1071 333.577,1044 302.4,1044 271.224,1044 255.635,1071 240.046,1098 255.635,1125 271.224,1152 " + id="polygon273" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="302.4,1152 333.577,1152 349.165,1125 364.753,1098 349.165,1071 333.577,1044 302.4,1044 271.224,1044 255.635,1071 240.046,1098 255.635,1125 271.224,1152 " + id="polygon275" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="396,1098 427.177,1098 442.765,1071 458.353,1044 442.765,1017 427.177,990 396,990 364.823,990 349.235,1017 333.646,1044 349.235,1071 364.823,1098 " + id="polygon277" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="396,1098 427.177,1098 442.765,1071 458.353,1044 442.765,1017 427.177,990 396,990 364.823,990 349.235,1017 333.646,1044 349.235,1071 364.823,1098 " + id="polygon279" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="396,1206 427.177,1206 442.765,1179 458.353,1152 442.765,1125 427.177,1098 396,1098 364.823,1098 349.235,1125 333.646,1152 349.235,1179 364.823,1206 " + id="polygon281" + style="fill:#00ccff;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="396,1206 427.177,1206 442.765,1179 458.353,1152 442.765,1125 427.177,1098 396,1098 364.823,1098 349.235,1125 333.646,1152 349.235,1179 364.823,1206 " + id="polygon283" + 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,936 520.776,936 536.365,909 551.953,882 536.365,855 520.776,828 489.6,828 458.423,828 442.835,855 427.246,882 442.835,909 458.423,936 " + id="polygon285" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="489.6,936 520.776,936 536.365,909 551.953,882 536.365,855 520.776,828 489.6,828 458.423,828 442.835,855 427.246,882 442.835,909 458.423,936 " + id="polygon287" + 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,828 520.776,828 536.365,801 551.953,774 536.365,747 520.776,720 489.6,720 458.423,720 442.835,747 427.246,774 442.835,801 458.423,828 " + id="polygon289" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="489.6,828 520.776,828 536.365,801 551.953,774 536.365,747 520.776,720 489.6,720 458.423,720 442.835,747 427.246,774 442.835,801 458.423,828 " + id="polygon291" + 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,1044 520.776,1044 536.365,1017 551.953,990 536.365,963 520.776,936 489.6,936 458.423,936 442.835,963 427.246,990 442.835,1017 458.423,1044 " + id="polygon293" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="489.6,1044 520.776,1044 536.365,1017 551.953,990 536.365,963 520.776,936 489.6,936 458.423,936 442.835,963 427.246,990 442.835,1017 458.423,1044 " + id="polygon295" + 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,1152 520.776,1152 536.365,1125 551.953,1098 536.365,1071 520.776,1044 489.6,1044 458.423,1044 442.835,1071 427.246,1098 442.835,1125 458.423,1152 " + id="polygon297" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="489.6,1152 520.776,1152 536.365,1125 551.953,1098 536.365,1071 520.776,1044 489.6,1044 458.423,1044 442.835,1071 427.246,1098 442.835,1125 458.423,1152 " + id="polygon299" + 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,720 520.776,720 536.365,693 551.953,666 536.365,639 520.776,612 489.6,612 458.423,612 442.835,639 427.246,666 442.835,693 458.423,720 " + id="polygon301" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="489.6,720 520.776,720 536.365,693 551.953,666 536.365,639 520.776,612 489.6,612 458.423,612 442.835,639 427.246,666 442.835,693 458.423,720 " + id="polygon303" + 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,990 614.376,990 629.965,963 645.553,936 629.965,909 614.376,882 583.2,882 552.023,882 536.435,909 520.846,936 536.435,963 552.023,990 " + id="polygon305" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,990 614.376,990 629.965,963 645.553,936 629.965,909 614.376,882 583.2,882 552.023,882 536.435,909 520.846,936 536.435,963 552.023,990 " + id="polygon307" + 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,882 614.376,882 629.965,855 645.553,828 629.965,801 614.376,774 583.2,774 552.023,774 536.435,801 520.846,828 536.435,855 552.023,882 " + id="polygon309" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,882 614.376,882 629.965,855 645.553,828 629.965,801 614.376,774 583.2,774 552.023,774 536.435,801 520.846,828 536.435,855 552.023,882 " + id="polygon311" + 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,774 614.376,774 629.965,747 645.553,720 629.965,693 614.376,666 583.2,666 552.023,666 536.435,693 520.846,720 536.435,747 552.023,774 " + id="polygon313" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,774 614.376,774 629.965,747 645.553,720 629.965,693 614.376,666 583.2,666 552.023,666 536.435,693 520.846,720 536.435,747 552.023,774 " + id="polygon315" + 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,1098 614.376,1098 629.965,1071 645.553,1044 629.965,1017 614.376,990 583.2,990 552.023,990 536.435,1017 520.846,1044 536.435,1071 552.023,1098 " + id="polygon317" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,1098 614.376,1098 629.965,1071 645.553,1044 629.965,1017 614.376,990 583.2,990 552.023,990 536.435,1017 520.846,1044 536.435,1071 552.023,1098 " + id="polygon319" + 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,1206 614.376,1206 629.965,1179 645.553,1152 629.965,1125 614.376,1098 583.2,1098 552.023,1098 536.435,1125 520.846,1152 536.435,1179 552.023,1206 " + id="polygon321" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="583.2,1206 614.376,1206 629.965,1179 645.553,1152 629.965,1125 614.376,1098 583.2,1098 552.023,1098 536.435,1125 520.846,1152 536.435,1179 552.023,1206 " + id="polygon323" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,1044 707.977,1044 723.565,1017 739.153,990 723.565,963 707.977,936 676.8,936 645.624,936 630.035,963 614.446,990 630.035,1017 645.624,1044 " + id="polygon325" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,1044 707.977,1044 723.565,1017 739.153,990 723.565,963 707.977,936 676.8,936 645.624,936 630.035,963 614.446,990 630.035,1017 645.624,1044 " + id="polygon327" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,936 707.977,936 723.565,909 739.153,882 723.565,855 707.977,828 676.8,828 645.624,828 630.035,855 614.446,882 630.035,909 645.624,936 " + id="polygon329" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,936 707.977,936 723.565,909 739.153,882 723.565,855 707.977,828 676.8,828 645.624,828 630.035,855 614.446,882 630.035,909 645.624,936 " + id="polygon331" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,828 707.977,828 723.565,801 739.153,774 723.565,747 707.977,720 676.8,720 645.624,720 630.035,747 614.446,774 630.035,801 645.624,828 " + id="polygon333" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,828 707.977,828 723.565,801 739.153,774 723.565,747 707.977,720 676.8,720 645.624,720 630.035,747 614.446,774 630.035,801 645.624,828 " + id="polygon335" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,1152 707.977,1152 723.565,1125 739.153,1098 723.565,1071 707.977,1044 676.8,1044 645.624,1044 630.035,1071 614.446,1098 630.035,1125 645.624,1152 " + id="polygon337" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,1152 707.977,1152 723.565,1125 739.153,1098 723.565,1071 707.977,1044 676.8,1044 645.624,1044 630.035,1071 614.446,1098 630.035,1125 645.624,1152 " + id="polygon339" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,1260 707.977,1260 723.565,1233 739.153,1206 723.565,1179 707.977,1152 676.8,1152 645.624,1152 630.035,1179 614.446,1206 630.035,1233 645.624,1260 " + id="polygon341" + style="fill:#00ccff;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,1260 707.977,1260 723.565,1233 739.153,1206 723.565,1179 707.977,1152 676.8,1152 645.624,1152 630.035,1179 614.446,1206 630.035,1233 645.624,1260 " + id="polygon343" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="676.8,720 707.977,720 723.565,693 739.153,666 723.565,639 707.977,612 676.8,612 645.624,612 630.035,639 614.446,666 630.035,693 645.624,720 " + id="polygon345" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="676.8,720 707.977,720 723.565,693 739.153,666 723.565,639 707.977,612 676.8,612 645.624,612 630.035,639 614.446,666 630.035,693 645.624,720 " + id="polygon347" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,990 801.577,990 817.165,963 832.753,936 817.165,909 801.577,882 770.4,882 739.224,882 723.635,909 708.046,936 723.635,963 739.224,990 " + id="polygon349" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,990 801.577,990 817.165,963 832.753,936 817.165,909 801.577,882 770.4,882 739.224,882 723.635,909 708.046,936 723.635,963 739.224,990 " + id="polygon351" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,1098 801.577,1098 817.165,1071 832.753,1044 817.165,1017 801.577,990 770.4,990 739.224,990 723.635,1017 708.046,1044 723.635,1071 739.224,1098 " + id="polygon353" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <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="polygon355" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,882 801.577,882 817.165,855 832.753,828 817.165,801 801.577,774 770.4,774 739.224,774 723.635,801 708.046,828 723.635,855 739.224,882 " + id="polygon357" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,882 801.577,882 817.165,855 832.753,828 817.165,801 801.577,774 770.4,774 739.224,774 723.635,801 708.046,828 723.635,855 739.224,882 " + id="polygon359" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="770.4,774 801.577,774 817.165,747 832.753,720 817.165,693 801.577,666 770.4,666 739.224,666 723.635,693 708.046,720 723.635,747 739.224,774 " + id="polygon361" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="770.4,774 801.577,774 817.165,747 832.753,720 817.165,693 801.577,666 770.4,666 739.224,666 723.635,693 708.046,720 723.635,747 739.224,774 " + id="polygon363" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:2.61310005" /> + <polygon + clip-path="url(#SVGID_2_)" + clip-rule="evenodd" + points="302.4,720 333.577,720 349.165,693 364.753,666 349.165,639 333.577,612 302.4,612 271.224,612 255.635,639 240.046,666 255.635,693 271.224,720 " + id="polygon365" + style="fill:#ccffcc;fill-rule:evenodd" /> + <polygon + clip-path="url(#SVGID_2_)" + stroke-miterlimit="2.6131" + points="302.4,720 333.577,720 349.165,693 364.753,666 349.165,6... [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 = (exchangeCost > 0); + } + + // Can run as obsolete train + obsoleting = tag.getAttributeAsBoolean("obsoleting"); + + // Final initialisations + numberBoughtFromIPO = new IntegerState(name + "-trains_Bought", 0); + available = new BooleanState(name + "-trains_Available", false); + rusted = new BooleanState(name + "-trains_Rusted", false); + + } + + public void finishConfiguration (GameManagerI gameManager) + throws ConfigurationException { + + trainManager = gameManager.getTrainManager(); + + if (name == null) { + throw new ConfigurationException("No name specified for TrainType"); + } + + if (quantity == -1) { + infiniteQuantity = true; + } else if (quantity <= 0) { + throw new ConfigurationException("Invalid quantity "+quantity+" for train cert type "+name); + } + } + + public TrainI createTrain () throws ConfigurationException { + + TrainI train; + try { + train = trainClass.newInstance(); + } catch (InstantiationException e) { + throw new ConfigurationException( + "Cannot instantiate class " + trainClassName, e); + } catch (IllegalAccessException e) { + throw new ConfigurationException("Cannot access class " + + trainClassName + + "constructor", e); + } + return train; + } + + public List<TrainType> getPotentialTrainTypes() { + return potentialTrainTypes; + } + + protected void addPotentialTrainType (TrainType type) { + potentialTrainTypes.add(type); + } + + /** + * @return Returns the available. + */ + public boolean isAvailable() { + return available.booleanValue(); + } + + /** + * Make a train type available for buying by public companies. + */ + public void setAvailable() { + available.set(true); + } + + public void setRusted() { + rusted.set(true); + } + + public boolean hasRusted() { + return rusted.booleanValue(); + } + + /** + * @return Returns the name. + */ + public String getName() { + return name; + } + + /** + * @return Returns the releasedTrainTypeName. + */ + public String getReleasedTrainTypeNames() { + return releasedTrainTypeNames; + } + + /** + * @return Returns the rustedTrainTypeName. + */ + public Map<Integer,String> getRustedTrainTypeNames() { + return rustedTrainTypeNames; + } + + /** + * @param releasedTrainType The releasedTrainType to set. + */ + public void setReleasedTrainTypes(List<TrainCertificateType> releasedTrainTypes) { + this.releasedTrainTypes = releasedTrainTypes; + } + + /** + * @param rustedTrainType The rustedTrainType to set. + */ + public void setRustedTrainType(int index, TrainCertificateType rustedTrainType) { + if (this.rustedTrainType == null) { + this.rustedTrainType = new HashMap<Integer, TrainCertificateType>(); + } + this.rustedTrainType.put(index, rustedTrainType); + } + + public boolean isPermanent() { + return permanent; + } + + public boolean isObsoleting() { + return obsoleting; + } + + public void setPermanent(boolean permanent) { + this.permanent = permanent; + } + + /** + * @return Returns the releasedTrainTypes. + */ + public List<TrainCertificateType> getReleasedTrainTypes() { + return releasedTrainTypes; + } + + /** + * @return Returns the rustedTrainType. + */ + public TrainCertificateType getRustedTrainType(int index) { + if (rustedTrainType == null) return null; + return rustedTrainType.get(index); + } + + /** + * @return Returns the startedPhaseName. + */ + public String getStartedPhaseName() { + return startedPhaseName; + } + + public int getQuantity() { + return quantity; + } + + public boolean hasInfiniteQuantity() { + return infiniteQuantity; + } + + public boolean nextCanBeExchanged() { + return canBeExchanged; + } + + public void addToBoughtFromIPO() { + numberBoughtFromIPO.add(1); + } + + public int getNumberBoughtFromIPO() { + return numberBoughtFromIPO.intValue(); + } + + public int getCost() { + return cost; + } + + public int getExchangeCost() { + return exchangeCost; + } + + public String getInitialPortfolio() { + return initialPortfolio; + } + + public String getInfo() { + StringBuilder b = new StringBuilder ("<html>"); + b.append(LocalText.getText("TrainInfo", name, Bank.format(cost), quantity)); + if (Util.hasValue(startedPhaseName)) { + appendInfoText(b, LocalText.getText("StartsPhase", startedPhaseName)); + } + 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)); + } + if (b.length() == 6) b.append(LocalText.getText("None")); + + return b.toString(); + } + + private void appendInfoText (StringBuilder b, String text) { + if (text == null || text.length() == 0) return; + if (b.length() > 6) b.append("<br>"); + b.append(text); + } + + public String toString() { + return name; + } +} Property changes on: trunk/18xx/rails/game/TrainCertificateType.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/rails/game/TrainI.java =================================================================== --- trunk/18xx/rails/game/TrainI.java 2011-06-21 21:21:43 UTC (rev 1580) +++ trunk/18xx/rails/game/TrainI.java 2011-06-21 21:25:49 UTC (rev 1581) @@ -5,7 +5,7 @@ public interface TrainI extends Moveable { - public void init(TrainTypeI type, String uniqueId); + public void init(TrainCertificateType certType, TrainType type, String uniqueId); /** * @return Returns the cost. @@ -38,10 +38,13 @@ */ public int getTownScoreFactor(); + public void setType (TrainType type); /** * @return Returns the train type. */ - public TrainTypeI getType(); + public TrainType getType(); + public TrainCertificateType getCertType(); + public TrainType getPreviousType(); public String getName(); @@ -52,6 +55,7 @@ public CashHolder getOwner(); public boolean isObsolete(); + public boolean isPermanent(); public void setHolder(Portfolio newHolder); Modified: trunk/18xx/rails/game/TrainManager.java =================================================================== --- trunk/18xx/rails/game/TrainManager.java 2011-06-21 21:21:43 UTC (rev 1580) +++ trunk/18xx/rails/game/TrainManager.java 2011-06-21 21:25:49 UTC (rev 1581) @@ -5,6 +5,7 @@ import org.apache.log4j.Logger; +import rails.game.move.ObjectMove; import rails.game.state.BooleanState; import rails.game.state.IntegerState; import rails.util.LocalText; @@ -12,25 +13,32 @@ public class TrainManager implements ConfigurableComponentI { // Static attributes - protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); + protected List<TrainType> lTrainTypes = new ArrayList<TrainType>(); - protected Map<String, TrainTypeI> mTrainTypes = - new HashMap<String, TrainTypeI>(); + protected Map<String, TrainType> mTrainTypes + = new HashMap<String, TrainType>(); - protected Map<String, TrainI> trainMap = - new HashMap<String, TrainI>(); + protected List<TrainCertificateType> trainCertTypes + = new ArrayList<TrainCertificateType>(); + + protected Map<String, TrainCertificateType> trainCertTypeMap + = new HashMap<String, TrainCertificateType>(); + + protected Map<String, TrainI> trainMap + = new HashMap<String, TrainI>(); - protected Map<TrainTypeI, List<TrainI>> trainsPerType = new HashMap<TrainTypeI, List<TrainI>>(); + protected Map<TrainCertificateType, List<TrainI>> trainsPerCertType + = new HashMap<TrainCertificateType, List<TrainI>>(); + protected TrainType defaultType = null; // Only required locally and in ChoiceType + private boolean removeTrain = false; // Dynamic attributes - protected Portfolio unavailable = null; - protected IntegerState newTypeIndex; - protected Map<TrainTypeI, Integer> lastIndexPerType = new HashMap<TrainTypeI, Integer>(); + protected Map<String, Integer> lastIndexPerType = new HashMap<String, Integer>(); protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; @@ -46,7 +54,7 @@ protected BooleanState anyTrainBought = new BooleanState ("AnyTrainBought", false); // Non-game attributes - protected Portfolio ipo = null; + protected Portfolio ipo, pool, unavailable; // For initialisation only boolean trainPriceAtFaceValueIfDifferentPresidents = false; @@ -66,31 +74,43 @@ * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { - TrainType defaultType = null; + TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); - if (defaultsTag != null) { - defaultType = new TrainType(false); - defaultType.configureFromXML(defaultsTag); - } + // We will use this tag later, to preconfigure TrainCertType and TrainType. - List<Tag> typeTags = tag.getChildren("Train"); + List<Tag> typeTags; - for (Tag typeTag : typeTags) { - if (defaultType != null) { - newType = (TrainType) defaultType.clone(); - if (newType == null) { - throw new ConfigurationException("Cannot clone traintype " - + defaultType.getName()); + // Choice train types (new style) + List<Tag> trainTypeTags = tag.getChildren("TrainType"); + + if (trainTypeTags != null) { + for (Tag trainTypeTag : trainTypeTags) { + TrainCertificateType certType = new TrainCertificateType(); + if (defaultsTag != null) certType.configureFromXML(defaultsTag); + certType.configureFromXML(trainTypeTag); + trainCertTypes.add(certType); + trainCertTypeMap.put(certType.getName(), certType); + + // The potential train types + typeTags = trainTypeTag.getChildren("Train"); + if (typeTags == null) { + // That's OK, all properties are in TrainType, to let's reuse that tag + typeTags = Arrays.asList(trainTypeTag); } - } else { - newType = new TrainType(true); + for (Tag typeTag : typeTags) { + newType = new TrainType(); + if (defaultsTag != null) newType.configureFromXML(defaultsTag); + newType.configureFromXML(trainTypeTag); + newType.configureFromXML(typeTag); + lTrainTypes.add(newType); + mTrainTypes.put(newType.getName(), newType); + certType.addPotentialTrainType(newType); + } } - lTrainTypes.add(newType); - newType.configureFromXML(typeTag); - mTrainTypes.put(newType.getName(), newType); } + // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); @@ -99,54 +119,63 @@ trainPriceAtFaceValueIfDifferentPresidents = rulesTag.getChild("FaceValueIfDifferentPresidents") != null; } + // Are trains sold to foreigners? + Tag removeTrainTag = tag.getChild("RemoveTrainBeforeSR"); + if (removeTrainTag != null) { + // Trains "bought by foreigners" (1844, 1824) + removeTrain = true; // completed in finishConfiguration() + } + + } + + public void finishConfiguration (GameManagerI gameManager) + throws ConfigurationException { + this.gameManager = gameManager; + bank = gameManager.getBank(); + ipo = bank.getIpo(); + pool = bank.getPool(); + unavailable = bank.getUnavailable(); + // Finish initialisation of the train types Map<Integer, String> rustedTrainTypeNames; - TrainTypeI rustedType; - for (TrainTypeI type : lTrainTypes) { + TrainCertificateType rustedType; + for (TrainCertificateType type : trainCertTypes) { if (type.getReleasedTrainTypeNames() != null) { - List<TrainTypeI> rtts = new ArrayList<TrainTypeI>(2); + List<TrainCertificateType> rtts = new ArrayList<TrainCertificateType>(2); for (String ttName : type.getReleasedTrainTypeNames().split(",")) { - rtts.add (mTrainTypes.get(ttName)); + rtts.add (trainCertTypeMap.get(ttName)); } type.setReleasedTrainTypes(rtts); } rustedTrainTypeNames = type.getRustedTrainTypeNames(); if (rustedTrainTypeNames != null) { for (int index : rustedTrainTypeNames.keySet()) { - rustedType = mTrainTypes.get(rustedTrainTypeNames.get(index)); + rustedType = trainCertTypeMap.get(rustedTrainTypeNames.get(index)); type.setRustedTrainType(index, rustedType); rustedType.setPermanent(false); } } } - // Are trains sold to foreigners? - Tag removeTrainTag = tag.getChild("RemoveTrainBeforeSR"); - if (removeTrainTag != null) { - // Trains "bought by foreigners" (1844, 1824) - removeTrain = true; // completed in finishConfiguration() - } - - } - - public void finishConfiguration (GameManagerI gameManager) - throws ConfigurationException { - this.gameManager = gameManager; - bank = gameManager.getBank(); - ipo = bank.getIpo(); - unavailable = bank.getUnavailable(); - - for (TrainTypeI type : lTrainTypes) { - type.finishConfiguration(gameManager); + for (TrainCertificateType certType : trainCertTypes) { + certType.finishConfiguration(gameManager); + List<TrainType> types = certType.getPotentialTrainTypes(); + for (TrainType type : types) { + type.finishConfiguration(gameManager, certType); + } + // Now create the trains of this type TrainI train; - /* If the amount is infinite, only one trains is created. + // Multi-train certificates cannot yet be assigned a type + TrainType initialType = types.size() == 1 ? types.get(0) : null; + + /* If the amount is infinite, only one train is created. * Each time this train is bought, another one is created. */ - for (int i = 0; i < (type.hasInfiniteQuantity() ? 1 : type.getQuantity()); i++) { - train = type.createTrain (); - train.init(type, getNewUniqueId(type)); + for (int i = 0; i < (certType.hasInfiniteQuantity() ? 1 : certType.getQuantity()); i++) { + train = certType.createTrain (); + train.init(certType, initialType, getNewUniqueId(certType.getName())); addTrain(train); unavailable.addTrain(train); } @@ -155,7 +184,7 @@ // By default, set the first train type to "available". newTypeIndex.set(0); - lTrainTypes.get(newTypeIndex.intValue()).setAvailable(bank); + makeTrainAvailable(trainCertTypes.get(newTypeIndex.intValue())); // Trains "bought by foreigners" (1844, 1824) if (removeTrain) { @@ -172,14 +201,16 @@ * i.e. in cloning infinitely available trains. */ - public TrainI cloneTrain (TrainTypeI type) { + public TrainI cloneTrain (TrainCertificateType certType) { TrainI train = null; + List<TrainType> types = certType.getPotentialTrainTypes(); + TrainType initialType = types.size() == 1 ? types.get(0) : null; try { - train = type.createTrain(); + train = certType.createTrain(); } catch (ConfigurationException e) { log.warn("Unexpected exception", e); } - train.init(type, getNewUniqueId(type)); + train.init(certType, initialType, getNewUniqueId(certType.getName())); addTrain(train); return train; } @@ -187,27 +218,23 @@ public void addTrain (TrainI train) { trainMap.put(train.getUniqueId(), train); - TrainTypeI type = train.getType(); - if (!trainsPerType.containsKey(type)) { - trainsPerType.put (type, new ArrayList<TrainI>()); + TrainCertificateType type = train.getCertType(); + if (!trainsPerCertType.containsKey(type)) { + trainsPerCertType.put (type, new ArrayList<TrainI>()); } - trainsPerType.get(type).add(train); + trainsPerCertType.get(type).add(train); } public TrainI getTrainByUniqueId(String id) { return trainMap.get(id); } - public String getNewUniqueId (TrainTypeI type) { - int newIndex = lastIndexPerType.containsKey(type) ? lastIndexPerType.get(type) + 1 : 0; - lastIndexPerType.put (type, newIndex); - return type.getName() + "_"+ newIndex; + public String getNewUniqueId (String typeName) { + int newIndex = lastIndexPerType.containsKey(typeName) ? lastIndexPerType.get(typeName) + 1 : 0; + lastIndexPerType.put (typeName, newIndex); + return typeName + "_"+ newIndex; } - public List<TrainI> getTrainsOfType (TrainTypeI type) { - return trainsPerType.get(type); - } - /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the @@ -220,17 +247,17 @@ phaseHasChanged = false; if (from != ipo) return; - TrainTypeI boughtType, nextType; - boughtType = train.getType(); - if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) + TrainCertificateType boughtType, nextType; + boughtType = train.getCertType(); + if (boughtType == (trainCertTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); if (newTypeIndex.intValue() < lTrainTypes.size()) { - nextType = (lTrainTypes.get(newTypeIndex.intValue())); + nextType = (trainCertTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) { - nextType.setAvailable(bank); + makeTrainAvailable(nextType); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " @@ -252,11 +279,11 @@ phaseHasChanged = true; } - List<TrainTypeI> releasedTypes = boughtType.getReleasedTrainTypes(); + List<TrainCertificateType> releasedTypes = boughtType.getReleasedTrainTypes(); if (releasedTypes != null) { - for (TrainTypeI releasedType : releasedTypes) { + for (TrainCertificateType releasedType : releasedTypes) { if (!releasedType.isAvailable()) { - releasedType.setAvailable(bank); + makeTrainAvailable(releasedType); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); } @@ -265,10 +292,9 @@ } } - TrainTypeI rustedType = boughtType.getRustedTrainType(trainIndex); + TrainCertificateType rustedType = boughtType.getRustedTrainType(trainIndex); if (rustedType != null && !rustedType.hasRusted()) { - rustedType.setRusted(train.getHolder()); // Or obsolete, - // where applicable + rustTrainType (rustedType, train.getHolder()); if (rustedType.isObsoleting()) { ReportBuffer.add(LocalText.getText("TrainsObsolete", rustedType.getName())); @@ -280,14 +306,46 @@ trainAvailabilityChanged = true; } -} + } + + protected void makeTrainAvailable (TrainCertificateType type) { + type.setAvailable(); + + Portfolio to = + (type.getInitialPortfolio().equalsIgnoreCase("Pool") ? bank.getPool() + : bank.getIpo()); + + for (TrainI train : trainsPerCertType.get(type)) { + new ObjectMove(train, unavailable, to); + } + } + + protected void rustTrainType (TrainCertificateType type, Portfolio lastBuyingCompany) { + type.setRusted(); + for (TrainI train : trainsPerCertType.get(type)) { + Portfolio holder = train.getHolder(); + if (type.isObsoleting() && holder.getOwner() instanceof PublicCompanyI + && holder != lastBuyingCompany) { + log.debug("Train " + train.getUniqueId() + " (owned by " + + holder.getName() + ") obsoleted"); + train.setObsolete(); + holder.getTrainsModel().update(); + } else { + log.debug("Train " + train.getUniqueId() + " (owned by " + + holder.getName() + ") rusted"); + train.setRusted(); + } + } + + } + public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; - for (TrainTypeI type : lTrainTypes) { + for (TrainCertificateType type : trainCertTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { @@ -299,25 +357,40 @@ } public String getTrainCostOverview() { - StringBuffer b = new StringBuffer(); - for (TrainTypeI type : lTrainTypes) { - if (b.length() > 1) b.append(" "); - b.append(type.getName()).append(":").append(Bank.format(type.getCost())); - if (type.getExchangeCost() > 0) { - b.append("(").append(Bank.format(type.getExchangeCost())).append(")"); + StringBuilder b = new StringBuilder(); + for (TrainCertificateType certType : trainCertTypes) { + if (certType.getCost() > 0) { + if (b.length() > 1) b.append(" "); + b.append(certType.getName()).append(":").append(Bank.format(certType.getCost())); + if (certType.getExchangeCost() > 0) { + b.append("(").append(Bank.format(certType.getExchangeCost())).append(")"); + } + } else { + for (TrainType type : certType.getPotentialTrainTypes()) { + if (b.length() > 1) b.append(" "); + b.append(type.getName()).append(":").append(Bank.format(type.getCost())); + } } } return b.toString(); } - public TrainTypeI getTypeByName(String name) { + public TrainType getTypeByName(String name) { return mTrainTypes.get(name); } - public List<TrainTypeI> getTrainTypes() { + public List<TrainType> getTrainTypes() { return lTrainTypes; } + public List<TrainCertificateType> getTrainCertTypes() { + return trainCertTypes; + } + + public TrainCertificateType getCertTypeByName (String name) { + return trainCertTypeMap.get(name); + } + public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } Modified: trunk/18xx/rails/game/TrainType.java =================================================================== --- trunk/18xx/rails/game/TrainType.java 2011-06-21 21:21:43 UTC (rev 1580) +++ trunk/18xx/rails/game/TrainType.java 2011-06-21 21:25:49 UTC (rev 1581) @@ -1,67 +1,38 @@ /* $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.*; - import org.apache.log4j.Logger; -import rails.game.move.ObjectMove; import rails.game.state.BooleanState; -import rails.game.state.IntegerState; import rails.util.*; -public class TrainType implements TrainTypeI { +public class TrainType implements Cloneable { public final static int TOWN_COUNT_MAJOR = 2; public final static int TOWN_COUNT_MINOR = 1; public final static int NO_TOWN_COUNT = 0; - protected String trainClassName = "rails.game.Train"; - protected Class<? extends Train> trainClass; - protected String name; - protected int quantity; - protected boolean infiniteQuantity = false; + protected TrainCertificateType certificateType; - private String reachBasis = "stops"; + protected String reachBasis = "stops"; protected boolean countHexes = false; - private String countTowns = "major"; + protected String countTowns = "major"; protected int townCountIndicator = TOWN_COUNT_MAJOR; - private String scoreTowns = "yes"; + protected String scoreTowns = "yes"; protected int townScoreFactor = 1; - private String scoreCities = "single"; + protected String scoreCities = "single"; protected int cityScoreFactor = 1; - protected boolean canBeExchanged = false; - protected IntegerState numberBoughtFromIPO; - - protected boolean obsoleting = false; - - protected boolean permanent = true; - - private boolean real; // Only to determine if top-level attributes must be - // read. - protected int cost; protected int majorStops; protected int minorStops; - protected int exchangeCost; - protected String startedPhaseName = null; - // Phase startedPhase; - - private Map<Integer, String> rustedTrainTypeNames = null; - protected Map<Integer, TrainTypeI> rustedTrainType = null; - - private String releasedTrainTypeNames = null; - protected List<TrainTypeI> releasedTrainTypes = null; - protected int lastIndex = 0; - protected BooleanState available; protected BooleanState rusted; protected TrainManager trainManager; @@ -76,96 +47,26 @@ * @param real False for the default type, else real. The default type does * not have top-level attributes. */ - public TrainType(boolean real) { - this.real = real; + public TrainType() { } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ 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); - } - if (real) { - // Name - name = tag.getAttributeAsString("name"); - if (name == null) { - throw new ConfigurationException( - LocalText.getText("NoNameSpecified")); - } + // Name + name = tag.getAttributeAsString("name"); - // Cost - cost = tag.getAttributeAsInteger("cost"); - if (cost == 0) { - throw new ConfigurationException( - LocalText.getText("InvalidCost")); - } + // Cost + cost = tag.getAttributeAsInteger("cost"); - // Amount - quantity = tag.getAttributeAsInteger("quantity"); - if (quantity == -1) { - infiniteQuantity = true; - } else if (quantity <= 0) { - throw new ConfigurationException( - LocalText.getText("InvalidQuantity", String.valueOf(quantity))); - } else { - quantity += tag.getAttributeAsInteger("quantityIncrement", 0); - } + // Major stops + majorStops = tag.getAttributeAsInteger("majorStops"); - // Major stops - majorStops = tag.getAttributeAsInteger("majorStops"); - if (majorStops == 0) { - throw new ConfigurationException( - LocalText.getText("InvalidStops")); - } + // Minor stops + minorStops = tag.getAttributeAsInteger("minorStops"); - // Minor stops - minorStops = tag.getAttributeAsInteger("minorStops"); - - // 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.get... [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, playerCashYOffset; @@ -100,6 +102,7 @@ protected boolean compCanHoldOwnShares = false; protected boolean compCanHoldForeignShares = false; // NOT YET USED protected boolean hasCompanyLoans = false; + protected boolean hasRights; // Current actor. // Players: 0, 1, 2, ... @@ -148,6 +151,7 @@ compCanBuyPrivates = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); compCanHoldOwnShares = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES); hasCompanyLoans = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_COMPANY_LOANS); + hasRights = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_RIGHTS); ipo = bank.getIpo(); pool = bank.getPool(); @@ -171,6 +175,7 @@ compTokens = new Field[nc]; compPrivates = new Field[nc]; compLoans = new Field[nc]; + if (hasRights) rights = new Field[nc]; playerCash = new Field[np]; playerCashButton = new ClickField[np]; @@ -215,6 +220,10 @@ compLoansXOffset = ++lastX; compLoansYOffset = lastY; } + if (hasRights) { + rightsXOffset = ++lastX; + rightsYOffset = lastY; + } rightCompCaptionXOffset = ++lastX; playerCashXOffset = certPerPlayerXOffset; @@ -297,6 +306,10 @@ addField (new Caption (LocalText.getText("LOANS")), compLoansXOffset, 1, 1, 1, WIDE_BOTTOM, true); } + if (hasRights) { + addField (new Caption(LocalText.getText("RIGHTS")), + rightsXOffset, 1, 1, 1, WIDE_BOTTOM, true); + } addField(new Caption(LocalText.getText("COMPANY")), rightCompCaptionXOffset, 0, 1, 2, WIDE_LEFT + WIDE_BOTTOM, true); @@ -419,7 +432,13 @@ } addField (f, compLoansXOffset, compLoansYOffset+i, 1, 1, 0, visible); } + + if (hasRights) { + f = rights[i] = new Field (c.getRightsModel()); + addField (f, rightsXOffset, rightsYOffset + i, 1, 1, 0, visible); + } + f = new Caption(c.getName()); f.setForeground(c.getFgColour()); f.setBackground(c.getBgColour()); Modified: trunk/18xx/rails/ui/swing/ORPanel.java =================================================================== --- trunk/18xx/rails/ui/swing/ORPanel.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/ui/swing/ORPanel.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -90,10 +90,13 @@ private Field trains[]; private int trainsXOffset, trainsYOffset; private Field newTrainCost[]; + private int rightsXOffset, rightsYOffset; + private Field rights[]; private boolean privatesCanBeBought = false; private boolean bonusTokensExist = false; private boolean hasCompanyLoans = false; + private boolean hasRights; private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, privatesCaption, loansCaption; @@ -138,6 +141,7 @@ privatesCanBeBought = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); bonusTokensExist = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.DO_BONUS_TOKENS_EXIST); hasCompanyLoans = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_COMPANY_LOANS); + hasRights = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_RIGHTS); initButtonPanel(); gbc = new GridBagConstraints(); @@ -296,6 +300,7 @@ tokensLeft = new Field[nc]; if (bonusTokensExist) tokenBonus = new Field[nc]; if (hasCompanyLoans) compLoans = new Field[nc]; + if (hasRights) rights = new Field[nc]; revenue = new Field[nc]; revenueSelect = new Spinner[nc]; decision = new Field[nc]; @@ -343,6 +348,13 @@ addField (loansCaption = new Caption(LocalText.getText("LOANS")), loansXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT); } + + if (hasRights) { + rightsXOffset = currentXOffset += lastXWidth; + rightsYOffset = leftCompNameYOffset; + addField (new Caption(LocalText.getText("RIGHTS")), + rightsXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT); + } tilesXOffset = currentXOffset += lastXWidth; tilesYOffset = leftCompNameYOffset; @@ -441,6 +453,11 @@ } addField (f, loansXOffset, loansYOffset + i, 1, 1, WIDE_RIGHT, visible); } + + if (hasRights) { + f = rights[i] = new Field (c.getRightsModel()); + addField (f, rightsXOffset, rightsYOffset + i, 1, 1, WIDE_RIGHT, visible); + } f = tiles[i] = new Field(c.getTilesLaidThisTurnModel()); addField(f, tilesXOffset, tilesYOffset + i, 1, 1, 0, visible); Modified: trunk/18xx/rails/util/ListAndFixSavedFiles.java =================================================================== --- trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-06-28 17:08:29 UTC (rev 1594) +++ trunk/18xx/rails/util/ListAndFixSavedFiles.java 2011-06-30 15:19:12 UTC (rev 1595) @@ -302,10 +302,12 @@ if (Util.hasValue(result)) { try { int index = Integer.parseInt(result); - executedActions.remove(index); + PossibleAction action = executedActions.get(index); + executedActions.remove(action); + savedObjects.remove(action); setReportText(false); } catch (NumberFormatException e) { - + log.error("Number format exception for '"+result+"'", e); } } } else if ("SAVE".equalsIgnoreCase(command)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2011-07-03 20:06:48
|
Revision: 1598 http://rails.svn.sourceforge.net/rails/?rev=1598&view=rev Author: wakko666 Date: 2011-07-03 20:06:38 +0000 (Sun, 03 Jul 2011) Log Message: ----------- Refactor GameInfo XML parsing Modified Paths: -------------- trunk/18xx/data/GamesList.xml trunk/18xx/rails/algorithms/RevenueAdapter.java trunk/18xx/rails/algorithms/RevenueBonusTemplate.java trunk/18xx/rails/algorithms/RevenueManager.java trunk/18xx/rails/algorithms/RevenueTrainRun.java trunk/18xx/rails/game/Bank.java trunk/18xx/rails/game/BonusToken.java trunk/18xx/rails/game/Company.java trunk/18xx/rails/game/CompanyManager.java trunk/18xx/rails/game/CompanyType.java trunk/18xx/rails/game/CompanyTypeI.java trunk/18xx/rails/game/ComponentManager.java trunk/18xx/rails/game/ConfigurableComponentI.java trunk/18xx/rails/game/EndOfGameRound.java trunk/18xx/rails/game/Game.java trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/game/MapHex.java trunk/18xx/rails/game/MapManager.java trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/Phase.java trunk/18xx/rails/game/PhaseManager.java trunk/18xx/rails/game/PlayerManager.java trunk/18xx/rails/game/Portfolio.java trunk/18xx/rails/game/PrivateCompany.java trunk/18xx/rails/game/PublicCertificate.java trunk/18xx/rails/game/PublicCompany.java trunk/18xx/rails/game/ReportBuffer.java trunk/18xx/rails/game/Round.java trunk/18xx/rails/game/ShareSellingRound.java trunk/18xx/rails/game/StartPacket.java trunk/18xx/rails/game/StartRound.java trunk/18xx/rails/game/StartRound_1830.java trunk/18xx/rails/game/StartRound_1835.java trunk/18xx/rails/game/StockMarket.java trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/StockSpaceType.java trunk/18xx/rails/game/Tile.java trunk/18xx/rails/game/TileI.java trunk/18xx/rails/game/TileManager.java trunk/18xx/rails/game/TrainCertificateType.java trunk/18xx/rails/game/TrainManager.java trunk/18xx/rails/game/TrainType.java trunk/18xx/rails/game/TreasuryShareRound.java trunk/18xx/rails/game/action/LayBonusToken.java trunk/18xx/rails/game/correct/CashCorrectionManager.java trunk/18xx/rails/game/correct/CorrectionManager.java trunk/18xx/rails/game/correct/CorrectionModeAction.java trunk/18xx/rails/game/correct/MapCorrectionManager.java trunk/18xx/rails/game/move/MoveStack.java trunk/18xx/rails/game/special/ExchangeForShare.java trunk/18xx/rails/game/special/LocatedBonus.java trunk/18xx/rails/game/special/SellBonusToken.java trunk/18xx/rails/game/special/SpecialProperty.java trunk/18xx/rails/game/special/SpecialRight.java trunk/18xx/rails/game/special/SpecialTileLay.java trunk/18xx/rails/game/special/SpecialTokenLay.java trunk/18xx/rails/game/special/SpecialTrainBuy.java trunk/18xx/rails/game/specific/_1825/StartRound_1825.java trunk/18xx/rails/game/specific/_1835/OperatingRound_1835.java trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java trunk/18xx/rails/game/specific/_1835/StockRound_1835.java trunk/18xx/rails/game/specific/_1851/StartRound_1851.java trunk/18xx/rails/game/specific/_1856/CGRFormationRound.java trunk/18xx/rails/game/specific/_1856/OperatingRound_1856.java trunk/18xx/rails/game/specific/_1856/PublicCompany_CGR.java trunk/18xx/rails/game/specific/_1856/StockRound_1856.java trunk/18xx/rails/game/specific/_1880/StartRound_1880.java trunk/18xx/rails/game/specific/_1880/StockRound_1880.java trunk/18xx/rails/game/specific/_1889/OperatingRound_1889.java trunk/18xx/rails/game/specific/_18AL/NameTrains.java trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java trunk/18xx/rails/game/specific/_18AL/NamedTrainToken.java trunk/18xx/rails/game/specific/_18AL/OperatingRound_18AL.java trunk/18xx/rails/game/specific/_18EU/FinalMinorExchangeRound.java trunk/18xx/rails/game/specific/_18EU/GameManager_18EU.java trunk/18xx/rails/game/specific/_18EU/OperatingRound_18EU.java trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java trunk/18xx/rails/game/specific/_18EU/StartRound_18EU.java trunk/18xx/rails/game/specific/_18EU/StockRound_18EU.java trunk/18xx/rails/game/specific/_18GA/OperatingRound_18GA.java trunk/18xx/rails/game/specific/_18Kaas/RuhrRevenueModifier.java trunk/18xx/rails/test/GameTest.java trunk/18xx/rails/ui/swing/AbstractReportWindow.java trunk/18xx/rails/ui/swing/AutoSaveLoadDialog.java trunk/18xx/rails/ui/swing/ConfigWindow.java trunk/18xx/rails/ui/swing/GameSetupWindow.java trunk/18xx/rails/ui/swing/GameStatus.java trunk/18xx/rails/ui/swing/GameUIManager.java trunk/18xx/rails/ui/swing/ImageLoader.java trunk/18xx/rails/ui/swing/ORPanel.java trunk/18xx/rails/ui/swing/ORUIManager.java trunk/18xx/rails/ui/swing/ORWindow.java trunk/18xx/rails/ui/swing/RemainingTilesWindow.java trunk/18xx/rails/ui/swing/ReportWindow.java trunk/18xx/rails/ui/swing/ReportWindowDynamic.java trunk/18xx/rails/ui/swing/Scale.java trunk/18xx/rails/ui/swing/StartRoundWindow.java trunk/18xx/rails/ui/swing/StatusWindow.java trunk/18xx/rails/ui/swing/UpgradesPanel.java trunk/18xx/rails/ui/swing/WindowSettings.java trunk/18xx/rails/ui/swing/elements/CheckBoxDialog.java trunk/18xx/rails/ui/swing/elements/ConfirmationDialog.java trunk/18xx/rails/ui/swing/elements/MessageDialog.java trunk/18xx/rails/ui/swing/elements/RadioButtonDialog.java trunk/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java trunk/18xx/rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java trunk/18xx/rails/ui/swing/gamespecific/_18AL/NameTrainsDialog.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/GameUIManager_18EU.java trunk/18xx/rails/ui/swing/gamespecific/_18EU/StatusWindow_18EU.java trunk/18xx/rails/ui/swing/hexmap/HexMap.java trunk/18xx/rails/ui/swing/hexmap/HexMapImage.java trunk/18xx/rails/util/ListAndFixSavedFiles.java trunk/18xx/rails/util/RunGame.java trunk/18xx/rails/util/Util.java trunk/18xx/test/TestGame.java trunk/18xx/test/TestGameBuilder.java trunk/18xx/tools/ConvertTilesXML.java trunk/18xx/tools/MakeGameTileSets.java trunk/18xx/tools/XmlUtils.java Added Paths: ----------- trunk/18xx/rails/common/LocalText.java trunk/18xx/rails/common/MoneyFormatter.java trunk/18xx/rails/common/ResourceLoader.java trunk/18xx/rails/common/parser/ trunk/18xx/rails/common/parser/Config.java trunk/18xx/rails/common/parser/ConfigItem.java trunk/18xx/rails/common/parser/ConfigurationException.java trunk/18xx/rails/common/parser/GameInfo.java trunk/18xx/rails/common/parser/GameInfoParser.java trunk/18xx/rails/common/parser/GameOption.java trunk/18xx/rails/common/parser/Tag.java trunk/18xx/rails/common/parser/XMLParser.java trunk/18xx/rails/common/parser/XMLTags.java Removed Paths: ------------- trunk/18xx/rails/game/ConfigurationException.java trunk/18xx/rails/game/GameOption.java trunk/18xx/rails/game/GamesInfo.java trunk/18xx/rails/util/Config.java trunk/18xx/rails/util/ConfigItem.java trunk/18xx/rails/util/Format.java trunk/18xx/rails/util/LocalText.java trunk/18xx/rails/util/ResourceLoader.java trunk/18xx/rails/util/Tag.java Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/data/GamesList.xml 2011-07-03 20:06:38 UTC (rev 1598) @@ -318,17 +318,33 @@ </Game> - <Credits>Rails is a computer implementation of a number of railroad board games, -that are collectively known as the "18xx" railway game system. -Rails is a Sourceforge project. -Project founder: Brett Lentz. -Developers: Erik Vos, Stefan Frey and Brett Lentz. + <Credits>Rails is a computer implementation of a number of board games. + These games all have a railroad theme. They are collectively known as "18xx" + games due to the naming scheme used by many games in the genre. -The 18xx railway game system was originated by Francis Tresham and Hartland Trefoil Ltd. +Contributors: + Erik Vos + Stefan Frey + Freek Dijkstra + Scott Peterson + Adam Badura + Phil Davies + Bill Rosgen + Martin Brumm + Chris Shaffer + Brett Lentz All rights reserved by the respective owners of the original games (see the Game Notes per game for specific acknowledgements). -No challenge to their status is intended. + +No challenge to the original author's or publisher's rights, licensing, or status is intended. + Rails is intended as a play aid for owners of each respective boardgame. + +The Rails application and source code are distributed under +version 2 of the GNU Public License (GPL). + +A copy of the GPL should have been shipped with the game files and is also available here: + http://www.gnu.org/licenses/old-licenses/gpl-2.0.html </Credits> </GamesList> Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -17,6 +17,7 @@ import org.jgrapht.Graphs; import org.jgrapht.graph.SimpleGraph; +import rails.common.LocalText; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.PhaseI; @@ -24,7 +25,6 @@ import rails.game.TrainI; import rails.game.TrainType; import rails.ui.swing.hexmap.HexMap; -import rails.util.LocalText; public final class RevenueAdapter implements Runnable { Modified: trunk/18xx/rails/algorithms/RevenueBonusTemplate.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueBonusTemplate.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -5,15 +5,15 @@ import org.apache.log4j.Logger; +import rails.common.parser.ConfigurationException; +import rails.common.parser.Tag; import rails.game.ConfigurableComponentI; -import rails.game.ConfigurationException; import rails.game.GameManagerI; import rails.game.MapHex; import rails.game.PhaseI; import rails.game.PhaseManager; import rails.game.TrainManager; import rails.game.TrainType; -import rails.util.Tag; /** * defines a template for a revenue bonus at creation time of rails objects Modified: trunk/18xx/rails/algorithms/RevenueManager.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueManager.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueManager.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -7,12 +7,12 @@ import org.apache.log4j.Logger; +import rails.common.LocalText; +import rails.common.parser.ConfigurationException; +import rails.common.parser.Tag; import rails.game.ConfigurableComponentI; -import rails.game.ConfigurationException; import rails.game.GameManagerI; import rails.game.state.ArrayListState; -import rails.util.LocalText; -import rails.util.Tag; /** * Coordinates and stores all elements related to revenue calulcation, Modified: trunk/18xx/rails/algorithms/RevenueTrainRun.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-06-30 18:56:00 UTC (rev 1597) +++ trunk/18xx/rails/algorithms/RevenueTrainRun.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -12,8 +12,8 @@ import rails.algorithms.NetworkVertex.StationType; import rails.algorithms.NetworkVertex.VertexType; +import rails.common.LocalText; import rails.ui.swing.hexmap.HexMap; -import rails.util.LocalText; /** * Links the results from the revenue calculator to the rails program Copied: trunk/18xx/rails/common/LocalText.java (from rev 1597, trunk/18xx/rails/util/LocalText.java) =================================================================== --- trunk/18xx/rails/common/LocalText.java (rev 0) +++ trunk/18xx/rails/common/LocalText.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,153 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/LocalText.java,v 1.7 2010/03/23 18:45:16 stefanfrey Exp $*/ +package rails.common; + +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import rails.common.parser.Config; +import rails.util.Util; + +public class LocalText extends ResourceBundle { + + private static final String TEST_LOCALE = "te_ST"; + + protected static String language = "en"; + + protected static String country = ""; + + protected static String localeCode = language; + + protected static Locale locale; + + protected static ResourceBundle localisedText; + + protected static Logger log = + Logger.getLogger(LocalText.class.getPackage().getName()); + + public static String getText(String key) { + return getText(key, (Object[]) null); + } + + public static String getText(String key, Object parameter) { + return getText(key, new Object[] { parameter }); + } + + public static String getText(String key, Object... parameters) { + /* If the text is not found, return the key in brackets */ + return getTextExecute(key, "<" + key + ">", true, parameters); + } + + public static String getTextWithDefault(String key, String defaultText) { + return getTextExecute(key, defaultText, false, (Object[]) null); + } + + // actual procedure to retrieve the local text + private static String getTextExecute(String key, String defaultText, boolean errorOnMissing, Object... parameters) { + String result = ""; + + if (key == null || key.length() == 0) return ""; + + /* Load the texts */ + if (localisedText == null) { + /* + * Check what locale has been configured, if any. If not, we use the + * default assigned above. + */ + String item; + if (Util.hasValue(item = Config.get("language"))) { + language = item.toLowerCase(); + } + if (Util.hasValue(item = Config.get("country"))) { + country = item.toUpperCase(); + localeCode = language + "_" + country; + } + if (Util.hasValue(item = Config.get("locale"))) { + localeCode = item; + if (localeCode.length() >= 2) + language = localeCode.substring(0, 2); + if (localeCode.length() >= 5) + country = localeCode.substring(3, 5); + } + log.debug("Language=" + language + ", country=" + country + + ", locale=" + localeCode); + + /* Create the locale and get the resource bundle. */ + locale = new Locale(language, country); + + try { + localisedText = + ResourceBundle.getBundle("LocalisedText", locale); + } catch (MissingResourceException e) { + System.err.println("Unable to locate LocalisedText resource: " + + e); + } + } + + /* If the key contains a space, something is wrong, check who did that! */ + if (key.indexOf(" ") > -1) { + try { + throw new Exception("Invalid resource key '" + key + "'"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // special treatment for test locale + if (localeCode.equals(TEST_LOCALE)) { + StringBuffer s = new StringBuffer(key); + if (parameters != null) + for (Object o:parameters) + s.append("," + o.toString()); + return s.toString(); + } + + /* Find the text */ + try { + result = localisedText.getString(key); + } catch (Exception e) { + if (errorOnMissing) { + System.out.println("Missing text for key " + key + " in locale " + + locale.getDisplayName() + " (" + localeCode + + ")"); + } + return defaultText; + } + + if (parameters != null) { + result = MessageFormat.format(result, parameters); + } + + return result; + + } + + public static void setLocale(String localeCode) { + + LocalText.localeCode = localeCode; + String[] codes = localeCode.split("_"); + if (codes.length > 0) language = codes[0]; + if (codes.length > 1) country = codes[1]; + + // reset localised text + localisedText = null; + } + + public Enumeration<String> getKeys() { + // TODO Auto-generated method stub + return null; + } + + public Locale getLocale() { + return locale; + } + + protected Object handleGetObject(String arg0) { + // TODO Auto-generated method stub + return null; + } +} Copied: trunk/18xx/rails/common/MoneyFormatter.java (from rev 1597, trunk/18xx/rails/util/Format.java) =================================================================== --- trunk/18xx/rails/common/MoneyFormatter.java (rev 0) +++ trunk/18xx/rails/common/MoneyFormatter.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,30 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/Format.java,v 1.3 2008/06/04 19:00:39 evos Exp $*/ +package rails.common; + +import rails.common.parser.Config; +import rails.util.Util; + +public class MoneyFormatter { + + private static final String DEFAULT_MONEY_FORMAT = "$@"; + private static String moneyFormat = null; + static { + String configFormat = Config.get("money_format"); + if (Util.hasValue(configFormat) && configFormat.matches(".*@.*")) { + moneyFormat = configFormat; + } + } + + /* This class is never instantiated */ + private MoneyFormatter() {} + + public static String money(int amount) { + if (moneyFormat == null) moneyFormat = DEFAULT_MONEY_FORMAT; + return moneyFormat.replaceFirst("@", String.valueOf(amount)); + } + + public static void setMoneyFormat(String format) { + moneyFormat = format; + } + +} Copied: trunk/18xx/rails/common/ResourceLoader.java (from rev 1597, trunk/18xx/rails/util/ResourceLoader.java) =================================================================== --- trunk/18xx/rails/common/ResourceLoader.java (rev 0) +++ trunk/18xx/rails/common/ResourceLoader.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,581 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $*/ +package rails.common; + +import java.awt.Font; +import java.io.*; +import java.lang.reflect.Constructor; +import java.net.Socket; +import java.util.*; + +import javax.swing.text.*; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; + +import org.apache.log4j.Logger; + +/** + * Class ResourceLoader is an utility class to load a resource from a filename + * and a list of directory. + * + * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $ + * @author Romain Dolbeau + * @author David Ripton + */ + +public final class ResourceLoader { + + /** + * Class ColossusClassLoader allows for class loading outside the CLASSPATH, + * i.e. from the various variant directories. + * + * @version $Id: ResourceLoader.java,v 1.5 2009/01/15 20:53:28 evos Exp $ + * @author Romain Dolbeau + */ + private static class RailsClassLoader extends ClassLoader { + List<String> directories = null; + + protected static Logger log = + Logger.getLogger(RailsClassLoader.class.getPackage().getName()); + + RailsClassLoader(ClassLoader parent) { + super(parent); + } + + RailsClassLoader() { + super(); + } + + @Override + public Class<?> findClass(String className) + throws ClassNotFoundException { + try { + int index = className.lastIndexOf("."); + String shortClassName = className.substring(index + 1); + if (index == -1) { + log.error("Loading of class \"" + className + + "\" failed (no dot in class name)"); + return null; + } + InputStream classDataIS = + getInputStream(shortClassName + ".class", directories); + if (classDataIS == null) { + log.error("Couldn't find the class file anywhere ! (" + + shortClassName + ".class)"); + throw new FileNotFoundException("missing " + shortClassName + + ".class"); + } + byte[] classDataBytes = new byte[classDataIS.available()]; + classDataIS.read(classDataBytes); + return defineClass(className, classDataBytes, 0, + classDataBytes.length); + } catch (Exception e) { + return super.findClass(className); + } + } + + void setDirectories(List<String> d) { + directories = d; + } + } + + public static final String keyContentType = "ResourceLoaderContentType"; + public static final String defaultFontName = "Lucida Sans Bold"; + public static final int defaultFontStyle = Font.PLAIN; + public static final int defaultFontSize = 12; + public static final Font defaultFont = + new Font(defaultFontName, defaultFontStyle, defaultFontSize); + + // File.separator does not work in jar files, except in Unix. + // A hardcoded '/' works in Unix, Windows, MacOS X, and jar files. + private static final String pathSeparator = "/"; + private static final ClassLoader baseCL = + rails.common.ResourceLoader.class.getClassLoader(); + private static final RailsClassLoader cl = new RailsClassLoader(baseCL); + + private static final Map<String, Object> fileCache = + Collections.synchronizedMap(new HashMap<String, Object>()); + + private final static String sep = "~"; + + protected static Logger log = + Logger.getLogger(ResourceLoader.class.getPackage().getName()); + + private static String server = null; + private static int serverPort = 0; + + public static void setDataServer(String server, int port) { + ResourceLoader.server = server; + ResourceLoader.serverPort = port; + } + + /** + * Give the String to mark directories. + * + * @return The String to mark directories. + */ + public static String getPathSeparator() { + return pathSeparator; + } + + /** empty the cache so that all files have to be reloaded */ + public synchronized static void purgeFileCache() { + log.debug("Purging File Cache."); + fileCache.clear(); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories, tell the getInputStream not to complain if not found. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStreamIgnoreFail(String filename, + List<String> directories) { + return getInputStream(filename, directories, server != null, false, + true); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStream(String filename, List<String> directories) { + return getInputStream(filename, directories, server != null, false, + false); + } + + /** + * Return the first InputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @param remote Ask the server for the stream. + * @param cachedOnly Only look in the cache file, do not try to load the + * file from permanent storage. + * @param ignoreFail (=don't complain) if file not found + * @return The InputStream, or null if it was not found. + */ + public static InputStream getInputStream(String filename, List<String> directories, + boolean remote, boolean cachedOnly, boolean ignoreFail) { + String mapKey = getMapKey(filename, directories); + Object cached = fileCache.get(mapKey); + byte[] data = null; + + if ((cached == null) && cachedOnly) { + if (!ignoreFail) { + log.warn("Requested file " + filename + + " is requested cached-only but is not is cache."); + } + return null; + } + + if ((cached == null) && ((!remote) || (server == null))) { + synchronized (fileCache) { + InputStream stream = null; + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext() && (stream == null)) { + Object o = it.next(); + if (o instanceof String) { + String path = (String) o; + String fullPath = + path + pathSeparator + fixFilename(filename); + + log.debug("Trying to locate InputStream: " + path + + pathSeparator + filename); + try { + File tempFile = new File(fullPath); + stream = new FileInputStream(tempFile); + } catch (Exception e) { + stream = cl.getResourceAsStream(fullPath); + } + } + } + if (stream == null) { + if (!remote && ignoreFail) { + // If someone locally requests it as ignoreFail, + // let's assume a remote requester later sees it the + // same way. + // Right now, the remote-requesting is not able to + // submit the "ignore-fail" property... + // @TODO: submit that properly? + // fileCacheIgnoreFail.put(mapKey, new Boolean(true)); + } + if (!ignoreFail) { + log.warn("getInputStream:: " + + " Couldn't get InputStream for file " + + filename + " in " + directories + + (cachedOnly ? " (cached only)" : "")); + // @TODO this sounds more serious than just a warning in + // the logs + // Anyway now at least MarkersLoader does not complain + // any more... + } + } else { + data = getBytesFromInputStream(stream); + fileCache.put(mapKey, data); + } + } + } else { + synchronized (fileCache) { + if (cached != null) { + data = (byte[]) cached; + } else { + try { + Socket fileSocket = new Socket(server, serverPort); + InputStream is = fileSocket.getInputStream(); + + if (is == null) { + log.warn("getInputStream:: " + + " Couldn't get InputStream from socket" + + " for file " + filename + " in " + + directories + + (cachedOnly ? " (cached only)" : "")); + // @TODO this sounds more serious than just a + // warning in the logs + } else { + PrintWriter out = + new PrintWriter( + fileSocket.getOutputStream(), true); + + if (ignoreFail) { + // Not in this version yet (05/2007). + // New clients could not talk with old server. + // Take this into full use somewhat later. + // out.print( + // Constants.fileServerIgnoreFailSignal + sep); + } + out.print(filename); + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext()) { + out.print(sep + it.next()); + } + out.println(); + data = getBytesFromInputStream(is); + if (data != null && data.length == 0 && !ignoreFail) { + log.warn("Got empty contents for file " + + filename + " directories " + + directories.toString()); + } + fileSocket.close(); + fileCache.put(mapKey, data); + } + } catch (Exception e) { + log.error("ResourceLoader::getInputStream() : " + e); + } + } + + } + } + return (data == null ? null : getInputStreamFromBytes(data)); + } + + /** + * Return the content of the specified file as an array of byte. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @param cachedOnly Only look in the cache file, do not try to load the + * file from permanent storage. + * @return An array of byte representing the content of the file, or null if + * it fails. + */ + public static byte[] getBytesFromFile(String filename, List<String> directories, + boolean cachedOnly, boolean ignoreFail) { + InputStream is = + getInputStream(filename, directories, server != null, + cachedOnly, ignoreFail); + if (is == null) { + // right now only FileServerThread is using this method at all. + if (!ignoreFail) { + log.warn("getBytesFromFile:: " + + " Couldn't get InputStream for file " + filename + + " in " + directories + + (cachedOnly ? " (cached only)" : "")); + } + return null; + } + return getBytesFromInputStream(is); + } + + /** + * Return the content of the specified InputStream as an array of byte. + * + * @param InputStream The InputStream to use. + * @return An array of byte representing the content of the InputStream, or + * null if it fails. + */ + private static byte[] getBytesFromInputStream(InputStream is) { + byte[] all = new byte[0]; + + try { + byte[] data = new byte[1024 * 64]; + int r = is.read(data); + while (r > 0) { + byte[] temp = new byte[all.length + r]; + for (int i = 0; i < all.length; i++) { + temp[i] = all[i]; + } + for (int i = 0; i < r; i++) { + temp[i + all.length] = data[i]; + } + all = temp; + r = is.read(data); + } + } catch (Exception e) { + log.error("Can't Stringify stream " + is + " (" + e + ")"); + } + return all; + } + + /** + * Return the content of the specified byte array as an InputStream. + * + * @param data The byte array to convert. + * @return An InputStream whose content is the data byte array. + */ + private static InputStream getInputStreamFromBytes(byte[] data) { + if (data == null) { + log.warn("getInputStreamFromBytes:: " + + " Can't create InputStream from null byte array"); + return null; + } + return new ByteArrayInputStream(data); + } + + /** + * Return the first OutputStream from file of name filename in the list of + * directories. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The OutputStream, or null if it was not found. + */ + public static OutputStream getOutputStream(String filename, List<String> directories) { + OutputStream stream = null; + java.util.Iterator<String> it = directories.iterator(); + while (it.hasNext() && (stream == null)) { + Object o = it.next(); + if (o instanceof String) { + String path = (String) o; + String fullPath = path + pathSeparator + fixFilename(filename); + try { + stream = new FileOutputStream(fullPath); + } catch (Exception e) { + log.debug("getOutputStream:: " + + " Couldn't get OutputStream for file " + + filename + " in " + directories + "(" + + e.getMessage() + ")"); + } + } + } + return (stream); + } + + /** + * Return the first Document from file of name filename in the list of + * directories. It also add a property of key keyContentType and of type + * String describing the content type of the Document. This can currently + * load HTML and pure text. + * + * @param filename Name of the file to load. + * @param directories List of directories to search (in order). + * @return The Document, or null if it was not found. + */ + public static Document getDocument(String filename, List<String> directories) { + InputStream htmlIS = + getInputStreamIgnoreFail(filename + ".html", directories); + if (htmlIS != null) { + try { + HTMLEditorKit htedk = new HTMLEditorKit(); + HTMLDocument htdoc = new HTMLDocument(htedk.getStyleSheet()); + htdoc.putProperty(keyContentType, "text/html"); + htedk.read(htmlIS, htdoc, 0); + return htdoc; + } catch (Exception e) { + log.error("html document exists, but cannot be loaded (" + + filename + "): " + e); + } + return null; + } + InputStream textIS = + getInputStreamIgnoreFail(filename + ".txt", directories); + if (textIS == null) { + textIS = getInputStreamIgnoreFail(filename, directories); + } + if (textIS != null) { + try { + // Must be a StyledDocument not a PlainDocument for + // JEditorPane.setDocument() + StyledDocument txtdoc = new DefaultStyledDocument(); + char[] buffer = new char[128]; + InputStreamReader textISR = new InputStreamReader(textIS); + int read = 0; + int offset = 0; + while (read != -1) { + read = textISR.read(buffer, 0, 128); + if (read != -1) { + txtdoc.insertString(offset, + new String(buffer, 0, read), null); + offset += read; + } + } + txtdoc.putProperty(keyContentType, "text/plain"); + return txtdoc; + } catch (Exception e) { + log.error("text document exists, but cannot be loaded (" + + filename + "): " + e); + } + return null; + } + log.error("No document for basename " + filename + " found " + + "(neither .html, .txt nor without extention)!"); + return null; + } + + /** + * Return the key to use in the image and file caches. + * + * @param filename Name of the file. + * @param directories List of directories. + * @return A String to use as a key when storing/loading in a cache the + * specified file from the specified list of directories. + */ + private static String getMapKey(String filename, List<String> directories) { + String[] filenames = new String[1]; + filenames[0] = filename; + return getMapKey(filenames, directories); + } + + /** + * Return the key to use in the image cache. + * + * @param filenames Array of name of files. + * @param directories List of directories. + * @return A String to use as a key when storing/loading in a cache the + * specified array of name of files from the specified list of directories. + */ + private static String getMapKey(String[] filenames, List<String> directories) { + StringBuffer buf = new StringBuffer(filenames[0]); + for (int i = 1; i < filenames.length; i++) { + buf.append(","); + buf.append(filenames[i]); + } + Iterator<String> it = directories.iterator(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof String) { + buf.append(","); + buf.append(o); + } + } + return buf.toString(); + } + + /** + * Fix a filename by replacing space with underscore. + * + * @param filename Filename to fix. + * @return The fixed filename. + */ + private static String fixFilename(String filename) { + return filename.replace(' ', '_'); + } + + /** + * Create an instance of the class whose name is in parameter. + * + * @param className The name of the class to use. + * @param directories List of directories to search (in order). + * @return A new object, instance from the given class. + */ + public static Object getNewObject(String className, List<String> directories) { + return getNewObject(className, directories, null); + } + + /** + * Create an instance of the class whose name is in parameter, using + * parameters. + * + * If no parameters are given, the default constructor is used. + * + * @TODO this is full of catch(Exception) blocks, which all return null. + * Esp. returning null seems a rather bad idea, since it will most likely + * turn out to be NPEs somewhere later. + * + * @param className The name of the class to use, must not be null. + * @param directories List of directories to search (in order), must not be + * null. + * @param parameter Array of parameters to pass to the constructor, can be + * null. + * @return A new object, instance from the given class or null if + * instantiation failed. + */ + public static Object getNewObject(String className, List<String> directories, + Object[] parameter) { + Class<?> theClass = null; + cl.setDirectories(directories); + try { + theClass = cl.loadClass(className); + } catch (Exception e) { + log.error("Loading of class \"" + className + "\" failed (" + e + + ")"); + return null; + } + if (parameter != null) { + Class<?>[] paramClasses = new Class[parameter.length]; + for (int i = 0; i < parameter.length; i++) { + paramClasses[i] = parameter[i].getClass(); + } + try { + Constructor<?> c = theClass.getConstructor(paramClasses); + return c.newInstance(parameter); + } catch (Exception e) { + log.error("Loading or instantiating class' constructor for \"" + + className + "\" failed (" + e + ")"); + return null; + } + } else { + try { + return theClass.newInstance(); + } catch (Exception e) { + log.error("Instantiating \"" + className + "\" failed (" + e + + ")"); + return null; + } + } + } + + /** + * Force adding the given data as belonging to the given filename in the + * file cache. + * + * @param filename Name of the Image file to add. + * @param directories List of directories to search (in order). + * @param data File content to add. + */ + public static void putIntoFileCache(String filename, List<String> directories, + byte[] data) { + String mapKey = getMapKey(filename, directories); + fileCache.put(mapKey, data); + } + + /** + * Force adding the given data as belonging to the given key in the file + * cache. + * + * @see #getMapKey(String, List) + * @see #getMapKey(String[], List) + * @param mapKey Key to use in the cache. + * @param data File content to add. + */ + public static void putIntoFileCache(String mapKey, byte[] data) { + fileCache.put(mapKey, data); + } +} Copied: trunk/18xx/rails/common/parser/Config.java (from rev 1597, trunk/18xx/rails/util/Config.java) =================================================================== --- trunk/18xx/rails/common/parser/Config.java (rev 0) +++ trunk/18xx/rails/common/parser/Config.java 2011-07-03 20:06:38 UTC (rev 1598) @@ -0,0 +1,584 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/util/Config.java,v 1.13 2010/06/24 21:48:08 stefanfrey Exp $*/ +package rails.common.parser; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.log4j.Logger; + +import rails.game.GameManager; +import rails.util.Util; + +/** + * This is a simple utility class with a collection of static functions to load + * a property object from a property file, to retrieve a particular value from + * the property file etc. + * + * @author Ramiah Bala, + * @author Erik Vos + * @author Stefan Frey + * @version 2.0 + */ +public final class Config { + + protected static Logger log; + + /** Commandline options */ + private static final String CONFIGFILE_CMDLINE = "configfile"; + private static final String PROFILE_CMDLINE = "profile"; + + /** XML setup */ + private static final String CONFIG_XML_DIR = "data"; + private static final String CONFIG_XML_FILE = "Properties.xml"; + private static final String CONFIG_TAG = "Properties"; + private static final String SECTION_TAG = "Section"; + private static final String ITEM_TAG = "Property"; + + /** Log 4j configuration */ + private static final String LOG4J_CONFIG_FILE = "log4j.properties"; + + /** Rails profile configurations */ + private static String defaultProfilesFile = "data/profiles/default.profiles"; + private static Properties defaultProfiles = new Properties(); + private static String userProfilesFile = "user.profiles"; + private static Properties userProfiles = new Properties(); + private static boolean profilesLoaded = false; + private static String DEFAULT_PROFILE_SELECTION = "default"; // can be overwritten + private static final String TEST_PROFILE_SELECTION = ".test"; // used as default profile for integration tests + private static final String STANDARD_PROFILE_SELECTION = "user"; + private static final String DEFAULTPROFILE_PROPERTY = "default.profile"; + private static final String PROFILENAME_PROPERTY = "profile.name"; + + /** selected profile */ + private static String selectedProfile; + private static boolean legacyConfigFile; + + /** properties storage. */ + private static Properties defaultProperties = new Properties(); + private static Properties userProperties = new Properties(); + private static boolean propertiesLoaded = false; + + /** Map that holds the panel, which contains config items */ + private static Map<String, List<ConfigItem>> configSections = null; + + /** + * Hidden constructor, the class is never instantiated, everything is static + */ + private Config() {} + + /** + * Reads the config.xml file that defines all config items + */ + public static void readConfigSetupXML() { + List<String> directories = new ArrayList<String>(); + directories.add(CONFIG_XML_DIR); + try { + // Find the config tag inside the the config xml file + Tag configTag = + Tag.findTopTagInFile(CONFIG_XML_FILE, directories, CONFIG_TAG); + log.debug("Opened config xml, filename = " + CONFIG_XML_FILE); + + // define sections + configSections = new LinkedHashMap<String, List<ConfigItem>>(); + + // find sections + List<Tag> sectionTags = configTag.getChildren(SECTION_TAG); + if (sectionTags != null) { + for (Tag sectionTag:sectionTags) { + // find name attribute + String sectionName = sectionTag.getAttributeAsString("name"); + if (!Util.hasValue(sectionName)) continue; + + // find items + List<Tag> itemTags = sectionTag.getChildren(ITEM_TAG); + if (itemTags == null || itemTags.size() == 0) continue; + List<ConfigItem> sectionItems = new ArrayList<ConfigItem>(); + for (Tag itemTag:itemTags) { + sectionItems.add(new ConfigItem(itemTag)); + } + configSections.put(sectionName, sectionItems); + } + } + + } catch (ConfigurationException e) { + log.error("Configuration error in setup of " + CONFIG_XML_FILE + ", exception = " + e); + } + } + + public static Map<String, List<ConfigItem>> getConfigSections() { + if (configSections == null) { + readConfigSetupXML(); + } + log.debug("Configuration setup = " + configSections); + return configSections; + } + + public static int getMaxElementsInPanels() { + int maxElements = 0; + for (List<ConfigItem> panel:configSections.values()) { + maxElements = Math.max(maxElements, panel.size()); + } + log.debug("Configuration sections with maximum elements of " + maxElements); + return maxElements; + } + + /** + * updates the profile according to the changes in configitems + */ + public static void updateProfile(boolean applyInitMethods) { + for (List<ConfigItem> items:configSections.values()) { + for (ConfigItem item:items) { + if (!item.hasNewValue()) continue; + if (item.getNewValue().equals(defaultProperties.get(item.name))) { + userProperties.remove(item.name); + continue; + } + userProperties.setProperty(item.name, item.getNewValue()); + if (applyInitMethods) item.callInitMethod(); + log.debug("Changed property name = " + item.name + " to value = " + item.getNewValue()); + item.setNewValue(null); + } + } + } + + /** + * reverts all changes in configitems + */ + public static void revertProfile() { + for (List<ConfigItem> items:configSections.values()) { + for (ConfigItem item:items) { + item.setNewValue(null); + } + } + } + + /** + * First tries to return {key}.{gameName}, if undefined returns {key} + */ + public static String getGameSpecific(String key) { + return Config.getSpecific(key, GameManager.getInstance().getGameName()); + } + + /** + * First tries to return {key}.{appendix}, if undefined returns {key} + */ + public static String getSpecific(String key, String appendix) { + String value = Config.get(key + "." + appendix); + if (value == "") { + value = Config.get(key); + } + return value; + } + + public static String get(String key) { + return get(key, ""); + } + + public static String get(String key, String defaultValue) { + if (defaultProperties.isEmpty() || !propertiesLoaded) { + initialLoad(); + } + if (userProperties.containsKey(key)) return userProperties.getProperty(key).trim(); + if (defaultProperties.containsKey(key)) return defaultProperties.getProperty(key).trim(); + + return defaultValue; + } + + + /** + * save active Profile + */ + public static boolean saveActiveProfile() { + String filepath = userProfiles.getProperty(selectedProfile); + if (Util.hasValue(filepath)) { + return storePropertyFile(userProperties, filepath); + } else { + return false; + } + } + + /** + * change active Profile + */ + public static boolean changeActiveProfile(String profileName) { + readConfigSetupXML(); + loadProfile(profileName); + selectedProfile = profileName; + return true; + } + + /** + * create new profile + */ + public static boolean createUserProfile(String profileName, String defaultProfile) { + userProperties = new Properties(); + defaultProperties = new Properties(); + + // add to list of user profiles + userProfiles.setProperty(profileName, ""); + + // define and load default profile + String defaultConfigFile = defaultProfiles.getProperty(defaultProfile); + userProperties.setProperty(PROFILENAME_PROPERTY, profileName); + userProperties.setProperty(DEFAULTPROFILE_PROPERTY, defaultProfile); + loadPropertyFile(defaultProperties, defaultConfigFile, true); + setSaveDirDefaults(); + + selectedProfile = profileName; + return true; + } + + + private static Map<String, String> convertProperties(Properties properties, boolean visibleOnly) { + Map<String, String> converted = new HashMap<String, String>(); + for (Object key:properties.keySet()) { + if (visibleOnly && ((String)key).substring(0,1).equals(".")) continue; + converted.put((String) key, (String) properties.get(key)); + } + return converted; + } + + /** + * get all default profiles + */ + public static List<String> getDefaultProfiles(boolean visibleOnly) { + List<String> profiles = new ArrayList<String>(convertProperties(defaultProfiles, visibleOnly).keySet()); + Collections.sort(profiles); + return profiles; + } + + public static String getDefaultProfileSelection() { + return DEFAULT_PROFILE_SELECTION; + } + + /** + * get all user profiles + */ + public static List<String> getUserProfiles() { + List<String> profiles = new ArrayList<String>(convertProperties(userProfiles, true).keySet()); + Collections.sort(profiles); + return profiles; + } + + /** + * get all (visible default + user) profiles + */ + public static List<String> getAllProfiles() { + List<String> profiles = getDefaultProfiles(true); + profiles.addAll(getUserProfiles()); + return profiles; + } + + /** + * checks if profile is default profile + */ + public static boolean isDefaultProfile(String profileName) { + return !(defaultProfiles.get(profileName) == null); + } + + /** + * returns name of (active) default profile + */ + public static String getDefaultProfileName() { + return userProperties.getProperty(DEFAULTPROFILE_PROPERTY); + } + + /** + * returns name of active profile + */ + public static String getActiveProfileName() { + return selectedProfile; + } + + /** + * returns true if legacy configfile is used + */ + public static boolean isLegacyConfigFile() { + return legacyConfigFile; + } + + /** + * sets filename for an active profile (and store list of profiles) + * @return false if list of profiles cannot be stored + */ + public static boolean setActiveFilepath(String filepath) { + userProfiles.setProperty(selectedProfile, filepath); + return storePropertyFile(userProfiles, userProfilesFile); + } + + /** + * returns filename of active profile, (null if undefined or default profile) + */ + public static String getActiveFilepath() { + return userProfiles.getProperty(selectedProfile); + } + + /** + * @return if user location is defined + */ + public static boolean isFilePathDefined() { + return Util.hasValue(userProfiles.getProperty(selectedProfile)); + } + + + /** + * activates settings used for testing + */ + public static void setConfigTest() { + /* + * Set the system property that tells log4j to use this file. (Note: + * this MUST be done before updating Config) + */ + String log4jSelection = System.getProperty("log4j.configuration"); + if (!Util.hasValue(log4jSelection)) { + log4jSelection = LOG4J_CONFIG_FILE; + } + System.setProperty("log4j.configuration", log4jSelection); + System.out.println("log4j.configuration = " + log4jSelection); + + // delayed setting of logger + log = Logger.getLogger(Config.class.getPackage().getName()); + + // define settings for testing + legacyConfigFile = false; + DEFAULT_PROFILE_SELECTION = TEST_PROFILE_SELECTION; + selectedProfile = null; + + initialLoad(); + } + + + /** + * activates configuration settings based on default settings + */ + public static void setConfigSelection() { + /* + * Set the system property that tells log4j to use this file. (Note: + * this MUST be done before updating Config) + */ + String log4jSelection = System.getProperty("log4j.configuration"); + if (!Util.hasValue(log4jSelection)) { + log4jSelection = LOG4J_CONFIG_FILE; + } + System.setProperty("log4j.configuration", log4jSelection); + System.out.println("log4j.configuration = " + log4jSelection); + + // delayed setting of logger + log = Logger.getLogger(Config.class.getPackage().getName()); + + /* + * Check if the profile has been set from the command line + * to do this is adding an option to the java command: -Dprofile=<profile-name> + */ + String configSelection = System.getProperty(PROFILE_CMDLINE); + System.out.println("Cmdline profile selection = " + configSelection); + + legacyConfigFile = false; + if (configSelection == null) { + /* + * Check if the property file has been set on the command line. The way + * to do this is adding an option to the java command: -Dconfigfile=<property-filename> + * + * This is for legacy reasons only + */ + configSelection = System.getProperty(CONFIGFILE_CMDLINE); + + if (Util.hasValue(configSelection)) { + System.out.println("Cmdline configfile selection (legacy!) = " + configSelection); + legacyConfigFile = true; + } + } + + /* if nothing has selected so far, choose standardProfile */ + if (!Util.hasValue(configSelection)) { + configSelection = STANDARD_PROFILE_SELECTION; + } + + selectedProfile = configSelection; + if (!legacyConfigFile) { + System.out.println("Profile selection = " + selectedProfile); + } + + initialLoad(); + } + + + private static void initialLoad() { + if (legacyConfigFile) { + if (!propertiesLoaded) { + loadPropertyFile(defaultProperties, selectedProfile, false); + propertiesLoaded = true; + setSaveDirDefaults(); + } + return; + } + + if (!profilesLoaded) { + loadPropertyFile(defaultProfiles, defaultProfilesFile, true); + loadPropertyFile(userProfiles, userProfilesFile, false); + profilesLoaded = true; + } + + /* Tell the properties loader to read this file. */ + log.info("Selected profile = " + selectedProfile); + + if (!propertiesLoaded) { + loadProfile(selectedProfile); + propertiesLoaded = true; + } + } + + + /** + * loads an external user profile + * defined by the filepath + */ + public static boolean loadProfileFromFile(File file) { + String filepath = file.getPath(); + if (loadPropertyFile(userProperties, filepath, false)) { + String profile = userProperties.getProperty(PROFILENAME_PROPERTY); + if (!Util.hasValue(profile)) { + profile = STANDARD_PROFILE_SELECTION; + } + selectedProfile = profile; + setActiveFilepath(filepath); // do not set filepath on import + loadDefaultProfile(); + setSaveDirDefaults(); + return true; + } else { + return false; + } + } + + /** + * imports an external user profile into an existing profile + * defined by the filepath + */ + public static boolean importProfileFromFile(File file) { + String filepath = file.getPath(); + Properties importProperties = new Properties(); + if (loadPropertyFile(importProperties, filepath, false)) { + userProperties.putAll(importProperties); + setSaveDirDefaults(); + return true; + } else { + return false; + } + } + + + /** + * loads a user profile + * if not defined or loadable, creates a default user profile + */ + private static void loadProfile(String userProfile) { + // reset properties + userProperties = new Properties(); + defaultProperties = new Properties(); + + String userConfigFile = null; + if (Util.hasValue(userProfile)) { + // check if the profile is already defined under userProfiles + userConfigFile = userProfiles.getProperty(userProfile); + if (Util.hasValue(userConfigFile) && // load user profile + loadPropertyFile(userProperties, userConfigFile, fa... [truncated message content] |
From: <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. |