You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: <ev...@us...> - 2010-09-23 23:02:10
|
Revision: 1432 http://rails.svn.sourceforge.net/rails/?rev=1432&view=rev Author: evos Date: 2010-09-23 23:01:59 +0000 (Thu, 23 Sep 2010) Log Message: ----------- Added 1825 special tiles. Fixed map. Modified Paths: -------------- trunk/18xx/data/1825/Map.xml trunk/18xx/data/1825/TileSet.xml trunk/18xx/data/1825/Tiles.xml trunk/18xx/tiles/TileDictionary.18t trunk/18xx/tiles/TileDictionary.xml trunk/18xx/tiles/Tiles.xml trunk/18xx/tiles/svg/tile-102.svg trunk/18xx/tiles/svg/tile-25002.svg trunk/18xx/tiles/svg/tile-25003.svg trunk/18xx/tiles/svg/tile-804.svg Added Paths: ----------- trunk/18xx/tiles/svg/tile-25008.svg trunk/18xx/tiles/svg/tile-25009.svg trunk/18xx/tiles/svg/tile-25010.svg trunk/18xx/tiles/svg/tile-25011.svg trunk/18xx/tiles/svg/tile-25012.svg trunk/18xx/tiles/svg/tile-25013.svg trunk/18xx/tiles/svg/tile-25014.svg trunk/18xx/tiles/svg/tile-25015.svg trunk/18xx/tiles/svg/tile-25016.svg Property Changed: ---------------- trunk/18xx/tiles/ Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-22 21:38:18 UTC (rev 1431) +++ trunk/18xx/data/1825/Map.xml 2010-09-23 23:01:59 UTC (rev 1432) @@ -1,7 +1,7 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" 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"/--> + <Hex name="B12" tile="-25011" city="Aberdeen"/> <Hex name="C7" tile="-1" cost="100" city="Pitlochry" open="1,2"/> <Hex name="C9" tile="0" cost="100" open="3"/> <Hex name="C11" tile="0" open="2"/> @@ -15,11 +15,11 @@ <Hex name="E5" tile="0" cost="100"/> <Hex name="E7" tile="-25005" orientation="1" city="Perth"/> <Hex name="E9" tile="-10" cost="80" city="Dundee"/> - <!--Hex name="F2" tile="-25012" city="Helensburgh, Gourock"/--> + <Hex name="F2" tile="-25012" city="Helensburgh, Gourock"/> <Hex name="F4" tile="-1" cost="40" city="Dumbarton"/> <Hex name="F6" tile="-1" city="Stirling"/> <Hex name="F8" tile="-2" orientation="3" cost="120" city="Dumfermline, Kirkaldy"/> - <!--Hex name="F10" tile="-25013" city="Anstruther"/--> + <Hex name="F10" tile="-25013" city="Anstruther"/> <Hex name="G3" tile="-10" city="Greenock"/> <Hex name="G5" tile="-25002" city="Glasgow"/> <Hex name="G7" tile="-2" city="Coatbridge, Airdrie"/> @@ -44,7 +44,7 @@ <Hex name="J10" tile="-10" ciry="Carlisle"/> <Hex name="J12" tile="0" cost="100"/> <Hex name="J14" tile="-20" cost="40" city="Newcastle u/T, Sunderland"/> - <!--Hex name="K7" tile="-25014" orientation="2" city="Maryport"/--> + <Hex name="K7" tile="-25014" orientation="2" city="Maryport"/> <Hex name="K9" tile="0" cost="100" open="0,5"/> <Hex name="K11" tile="0" cost="100" open="0,5"/> <Hex name="K13" tile="-1" city="Durham" open="0,5"/> @@ -57,7 +57,7 @@ <Hex name="L14" tile="-10" city="Darlington" open="2,3"/> <Hex name="L16" tile="0" open="2"/> <Hex name="L18" tile="-1" city="Scarborough"/> - <!--Hex name="M9" tile="-25008" city="Barrow"/--> + <Hex name="M9" tile="-25008" city="Barrow"/> <Hex name="M11" tile="0" cost="100"/> <Hex name="M13" tile="0" cost="100"/> <Hex name="M15" tile="-2" city="Harrogate, York"/> @@ -68,10 +68,10 @@ <Hex name="N14" tile="-20" city="Bradford, Leeds"/> <Hex name="N16" tile="0"/> <Hex name="N18" tile="-10" cost="40" city="Hull"/> - <!--Hex name="O9" tile="-25009" cost="40" city="Liverpool"/--> + <Hex name="O9" tile="-25009" cost="40" city="Liverpool"/> <Hex name="O11" tile="-25002" city="Manchester"/> <Hex name="O13" tile="0" cost="100"/> - <!--Hex name="O15" tile="-25010" city="Barnsley, Doncaster"/--> + <Hex name="O15" tile="-25010" city="Barnsley, Doncaster"/> <Hex name="O17" tile="0" cost="40"/> <Hex name="O19" tile="0"/> <Hex name="P8" tile="-41" orientation="4"/> @@ -135,7 +135,12 @@ <Hex name="V18" tile="0"/> <Hex name="V20" tile="-25001" city="London"/> <Hex name="V22" tile="-25006" value="20" city="Southend"/> - <Hex name="W9" tile="-41" orientation="3" /> + <IfOption name="Include" parm="R2" value="no"> + <Hex name="W9" tile="-41" orientation="3" /> + </IfOption> + <IfOption name="Include" parm="R2" value="yes"> + <Hex name="W9" tile="-25016"/> + </IfOption> <Hex name="W11" tile="-2" city="Bath,Trowbridge" orientation="4" /> <Hex name="W13" tile="0"/> <Hex name="W15" tile="0"/> @@ -171,10 +176,11 @@ <Hex name="T2" tile="-10" city="Fishguard"/> <Hex name="T4" tile="0"/> <Hex name="T6" tile="0" cost="100"/> - <!--Hex name="U1" tile="-25015" city="Milford Haven"/--> + <Hex name="U1" tile="-25015" city="Milford Haven"/> <Hex name="U3" tile="0"/> <Hex name="U5" tile="0"/> - <Hex name="V8" tile="-25007" orientation="1" city="Swansea"/> + <Hex name="U7" tile="-2"/> + <Hex name="V6" tile="-25007" orientation="1" city="Swansea"/> </IfOption> <IfOption name="Include" parm="R2" value="yes"> <Hex name="X4" tile="-1" city="Barnstaple"/> @@ -187,11 +193,11 @@ <Hex name="Z2" tile="-1" city="Fowey"/> <Hex name="Z4" tile="-20" city="Devenport, Plymouth"/> <Hex name="Z6" tile="-1" city="Torquay"/> - <!--Hex name="AA-1" tile="-1" city="Penzance"/> - <Hex name="AA1" tile="-10" city="Falmouth"/--> + <Hex name="AA99" tile="-1" city="Penzance"/> + <Hex name="AA1" tile="-10" city="Falmouth"/> </IfOption> <IfOption name="Include" parm="R3" value="yes"> - <!--Hex name="Q23" tile="-25014" orientation="1" city="Melton Constable"/--> + <Hex name="Q23" tile="-25014" orientation="1" city="Melton Constable"/> <Hex name="Q25" tile="0"/> </IfOption> </IfOption> Modified: trunk/18xx/data/1825/TileSet.xml =================================================================== --- trunk/18xx/data/1825/TileSet.xml 2010-09-22 21:38:18 UTC (rev 1431) +++ trunk/18xx/data/1825/TileSet.xml 2010-09-23 23:01:59 UTC (rev 1432) @@ -27,6 +27,15 @@ <Tile id="-25005"/> <Tile id="-25006"/> <Tile id="-25007"/> + <Tile id="-25008"/> + <Tile id="-25009"><!--Liverpool--><Upgrade id="33"/></Tile> + <Tile id="-25010"/> + <Tile id="-25011"/> + <Tile id="-25012"/> + <Tile id="-25013"/> + <Tile id="-25014"/> + <Tile id="-25015"/> + <Tile id="-25016"/> <!-- Yellow tiles --> <Tile id="1" quantity="1" > <Upgrade id="14"></Upgrade></Tile> @@ -103,6 +112,7 @@ <Tile id="88" quantity="1"></Tile> <!-- Brown tiles --> <Tile id="32" quantity="1" /> + <Tile id="33" quantity="1" /> <Tile id="34" quantity="1" /> <Tile id="38" quantity="2" /> <Tile id="41" quantity="1" /> Modified: trunk/18xx/data/1825/Tiles.xml =================================================================== --- trunk/18xx/data/1825/Tiles.xml 2010-09-22 21:38:18 UTC (rev 1431) +++ trunk/18xx/data/1825/Tiles.xml 2010-09-23 23:01:59 UTC (rev 1432) @@ -1,279 +1,399 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<Tiles> - <Tile colour="white" id="0" name="empty"/> - <!--Tile colour="white" id="-10000" name="empty"/--> - <Tile colour="white" id="-1" name="1 village"> - <Station id="city1" position="002" type="Town"/> - </Tile><Tile colour="white" id="-2" name="2 villages"> - <Station id="city1" position="102" type="Town"/> - <Station id="city2" position="302" type="Town"/> - </Tile><Tile colour="white" id="-10" name="1 city"> - <Station id="city1" position="302" slots="1" type="City"/> - </Tile><Tile colour="yellow" id="-20" name="2 cities"> - <Station id="city1" position="002" slots="1" type="City"/> - <Station id="city2" position="302" slots="1" type="City"/> - </Tile><Tile colour="fixed" id="-5" name="MF 5"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side1"/> - </Tile><Tile colour="fixed" id="-7" name="MF 7"> - <Track from="side2" gauge="normal" to="side1"/> - </Tile><Tile colour="fixed" id="-41" name="-41"> - <Track from="side0" gauge="normal" to="side3"/> - <Track from="side4" gauge="normal" to="side0"/> - <Track from="side4" gauge="normal" to="side3"/> - </Tile><Tile colour="fixed" id="-104" name="MF 104"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="green" id="-25001" name="London"> - <Station id="city1" position="403" slots="1" type="City" value="50"/> - <Station id="city2" position="503" slots="1" type="City" value="50"/> - <Station id="city3" position="003" slots="1" type="City" value="50"/> - <Station id="city4" position="103" slots="1" type="City" value="50"/> - <Station id="city5" position="203" slots="1" type="City" value="50"/> - <Station id="city6" position="303" slots="1" type="City" value="50"/> - <Track from="side5" gauge="normal" to="city2"/> - <Track from="side4" gauge="normal" to="city1"/> - <Track from="side3" gauge="normal" to="city6"/> - <Track from="side2" gauge="normal" to="city5"/> - <Track from="side1" gauge="normal" to="city4"/> - <Track from="side0" gauge="normal" to="city3"/> - </Tile><Tile colour="green" id="-25002" name="Birmingham"> - <Station id="city1" position="402" slots="1" type="City" value="40"/> - <Station id="city2" position="002" slots="1" type="City" value="40"/> - <Station id="city3" position="202" slots="1" type="City" value="40"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city3" gauge="normal" to="side2"/> - <Track from="side0" gauge="normal" to="city2"/> - </Tile><Tile colour="green" id="-25003" name="Bristol"> - <Station id="city1" position="0" slots="1" type="City" value="30"/> - <Track from="side3" gauge="normal" to="city1"/> - <Track from="city1" gauge="normal" to="side1"/> - </Tile><Tile colour="fixed" id="-25004" name="Wolverton"> - <Station id="city1" position="0" slots="1" type="City" value="10"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="fixed" id="-25005" name="Swindon"> - <Station id="city1" position="0" slots="1" type="City" value="10"/> - <Track from="side4" gauge="normal" to="city1"/> - <Track from="side5" gauge="normal" to="city1"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="fixed" id="-25006" name="Southend"> - <Station id="city1" position="102" slots="1" type="City" value="20"/> - <Track from="side4" gauge="normal" to="side0"/> - <Track from="side4" gauge="normal" to="city1"/> - <Track from="side3" gauge="normal" to="side2"/> - </Tile><Tile colour="fixed" id="-25007" name="Bournemouth"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Station id="city2" position="0" slots="1" type="City" value="20"/> - <Track from="side4" gauge="normal" to="city2"/> - <Track from="side5" gauge="normal" to="city2"/> - <Track from="side0" gauge="normal" to="city2"/> - </Tile><Tile colour="yellow" id="1" name="1"> - <Station id="city1" position="408" type="Town" value="10"/> - <Station id="city2" position="108" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city2" gauge="normal" to="side1"/> - <Track from="city2" gauge="normal" to="side3"/> - </Tile><Tile colour="yellow" id="2" name="2"> - <Station id="city1" position="302" type="Town" value="10"/> - <Station id="city2" position="109" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city2" gauge="normal" to="side1"/> - <Track from="city2" gauge="normal" to="side2"/> - </Tile><Tile colour="yellow" id="3" name="3"> - <Station id="city1" position="352" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - </Tile><Tile colour="yellow" id="4" name="4"> - <Station id="city1" position="0" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile><Tile colour="yellow" id="5" name="5"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="yellow" id="6" name="6"> - <Station id="city1" position="0" slots="1" type="City" value="20"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="yellow" id="7" name="7"> - <Track from="side3" gauge="normal" to="side4"/> - </Tile><Tile colour="yellow" id="8" name="8"> - <Track from="side3" gauge="normal" to="side5"/> - </Tile><Tile colour="yellow" id="9" name="9"> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="yellow" id="55" name="55"> - <Station id="city1" position="202" type="Town" value="10"/> - <Station id="city2" position="302" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side5"/> - <Track from="city2" gauge="normal" to="side3"/> - <Track from="city2" gauge="normal" to="side0"/> - </Tile><Tile colour="yellow" id="56" name="56"> - <Station id="city1" position="407" type="Town" value="10"/> - <Station id="city2" position="108" type="Town" value="10"/> - <Track from="city2" gauge="normal" to="side1"/> - <Track from="city2" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side2"/> - </Tile><Tile colour="green" id="12" name="12"> - <Station id="city1" position="0" slots="1" 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"/> - </Tile><Tile colour="green" id="13" name="13"> - <Station id="city1" position="0" slots="1" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side4"/> - </Tile><Tile colour="green" id="14" name="14"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="15" name="15"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="16" name="16"> - <Track from="side3" gauge="normal" to="side5"/> - <Track from="side4" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="19" name="19"> - <Track from="side5" gauge="normal" to="side1"/> - <Track from="side0" gauge="normal" to="side3"/> - </Tile><Tile colour="green" id="20" name="20"> - <Track from="side1" gauge="normal" to="side4"/> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="23" name="23"> - <Track from="side4" gauge="normal" to="side0"/> - <Track from="side0" gauge="normal" to="side3"/> - </Tile><Tile colour="green" id="24" name="24"> - <Track from="side3" gauge="normal" to="side5"/> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="25" name="25"> - <Track from="side1" gauge="normal" to="side3"/> - <Track from="side3" gauge="normal" to="side5"/> - </Tile><Tile colour="green" id="26" name="26"> - <Track from="side5" gauge="normal" to="side0"/> - <Track from="side0" gauge="normal" to="side3"/> - </Tile><Tile colour="green" id="27" name="27"> - <Track from="side3" gauge="normal" to="side4"/> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="green" id="28" name="28"> - <Track from="side3" gauge="normal" to="side5"/> - <Track from="side4" gauge="normal" to="side5"/> - </Tile><Tile colour="green" id="29" name="29"> - <Track from="side3" gauge="normal" to="side4"/> - <Track from="side3" gauge="normal" to="side5"/> - </Tile><Tile colour="green" id="1052" name="52"> - <Station id="city1" position="152" slots="1" type="City" value="40"/> - <Station id="city2" position="452" slots="1" type="City" value="40"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city2" gauge="normal" to="side4"/> - </Tile><Tile colour="green" id="87" name="87"> - <Station id="city1" position="0" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile><Tile colour="green" id="88" name="88"> - <Station id="city1" position="0" type="Town" value="10"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile><Tile colour="brown" id="32" name="32"> - <Station id="city1" position="303" slots="1" type="City" value="70"/> - <Station id="city2" position="403" slots="1" type="City" value="70"/> - <Station id="city3" position="503" slots="1" type="City" value="70"/> - <Station id="city4" position="003" slots="1" type="City" value="70"/> - <Station id="city5" position="103" slots="1" type="City" value="70"/> - <Station id="city6" position="203" slots="1" type="City" value="70"/> - <Track from="city6" gauge="normal" to="side2"/> - <Track from="city5" gauge="normal" to="side1"/> - <Track from="city4" gauge="normal" to="side0"/> - <Track from="city3" gauge="normal" to="side5"/> - <Track from="city2" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side3"/> - </Tile><Tile colour="brown" id="34" name="34"> - <Station id="city1" position="352" slots="1" type="City" value="50"/> - <Station id="city2" position="052" slots="1" type="City" value="50"/> - <Station id="city3" position="502" slots="1" type="City" value="50"/> - <Track from="city2" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city3" gauge="normal" to="side2"/> - <Track from="city3" gauge="normal" to="side5"/> - </Tile><Tile colour="brown" id="38" name="38"> - <Station id="city1" position="0" slots="2" type="City" value="40"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side5"/> - </Tile><Tile colour="brown" id="41" name="41"> - <Track from="side4" gauge="normal" to="side0"/> - <Track from="side4" gauge="normal" to="side3"/> - <Track from="side0" gauge="normal" to="side3"/> - </Tile><Tile colour="brown" id="42" name="42"> - <Track from="side3" gauge="normal" to="side5"/> - <Track from="side3" gauge="normal" to="side0"/> - <Track from="side5" gauge="normal" to="side0"/> - </Tile><Tile colour="brown" id="45" name="45"> - <Track from="side1" gauge="normal" to="side5"/> - <Track from="side1" gauge="normal" to="side3"/> - <Track from="side5" gauge="normal" to="side0"/> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="brown" id="46" name="46"> - <Track from="side1" gauge="normal" to="side5"/> - <Track from="side1" gauge="normal" to="side0"/> - <Track from="side3" gauge="normal" to="side5"/> - <Track from="side3" gauge="normal" to="side0"/> - </Tile><Tile colour="brown" id="47" name="47"> - <Track from="side3" gauge="normal" to="side0"/> - <Track from="side3" gauge="normal" to="side1"/> - <Track from="side4" gauge="normal" to="side0"/> - <Track from="side4" gauge="normal" to="side1"/> - </Tile><Tile colour="brown" id="64" name="64"> - <Station id="city1" position="401" slots="1" type="City" value="50"/> - <Station id="city2" position="052" slots="1" type="City" value="50"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side5"/> - <Track from="city2" gauge="normal" to="side1"/> - <Track from="city2" gauge="normal" to="side0"/> - </Tile><Tile colour="brown" id="65" name="65"> - <Station id="city1" position="501" slots="1" type="City" value="50"/> - <Station id="city2" position="252" slots="1" type="City" value="50"/> - <Track from="city1" gauge="normal" to="side4"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city2" gauge="normal" to="side2"/> - <Track from="city2" gauge="normal" to="side3"/> - </Tile><Tile colour="brown" id="66" name="66"> - <Station id="city1" position="002" slots="1" type="City" value="50"/> - <Station id="city2" position="452" slots="1" type="City" value="50"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city1" gauge="normal" to="side0"/> - <Track from="city2" gauge="normal" to="side4"/> - <Track from="city2" gauge="normal" to="side5"/> - </Tile><Tile colour="brown" id="67" name="67"> - <Station id="city1" position="307" slots="1" type="City" value="50"/> - <Station id="city2" position="502" slots="1" type="City" value="50"/> - <Track from="city1" gauge="normal" to="side1"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city2" gauge="normal" to="side5"/> - <Track from="city2" gauge="normal" to="side2"/> - </Tile><Tile colour="brown" id="68" name="68"> - <Station id="city1" position="302" slots="1" type="City" value="50"/> - <Station id="city2" position="502" slots="1" type="City" value="50"/> - <Track from="city1" gauge="normal" to="side3"/> - <Track from="city2" gauge="normal" to="side2"/> - <Track from="city2" gauge="normal" to="side5"/> - <Track from="city1" gauge="normal" to="side0"/> - </Tile></Tiles> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<Tiles> + <Tile colour="white" id="0" name="empty"/> + <Tile colour="white" id="-1" name="1 village"> + <Station id="city1" position="002" type="Town"/> + </Tile> + <Tile colour="white" id="-2" name="2 villages"> + <Station id="city1" position="102" type="Town"/> + <Station id="city2" position="302" type="Town"/> + </Tile> + <Tile colour="white" id="-10" name="1 city"> + <Station id="city1" position="302" slots="1" type="City"/> + </Tile> + <Tile colour="yellow" id="-20" name="2 cities"> + <Station id="city1" position="002" slots="1" type="City"/> + <Station id="city2" position="302" slots="1" type="City"/> + </Tile> + <Tile colour="fixed" id="-5" name="MF 5"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="fixed" id="-7" name="MF 7"> + <Track from="side2" gauge="normal" to="side1"/> + </Tile> + <Tile colour="fixed" id="-41" name="-41"> + <Track from="side0" gauge="normal" to="side3"/> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side3"/> + </Tile> + <Tile colour="fixed" id="-104" name="MF 104"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="green" id="-25001" name="London"> + <Station id="city1" position="403" slots="1" type="City" value="50"/> + <Station id="city2" position="503" slots="1" type="City" value="50"/> + <Station id="city3" position="003" slots="1" type="City" value="50"/> + <Station id="city4" position="103" slots="1" type="City" value="50"/> + <Station id="city5" position="203" slots="1" type="City" value="50"/> + <Station id="city6" position="303" slots="1" type="City" value="50"/> + <Track from="side5" gauge="normal" to="city2"/> + <Track from="side4" gauge="normal" to="city1"/> + <Track from="side3" gauge="normal" to="city6"/> + <Track from="side2" gauge="normal" to="city5"/> + <Track from="side1" gauge="normal" to="city4"/> + <Track from="side0" gauge="normal" to="city3"/> + </Tile> + <Tile colour="green" id="-25002" name="B/M/G"> + <Station id="city1" position="402" slots="1" type="City" value="40"/> + <Station id="city2" position="002" slots="1" type="City" value="40"/> + <Station id="city3" position="202" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city3" gauge="normal" to="side2"/> + <Track from="side0" gauge="normal" to="city2"/> + </Tile> + <Tile colour="green" id="-25003" name="Bristol"> + <Station id="city1" position="0" slots="1" type="City" value="30"/> + <Track from="side3" gauge="normal" to="city1"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="fixed" id="-25004" name="Wolverton"> + <Station id="city1" position="0" slots="1" type="City" value="10"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-25005" name="Swindon"> + <Station id="city1" position="0" slots="1" type="City" value="10"/> + <Track from="side4" gauge="normal" to="city1"/> + <Track from="side5" gauge="normal" to="city1"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-25006" name="Southend"> + <Station id="city1" position="102" slots="1" type="City" value="20"/> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="city1"/> + <Track from="side3" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-25007" name="Bournemouth"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Station id="city2" position="0" slots="1" type="City" value="20"/> + <Track from="side4" gauge="normal" to="city2"/> + <Track from="side5" gauge="normal" to="city2"/> + <Track from="side0" gauge="normal" to="city2"/> + </Tile> + <Tile colour="fixed" id="-25008" name="Barrow"> + <Station id="city1" position="552" slots="1" type="City" value="10"/> + <Station id="city2" position="152" type="Town" value="10"/> + <Track from="side5" gauge="normal" to="city1"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side2"/> + </Tile> + <Tile colour="green" id="-25009" name="Liverpool"> + <Station id="city1" position="002" slots="1" type="City" value="40"/> + <Station id="city2" position="202" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-25010" name="Doncaster"> + <Station id="city1" position="351" slots="1" type="City" value="20"/> + <Station id="city2" position="051" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city2" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side5"/> + </Tile> + <Tile colour="fixed" id="-25011" name="Aberdeen"> + <Station id="city1" position="0" slots="1" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="fixed" id="-25012" name="Helensburgh"> + <Station id="city1" position="202" type="Town" value="10"/> + <Station id="city2" position="102" type="Town" value="10"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="fixed" id="-25013" name="Anstruther"> + <Station id="city1" position="502" type="Town" value="10"/> + <Track from="side2" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="fixed" id="-25014" name="Maryport"> + <Station id="city1" position="051" slots="1" type="City" value="10"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="fixed" id="-25015" name="Milford H."> + <Station id="city1" position="052" slots="1" type="City" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + </Tile> + <Tile colour="fixed" id="-25016" name="Highbridge"> + <Station id="city1" position="151" slots="1" type="City" value="10"/> + <Track from="side0" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="1" name="1"> + <Station id="city1" position="408" type="Town" value="10"/> + <Station id="city2" position="108" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side3"/> + </Tile> + <Tile colour="yellow" id="2" name="2"> + <Station id="city1" position="302" type="Town" value="10"/> + <Station id="city2" position="109" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="3" name="3"> + <Station id="city1" position="352" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + </Tile> + <Tile colour="yellow" id="4" name="4"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="5" name="5"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="6" name="6"> + <Station id="city1" position="0" slots="1" type="City" value="20"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="yellow" id="7" name="7"> + <Track from="side3" gauge="normal" to="side4"/> + </Tile> + <Tile colour="yellow" id="8" name="8"> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="yellow" id="9" name="9"> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="55" name="55"> + <Station id="city1" position="202" type="Town" value="10"/> + <Station id="city2" position="302" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side3"/> + <Track from="city2" gauge="normal" to="side0"/> + </Tile> + <Tile colour="yellow" id="56" name="56"> + <Station id="city1" position="407" type="Town" value="10"/> + <Station id="city2" position="108" type="Town" value="10"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side2"/> + </Tile> + <Tile colour="green" id="12" name="12"> + <Station id="city1" position="0" slots="1" 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"/> + </Tile> + <Tile colour="green" id="13" name="13"> + <Station id="city1" position="0" slots="1" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + </Tile> + <Tile colour="green" id="14" name="14"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="15" name="15"> + <Station id="city1" position="0" slots="2" type="City" value="30"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="16" name="16"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="19" name="19"> + <Track from="side5" gauge="normal" to="side1"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="20" name="20"> + <Track from="side1" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="23" name="23"> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="24" name="24"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="25" name="25"> + <Track from="side1" gauge="normal" to="side3"/> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="26" name="26"> + <Track from="side5" gauge="normal" to="side0"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="green" id="27" name="27"> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="green" id="28" name="28"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side4" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="29" name="29"> + <Track from="side3" gauge="normal" to="side4"/> + <Track from="side3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="1052" name="52"> + <Station id="city1" position="152" slots="1" type="City" value="40"/> + <Station id="city2" position="452" slots="1" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city2" gauge="normal" to="side4"/> + </Tile> + <Tile colour="green" id="87" name="87"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="green" id="88" name="88"> + <Station id="city1" position="0" type="Town" value="10"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="32" name="32"> + <Station id="city1" position="303" slots="1" type="City" value="70"/> + <Station id="city2" position="403" slots="1" type="City" value="70"/> + <Station id="city3" position="503" slots="1" type="City" value="70"/> + <Station id="city4" position="003" slots="1" type="City" value="70"/> + <Station id="city5" position="103" slots="1" type="City" value="70"/> + <Station id="city6" position="203" slots="1" type="City" value="70"/> + <Track from="city6" gauge="normal" to="side2"/> + <Track from="city5" gauge="normal" to="side1"/> + <Track from="city4" gauge="normal" to="side0"/> + <Track from="city3" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side3"/> + </Tile> + <Tile colour="brown" id="33" name="33"> + <Station id="city1" position="102" slots="1" type="City" value="50"/> + <Station id="city2" position="302" slots="1" type="City" value="50"/> + <Station id="city3" position="502" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city2" gauge="normal" to="side3"/> + <Track from="city3" gauge="normal" to="side4"/> + </Tile> + <Tile colour="brown" id="34" name="34"> + <Station id="city1" position="352" slots="1" type="City" value="50"/> + <Station id="city2" position="052" slots="1" type="City" value="50"/> + <Station id="city3" position="502" slots="1" type="City" value="50"/> + <Track from="city2" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city3" gauge="normal" to="side2"/> + <Track from="city3" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="38" name="38"> + <Station id="city1" position="0" slots="2" type="City" value="40"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city1" gauge="normal" to="side2"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="41" name="41"> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side3"/> + <Track from="side0" gauge="normal" to="side3"/> + </Tile> + <Tile colour="brown" id="42" name="42"> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side5" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="45" name="45"> + <Track from="side1" gauge="normal" to="side5"/> + <Track from="side1" gauge="normal" to="side3"/> + <Track from="side5" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="46" name="46"> + <Track from="side1" gauge="normal" to="side5"/> + <Track from="side1" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side5"/> + <Track from="side3" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="47" name="47"> + <Track from="side3" gauge="normal" to="side0"/> + <Track from="side3" gauge="normal" to="side1"/> + <Track from="side4" gauge="normal" to="side0"/> + <Track from="side4" gauge="normal" to="side1"/> + </Tile> + <Tile colour="brown" id="64" name="64"> + <Station id="city1" position="401" slots="1" type="City" value="50"/> + <Station id="city2" position="052" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side1"/> + <Track from="city2" gauge="normal" to="side0"/> + </Tile> + <Tile colour="brown" id="65" name="65"> + <Station id="city1" position="501" slots="1" type="City" value="50"/> + <Station id="city2" position="252" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side4"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side2"/> + <Track from="city2" gauge="normal" to="side3"/> + </Tile> + <Tile colour="brown" id="66" name="66"> + <Station id="city1" position="002" slots="1" type="City" value="50"/> + <Station id="city2" position="452" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city1" gauge="normal" to="side0"/> + <Track from="city2" gauge="normal" to="side4"/> + <Track from="city2" gauge="normal" to="side5"/> + </Tile> + <Tile colour="brown" id="67" name="67"> + <Station id="city1" position="307" slots="1" type="City" value="50"/> + <Station id="city2" position="502" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side1"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city2" gauge="normal" to="side5"/> + <Track from="city2" gauge="normal" to="side2"/> + </Tile> + <Tile colour="brown" id="68" name="68"> + <Station id="city1" position="302" slots="1" type="City" value="50"/> + <Station id="city2" position="502" slots="1" type="City" value="50"/> + <Track from="city1" gauge="normal" to="side3"/> + <Track from="city2" gauge="normal" to="side2"/> + <Track from="city2" gauge="normal" to="side5"/> + <Track from="city1" gauge="normal" to="side0"/> + </Tile> +</Tiles> \ No newline at end of file Property changes on: trunk/18xx/tiles ___________________________________________________________________ Added: svn:ignore + Copy of TileDictionary.18t handmade TDwithID TDwoID xml tileimages.xml Copy (2) of TileDictionary.18t Copy (3) of TileDictionary.18t Modified: trunk/18xx/tiles/TileDictionary.18t =================================================================== (Binary files differ) Modified: trunk/18xx/tiles/TileDictionary.xml =================================================================== --- trunk/18xx/tiles/TileDictionary.xml 2010-09-22 21:38:18 UTC (rev 1431) +++ trunk/18xx/tiles/TileDictionary.xml 2010-09-23 23:01:59 UTC (rev 1432) @@ -1,19867 +1,20196 @@ -<?xml version="1.0"?> -<tiles> - <tile> - <ID>-909</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM straight</name> - <junctions/> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp4SideC</position1> - <position2>tp4SideF</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-908</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM wide curve</name> - <junctions/> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp4SideA</position1> - <position2>tp4SideC</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-907</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM tight curve</name> - <junctions/> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp4SideB</position1> - <position2>tp4SideC</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-903</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM 3 way</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCenter</position> - <revenue> - <value>-1</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideB</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-902</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM 2 way</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCenter</position> - <revenue> - <value>-1</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideB</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-901</ID> - <shape>tsHexagon</shape> - <level>tlOffMap</level> - <name>OM 1 way</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCenter</position> - <revenue> - <value>-1</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-102</ID> - <shape>tsHexagon</shape> - <level>tlMapFixed</level> - <name>-102</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tp1CornerD</position> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp1CornerD</position1> - <position2>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp1CornerD</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp1CornerD</position1> - <position2>tp4SideE</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-101</ID> - <shape>tsHexagon</shape> - <level>tlMapFixed</level> - <name>Philadelphia</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tpCenter</position> - <revenue> - <value>10</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>tp4SideE</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp2CornerD</position1> - <position2>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp2CornerD</position1> - <position2>tp4SideE</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-21</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToGreen</level> - <name>NY</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tp2SideC</position> - <revenue> - <value>40</value> - <position>tp3SideE</position> - </revenue> - </junction> - <junction> - <junType>jtCity</junType> - <position>tp2SideF</position> - <revenue> - <value>40</value> - <position>tp3SideB</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp2SideC</position1> - <position2>tp4SideC</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp2SideF</position1> - <position2>tp4SideF</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-20</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToGreen</level> - <name>2 cities</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tp2SideA</position> - </junction> - <junction> - <junType>jtCity</junType> - <position>tp2SideD</position> - </junction> - </junctions> - <connections/> - </tile> - <tile> - <ID>-11</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToGreen</level> - <name>B</name> - <junctions> - <junction> - <junType>jtCity</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>tp4SideD</position2> - </connection> - </connections> - </tile> - <tile> - <ID>-10</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToYellow</level> - <name>1 city</name> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tp2SideD</position> - </junction> - </junctions> - <connections/> - </tile> - <tile> - <ID>-2</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToYellow</level> - <name>2 villages</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tp2SideB</position> - </junction> - <junction> - <junType>jtWhistlestop</junType> - <position>tp2SideD</position> - </junction> - </junctions> - <connections/> - </tile> - <tile> - <ID>-1</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToYellow</level> - <name>1 village</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tp2SideA</position> - </junction> - </junctions> - <connections/> - </tile> - <tile> - <ID>0</ID> - <shape>tsHexagon</shape> - <level>tlMapUpgradableToYellow</level> - <name>empty</name> - <junctions/> - <connections/> - </tile> - <tile> - <ID>1</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>1</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCurve2LeftE</position> - <revenue> - <value>10</value> - <position>tp3CornerE</position> - </revenue> - </junction> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCurve2LeftB</position> - <revenue> - <value>10</value> - <position>tp3CornerB</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve2LeftE</position1> - <position2>tp4SideA</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve2LeftE</position1> - <position2>tp4SideE</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve2LeftB</position1> - <position2>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve2LeftB</position1> - <position2>tp4SideD</position2> - </connection> - </connections> - </tile> - <tile> - <ID>2</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>2</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tp2SideD</position> - <revenue> - <value>10</value> - <position>tp3CornerE</position> - </revenue> - </junction> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCurve1LeftB</position> - <revenue> - <value>10</value> - <position>tp3CornerB</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp2SideD</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp2SideD</position1> - <position2>tp4SideA</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve1LeftB</position1> - <position2>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCurve1LeftB</position1> - <position2>tp4SideC</position2> - </connection> - </connections> - </tile> - <tile> - <ID>3</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>3</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tp2CornerE</position> - <revenue> - <value>10</value> - <position>tp3CornerB</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tp2CornerE</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tp2CornerE</position1> - <position2>tp4SideE</position2> - </connection> - </connections> - </tile> - <tile> - <ID>4</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>4</name> - <junctions> - <junction> - <junType>jtWhistlestop</junType> - <position>tpCenter</position> - <revenue> - <value>10</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideD</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideA</position2> - </connection> - </connections> - </tile> - <tile> - <ID>5</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>5</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>tp4SideB</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideC</position2> - </connection> - </connections> - </tile> - <tile> - <ID>1005</ID> - <shape>tsHexagon</shape> - <level>tlYellow</level> - <name>5/1832</name> - <category> - <value>Lille</value> - <position>tp3SideC</position> - </category> - <junctions> - <junction> - <junType>jtCity</junType> - <position>tpCenter</position> - <revenue> - <value>30</value> - <position>tp3CornerA</position> - </revenue> - </junction> - </junctions> - <connections> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideF</position2> - </connection> - <connection> - <conType>ctNormal</conType> - <position1>tpCenter</position1> - <position2>tp4SideE</posi... [truncated message content] |
From: <ev...@us...> - 2010-09-22 21:38:25
|
Revision: 1431 http://rails.svn.sourceforge.net/rails/?rev=1431&view=rev Author: evos Date: 2010-09-22 21:38:18 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Added parametrized options. Added 1825 Unit 2/3 and R/1/2/3 map (except not yet created special tiles). Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/data/1825/Game.xml trunk/18xx/data/1825/Map.xml trunk/18xx/data/GamesList.xml trunk/18xx/rails/game/GameManager.java trunk/18xx/rails/game/GameOption.java trunk/18xx/rails/game/GamesInfo.java trunk/18xx/rails/game/MapHex.java trunk/18xx/rails/ui/swing/GameSetupWindow.java trunk/18xx/rails/ui/swing/hexmap/HexMap.java trunk/18xx/rails/util/Tag.java trunk/18xx/tiles/TileDictionary.18t Property Changed: ---------------- trunk/18xx/test/ Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/LocalisedText.properties 2010-09-22 21:38:18 UTC (rev 1431) @@ -303,6 +303,7 @@ HoldMoneyInEscrow=The price of {0} is paid to the Bank, which now holds {1} in escrow for {2} HOW_MANY_SHARES=How many shares? IMPORT=Import +Include=Include {0} INFO=Game Notes Info=Info Insert=Insert Modified: trunk/18xx/data/1825/Game.xml =================================================================== --- trunk/18xx/data/1825/Game.xml 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/data/1825/Game.xml 2010-09-22 21:38:18 UTC (rev 1431) @@ -12,6 +12,12 @@ - optionally, a default value (only affects a toggle; in a dropdown the first item is always the default). --> + <GameOption name="Include" parm="Unit1" type="toggle" default="yes"/> + <GameOption name="Include" parm="Unit2" type="toggle" default="no"/> + <GameOption name="Include" parm="Unit3" type="toggle" default="no"/> + <GameOption name="Include" parm="R1" type="toggle" default="no"/> + <GameOption name="Include" parm="R2" type="toggle" default="no"/> + <GameOption name="Include" parm="R3" type="toggle" default="no"/> <GameOption name="RouteAwareness" values="Highlight,Deactivate" default="Deactivate" /> <GameOption name="RevenueCalculation" values="Suggest,Deactivate" default="Deactivate" /> <GameOption name="SeparateSalesAtSamePrice" type="toggle" default="yes"/> Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/data/1825/Map.xml 2010-09-22 21:38:18 UTC (rev 1431) @@ -1,6 +1,96 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" 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"/--> + <Hex name="C7" tile="-1" cost="100" city="Pitlochry" open="1,2"/> + <Hex name="C9" tile="0" cost="100" open="3"/> + <Hex name="C11" tile="0" open="2"/> + <Hex name="D2" tile="0" cost="100"/> + <Hex name="D4" tile="0" cost="100"/> + <Hex name="D6" tile="0" cost="100"/> + <Hex name="D8" tile="0" cost="100"/> + <Hex name="D10" tile="-1" city="Montrose"/> + <Hex name="E1" tile="-5" orientation="5" cost="40" city="Oban"/> + <Hex name="E3" tile="0" cost="100"/> + <Hex name="E5" tile="0" cost="100"/> + <Hex name="E7" tile="-25005" orientation="1" city="Perth"/> + <Hex name="E9" tile="-10" cost="80" city="Dundee"/> + <!--Hex name="F2" tile="-25012" city="Helensburgh, Gourock"/--> + <Hex name="F4" tile="-1" cost="40" city="Dumbarton"/> + <Hex name="F6" tile="-1" city="Stirling"/> + <Hex name="F8" tile="-2" orientation="3" cost="120" city="Dumfermline, Kirkaldy"/> + <!--Hex name="F10" tile="-25013" city="Anstruther"/--> + <Hex name="G3" tile="-10" city="Greenock"/> + <Hex name="G5" tile="-25002" city="Glasgow"/> + <Hex name="G7" tile="-2" city="Coatbridge, Airdrie"/> + <Hex name="G9" tile="-20" city="Edinburgh, Leith"/> + <Hex name="G11" tile="0"/> + <Hex name="H4" tile="-2" city="Ayr, Kilmarnock"/> + <Hex name="H6" tile="-10" city="Motherwell"/> + <Hex name="H8" tile="0" cost="100"/> + <Hex name="H10" tile="0" cost="100"/> + <Hex name="H12" tile="0"/> + <Hex name="H14" tile="0"/> + <Hex name="I3" tile="0" cost="100"/> + <Hex name="I5" tile="0"/> + <Hex name="I7" tile="0" cost="100"/> + <Hex name="I9" tile="0" cost="100"/> + <Hex name="I11" tile="0" cost="100"/> + <Hex name="I13" tile="-2"/> + <Hex name="J2" tile="-10" city="Stranraer"/> + <Hex name="J4" tile="0" cost="100"/> + <Hex name="J6" tile="-10" city="Dumfries"/> + <Hex name="J8" tile="0"/> + <Hex name="J10" tile="-10" ciry="Carlisle"/> + <Hex name="J12" tile="0" cost="100"/> + <Hex name="J14" tile="-20" cost="40" city="Newcastle u/T, Sunderland"/> + <!--Hex name="K7" tile="-25014" orientation="2" city="Maryport"/--> + <Hex name="K9" tile="0" cost="100" open="0,5"/> + <Hex name="K11" tile="0" cost="100" open="0,5"/> + <Hex name="K13" tile="-1" city="Durham" open="0,5"/> + <Hex name="K15" tile="-2" city="Stockton, Middlesbro" open="0,5"/> + </IfOption> + <IfOption name="Include" parm="Unit2" value="yes"> + <Hex name="L8" tile="0" open="2,3"/> + <Hex name="L10" tile="0" open="2,3"/> + <Hex name="L12" tile="0" cost="100" open="2,3"/> + <Hex name="L14" tile="-10" city="Darlington" open="2,3"/> + <Hex name="L16" tile="0" open="2"/> + <Hex name="L18" tile="-1" city="Scarborough"/> + <!--Hex name="M9" tile="-25008" city="Barrow"/--> + <Hex name="M11" tile="0" cost="100"/> + <Hex name="M13" tile="0" cost="100"/> + <Hex name="M15" tile="-2" city="Harrogate, York"/> + <Hex name="M17" tile="0"/> + <Hex name="M19" tile="0"/> + <Hex name="N10" tile="-10" city="Preston"/> + <Hex name="N12" tile="-2" city="Burnley, Halifax"/> + <Hex name="N14" tile="-20" city="Bradford, Leeds"/> + <Hex name="N16" tile="0"/> + <Hex name="N18" tile="-10" cost="40" city="Hull"/> + <!--Hex name="O9" tile="-25009" cost="40" city="Liverpool"/--> + <Hex name="O11" tile="-25002" city="Manchester"/> + <Hex name="O13" tile="0" cost="100"/> + <!--Hex name="O15" tile="-25010" city="Barnsley, Doncaster"/--> + <Hex name="O17" tile="0" cost="40"/> + <Hex name="O19" tile="0"/> + <Hex name="P8" tile="-41" orientation="4"/> + <Hex name="P10" tile="0" cost="40"/> + <Hex name="P12" tile="0" cost="100"/> + <Hex name="P14" tile="0" cost="100"/> + <Hex name="P16" tile="-20" city="Sheffield, Rotherham"/> + <Hex name="P18" tile="-1" city="Lincoln"/> + <Hex name="P20" tile="0"/> + <Hex name="Q9" tile="0" open="0,5"/> + <Hex name="Q11" tile="-25004" city="Wolverton"/> + <Hex name="Q13" tile="-2" city="Newcastle u/L, Hanley" open="0,5"/> + <Hex name="Q15" tile="-10" city="Derby" open="0,5"/> + <Hex name="Q17" tile="-10" city="Nottingham" open="0,5"/> + <Hex name="Q19" tile="0" open="0,5"/> + </IfOption> + <IfOption name="Include" parm="Unit1" value="yes"> <Hex name="R8" tile="0" open="0,1,2,3"/> - <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" open="2,3"/> + <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" open="2"/> <Hex name="R12" tile="-20" orientation="1" city="Wolverhampton, Walsall" open="2,3"/> <Hex name="R14" tile="0" open="2,3"/> <Hex name="R16" tile="-10" city="Leicester" open="2,3"/> @@ -70,5 +160,39 @@ <Hex name="Y13" tile="-25007" city="Bournemouth"/> <Hex name="Y17" tile="-7" orientation="4" /> <Hex name="Y19" tile="-7" orientation="4" /> - + <IfOption name="Include" parm="R1" value="yes"> + <Hex name="P4" tile="-5" city="Holyhead"/> + <Hex name="P6" tile="0" cost="40"/> + <Hex name="Q5" tile="-1" city="Portmadoc"/> + <Hex name="Q7" tile="0" cost="100"/> + <Hex name="R6" tile="0"/> + <Hex name="S5" tile="-1" city="Aberystwyth"/> + <Hex name="S7" tile="0" cost="100"/> + <Hex name="T2" tile="-10" city="Fishguard"/> + <Hex name="T4" tile="0"/> + <Hex name="T6" tile="0" cost="100"/> + <!--Hex name="U1" tile="-25015" city="Milford Haven"/--> + <Hex name="U3" tile="0"/> + <Hex name="U5" tile="0"/> + <Hex name="V8" tile="-25007" orientation="1" city="Swansea"/> + </IfOption> + <IfOption name="Include" parm="R2" value="yes"> + <Hex name="X4" tile="-1" city="Barnstaple"/> + <Hex name="X6" tile="0" cost="100"/> + <Hex name="Y1" tile="0"/> + <Hex name="Y3" tile="0"/> + <Hex name="Y5" tile="0" cost="100"/> + <Hex name="Y7" tile="-10" city="Exeter"/> + <Hex name="Z0" tile="0"/> + <Hex name="Z2" tile="-1" city="Fowey"/> + <Hex name="Z4" tile="-20" city="Devenport, Plymouth"/> + <Hex name="Z6" tile="-1" city="Torquay"/> + <!--Hex name="AA-1" tile="-1" city="Penzance"/> + <Hex name="AA1" tile="-10" city="Falmouth"/--> + </IfOption> + <IfOption name="Include" parm="R3" value="yes"> + <!--Hex name="Q23" tile="-25014" orientation="1" city="Melton Constable"/--> + <Hex name="Q25" tile="0"/> + </IfOption> + </IfOption> </Map> Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/data/GamesList.xml 2010-09-22 21:38:18 UTC (rev 1431) @@ -227,6 +227,12 @@ - Not implemented: receivership </Description> <Players minimum="3" maximum="5" /> + <Option name="Include" parm="Unit1" type="toggle" default="yes"/> + <Option name="Include" parm="Unit2" type="toggle" default="no"/> + <Option name="Include" parm="Unit3" type="toggle" default="no"/> + <Option name="Include" parm="R1" type="toggle" default="no"/> + <Option name="Include" parm="R2" type="toggle" default="no"/> + <Option name="Include" parm="R3" type="toggle" default="no"/> <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> <Option name="UnlimitedTiles" type="toggle" default="no"/> Modified: trunk/18xx/rails/game/GameManager.java =================================================================== --- trunk/18xx/rails/game/GameManager.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/game/GameManager.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -233,21 +233,28 @@ GameOption option; String optionName, optionType, optionValues, optionDefault; String optionNameParameters; + String[] optionParameters; List<Tag> optionTags = tag.getChildren("GameOption"); if (optionTags != null) { for (Tag optionTag : optionTags) { optionName = optionTag.getAttributeAsString("name"); if (optionName == null) throw new ConfigurationException("GameOption without name"); + optionParameters = null; + optionNameParameters = + optionTag.getAttributeAsString("parm"); + if (optionNameParameters != null) { + optionParameters = optionNameParameters.split(","); + } + optionName = GameOption.constructParametrisedName ( + optionName, optionParameters); + if (gameOptions.containsKey(optionName)) continue; // Include missing option - option = new GameOption(optionName); + option = new GameOption(optionName, optionParameters); availableGameOptions.add(option); - optionNameParameters = optionTag.getAttributeAsString("parm"); - if (optionNameParameters != null) { - option.setParameters(optionNameParameters.split(",")); - } + optionType = optionTag.getAttributeAsString("type"); if (optionType != null) option.setType(optionType); optionValues = optionTag.getAttributeAsString("values"); Modified: trunk/18xx/rails/game/GameOption.java =================================================================== --- trunk/18xx/rails/game/GameOption.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/game/GameOption.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -8,6 +8,7 @@ public class GameOption { private String name; + private String parametrisedName; private boolean isBoolean = false; private String type; private String defaultValue = null; @@ -22,14 +23,16 @@ // A default option that will always be set public static final String NUMBER_OF_PLAYERS = "NumberOfPlayers"; - + // Some other common game options - public static final String VARIANT = "Variant"; - + public static final String VARIANT = "Variant"; - public GameOption(String name) { - this.name = name; - optionsMap.put(name, this); + + public GameOption(String name, String[] parameters) { + this.name = name; + if (parameters != null) parm = parameters.clone(); + parametrisedName = constructParametrisedName (name, parameters); + optionsMap.put(parametrisedName, this); } public void setType(String type) { @@ -43,7 +46,7 @@ } public String getName() { - return name; + return parametrisedName; } public String getLocalisedName() { @@ -58,14 +61,12 @@ return isBoolean; } + /* public void setParameters(String[] parameters) { parm = parameters.clone(); } + */ - public String[] getParameters() { - return parm; - } - public void setAllowedValues(List<String> values) { allowedValues = values; } @@ -107,7 +108,18 @@ /** Get GameOption Value as Boolean Value */ public static boolean convertValueToBoolean(String value) { - return value != null + return value != null && OPTION_VALUE_YES.equalsIgnoreCase(value); } + + public static String constructParametrisedName (String optionName, + String[] optionNameParameters) { + String parametrisedName = optionName; + if (optionNameParameters != null) { + for (String parameter : optionNameParameters) { + parametrisedName += "_" + parameter; + } + } + return parametrisedName; + } } Modified: trunk/18xx/rails/game/GamesInfo.java =================================================================== --- trunk/18xx/rails/game/GamesInfo.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/game/GamesInfo.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -129,7 +129,6 @@ // Get the options List<Tag> optionTagList = gameTag.getChildren(OPTION_TAG); List<GameOption> gameOptions = new ArrayList<GameOption>(); - options.put(gameName, gameOptions); if (optionTagList != null) { for (Tag optionTag : optionTagList) { @@ -141,14 +140,16 @@ throw new ConfigurationException("Option name missing in " + GAMES_XML); } - GameOption option = new GameOption(optionName); - gameOptions.add(option); + // Option name parameters (optional) + String[] optionParameters = null; String optionNameParameters = - optionTag.getAttributeAsString("parm"); - if (optionNameParameters != null) { - option.setParameters(optionNameParameters.split(",")); - } + optionTag.getAttributeAsString("parm"); + if (optionNameParameters != null) { + optionParameters = optionNameParameters.split(","); + } + GameOption option = new GameOption(optionName, optionParameters); + gameOptions.add(option); // Option type (optional). // "toggle" means this is a boolean option, @@ -173,6 +174,7 @@ } } } + options.put(gameName, gameOptions); } Modified: trunk/18xx/rails/game/MapHex.java =================================================================== --- trunk/18xx/rails/game/MapHex.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/game/MapHex.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -114,7 +114,7 @@ /** Any open sides against which track may be laid even at board edges (1825) */ protected boolean[] openHexSides; - + protected MapManager mapManager = null; protected static Logger log = @@ -128,16 +128,22 @@ * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { - Pattern namePattern = Pattern.compile("(\\D)(\\d+)"); + Pattern namePattern = Pattern.compile("(\\D+?)(-?\\d+)"); infoText = name = tag.getAttributeAsString("name"); Matcher m = namePattern.matcher(name); if (!m.matches()) { throw new ConfigurationException("Invalid name format: " + name); } - letter = m.group(1).charAt(0); + String letters = m.group(1); + if (letters.length() == 1) { + letter = letters.charAt(0); + } else { // for row 'AA' in 1825U1 + letter = 26 + letters.charAt(1); + } try { number = Integer.parseInt(m.group(2)); + if (number > 90) number -= 100; // For 1825U1 column 99 (= -1) } catch (NumberFormatException e) { // Cannot occur! } @@ -266,7 +272,7 @@ return true; } - + public boolean isOpenSide (int side) { return openHexSides != null && openHexSides[side%6]; } Modified: trunk/18xx/rails/ui/swing/GameSetupWindow.java =================================================================== --- trunk/18xx/rails/ui/swing/GameSetupWindow.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/ui/swing/GameSetupWindow.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -41,7 +41,7 @@ Game game; private ConfigWindow configWindow; - + // Used by the player selection combo box. static final int NONE_PLAYER = 0; static final int HUMAN_PLAYER = 1; @@ -219,13 +219,13 @@ setVisible(false); killConfigWindow(); } - + private void killConfigWindow() { if (configWindow == null) return; configWindow.dispose(); configWindow = null; } - + public void actionPerformed(ActionEvent arg0) { if (arg0.getSource().equals(newButton)) { startNewGame(); @@ -297,14 +297,14 @@ playerNameFields[Integer.parseInt(boxName[1])].setEnabled(false); break; } - } + } } else if (arg0.getSource().equals(randomizeButton)) { // randomize the order of the players - if (playerNameFields.length > 0) { + if (playerNameFields.length > 0) { List<String> playerList = new ArrayList<String>(); for (int i = 0; i < playerNameFields.length; i++) { if (playerNameFields[i] != null - && playerNameFields[i].getText().length() > 0) { + && playerNameFields[i].getText().length() > 0) { playerList.add(playerNameFields[i].getText()); playerNameFields[i].setText(""); } @@ -312,7 +312,7 @@ Collections.shuffle(playerList); for (int i = 0; i < playerList.size(); i++) { playerNameFields[i].setText(playerList.get(i)); - + } } } Modified: trunk/18xx/rails/ui/swing/hexmap/HexMap.java =================================================================== --- trunk/18xx/rails/ui/swing/hexmap/HexMap.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/ui/swing/hexmap/HexMap.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -13,10 +13,9 @@ import rails.game.*; import rails.game.action.*; -import rails.ui.swing.GameUIManager; -import rails.ui.swing.ORUIManager; -import rails.ui.swing.Scale; -import rails.util.*; +import rails.ui.swing.*; +import rails.util.Config; +import rails.util.Util; /** * Base class that stores common info for HexMap independant of Hex @@ -64,10 +63,10 @@ protected Map<MapHex, List<LayToken>> allowedTokensPerHex = null; protected boolean bonusTokenLayingEnabled = false; - + /** list of generalpath elements to indicate train runs */ protected List<GeneralPath> trainPaths; - + private static Color colour1, colour2, colour3, colour4; protected int strokeWidth = 5; protected int strokeCap = BasicStroke.CAP_ROUND; @@ -83,7 +82,7 @@ protected double tileYOffset; protected double coordinateXMargin; protected double coordinateYMargin; - + public static void setRouteColours () { try { colour1 = Util.parseColour(Config.get("route.colour.1", null)); @@ -114,12 +113,12 @@ maxCol = mapManager.getMaxCol(); log.debug("HexMap init: minX="+ minX + ",minY=" + minY + ",maxX=" +maxX + ",maxY=" + maxY); log.debug("HexMap init: minCol="+ minCol + ",minRow=" + minRow + ",maxCol=" +maxCol + ",maxRow=" + maxRow); - + setScale(); setupHexes(); initializeSettings(); - + setRouteColours(); } @@ -143,22 +142,22 @@ } } - - + + protected void setupHexesGUI() { hexes = new ArrayList<GUIHex>(); hexArray = mapManager.getHexes(); MapHex mh; - + h = new GUIHex[hexArray.length][hexArray[0].length]; for (int i = minX; i < hexArray.length; i++) { for (int j = minY; j < hexArray[0].length; j++) { mh = hexArray[i][j]; - if (mh != null) { - GUIHex hex = new GUIHex(this, calcXCoordinates(mh.getColumn(), tileXOffset), + if (mh != null) { + GUIHex hex = new GUIHex(this, calcXCoordinates(mh.getColumn(), tileXOffset), calcYCoordinates(mh.getRow(), tileYOffset), scale, i-minX+1, j-minY+1); hex.setHexModel(mh); @@ -171,7 +170,7 @@ } setSize(); } - + protected void scaleHexesGUI () { hexArray = mapManager.getHexes(); GUIHex hex; @@ -189,19 +188,33 @@ } protected void drawLabel(Graphics2D g2, int index, int xCoordinate, int yCoordinate, boolean letter) { - String label = letter - ? String.valueOf((char)('@'+index)) - : String.valueOf(index); + String label = letter ? getLetterLabel (index) : getNumberLabel (index); xCoordinate -= 4.0*label.length(); yCoordinate += 4.0; g2.drawString(label, xCoordinate, yCoordinate); - + // log.debug("Draw Label " + label + " for " + index + " at x = " + xCoordinate + ", y = " + yCoordinate); } + private String getLetterLabel (int index) { + if (index > 26) { + return "A" + String.valueOf((char)('@'+(index-26))); // For 1825U1 row "AA" + } else { + return String.valueOf((char)('@'+index)); + } + } + + private String getNumberLabel (int index) { + if (index < 0) { + return String.valueOf(100 + index); // For 1825U1 column "99" + } else { + return String.valueOf(index); + } + } + @Override public void paint(Graphics g) { @@ -214,7 +227,7 @@ int yTop = (int)calcYCoordinates(minRow, - coordinateYMargin); int yBottom = (int)calcYCoordinates(maxRow, coordinateYMargin); - + for (int iCol = minCol; iCol <= maxCol; iCol++) { int xCoordinate = (int)(calcXCoordinates(iCol, 0)); drawLabel(g2, iCol, xCoordinate, yTop, lettersGoHorizontal); @@ -230,7 +243,7 @@ } - + public void setupHexes() { setupHexesGUI(); setupBars(); @@ -293,10 +306,10 @@ hex.paintBars(g); } } - + // paint train paths Graphics2D g2 = (Graphics2D) g; - Stroke trainStroke = + Stroke trainStroke = new BasicStroke((int)(strokeWidth * zoomFactor), strokeCap, strokeJoin); g2.setStroke(trainStroke); @@ -506,7 +519,7 @@ public void setTrainPaths(List<GeneralPath> trainPaths) { this.trainPaths = trainPaths; } - + /** * Off-board tiles must be able to retrieve the current phase. * Modified: trunk/18xx/rails/util/Tag.java =================================================================== --- trunk/18xx/rails/util/Tag.java 2010-09-20 21:32:32 UTC (rev 1430) +++ trunk/18xx/rails/util/Tag.java 2010-09-22 21:38:18 UTC (rev 1431) @@ -287,6 +287,11 @@ "IfOption has no optionName attribute"); name = nameAttr.getNodeValue(); + Node parmAttr = nnp.getNamedItem("parm"); + if (parmAttr != null) { + value = parmAttr.getNodeValue(); + name = GameOption.constructParametrisedName(name, value.split(",")); + } Node valueAttr = nnp.getNamedItem("value"); if (valueAttr == null) throw new ConfigurationException( @@ -301,7 +306,19 @@ } String optionValue = gameOptions.get(name); + + // For backwards compatibility: search for an extended name if (optionValue == null) { + for (String optName : gameOptions.keySet()) { + if (optName.startsWith(name)) { + optionValue = gameOptions.get(optName); + log.warn("Option name "+name+" replaced by "+optName); + break; + } + } + } + + if (optionValue == null) { // Take the default value GameOption go = GameOption.getByName(name); optionValue = go != null ? go.getDefaultValue() : ""; @@ -309,6 +326,7 @@ + " but no assigned value found, assumed "+optionValue); } + if (optionValue.equalsIgnoreCase(value)) { parseSubTags(childElement); } Property changes on: trunk/18xx/test ___________________________________________________________________ Added: svn:ignore + Test.java Modified: trunk/18xx/tiles/TileDictionary.18t =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-20 21:32:38
|
Revision: 1430 http://rails.svn.sourceforge.net/rails/?rev=1430&view=rev Author: evos Date: 2010-09-20 21:32:32 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Removed tile -10000 Modified Paths: -------------- trunk/18xx/data/1825/TileSet.xml trunk/18xx/data/1825/Tiles.xml Modified: trunk/18xx/data/1825/TileSet.xml =================================================================== --- trunk/18xx/data/1825/TileSet.xml 2010-09-20 21:31:16 UTC (rev 1429) +++ trunk/18xx/data/1825/TileSet.xml 2010-09-20 21:32:32 UTC (rev 1430) @@ -3,7 +3,7 @@ <Tile id="0"><!-- Empty space --> <Upgrade id="7,8,9"/> </Tile> - <Tile id="-10000"/><!-- Empty space, not upgradeable (for borders between units and kits) --> + <!--Tile id="-10000"/--><!-- Empty space, not upgradeable (for borders between units and kits) --> <Tile id="-1"><!-- 1 town --> <Upgrade id="3,4"/> </Tile> Modified: trunk/18xx/data/1825/Tiles.xml =================================================================== --- trunk/18xx/data/1825/Tiles.xml 2010-09-20 21:31:16 UTC (rev 1429) +++ trunk/18xx/data/1825/Tiles.xml 2010-09-20 21:32:32 UTC (rev 1430) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Tiles> <Tile colour="white" id="0" name="empty"/> - <Tile colour="white" id="-10000" name="empty"/> + <!--Tile colour="white" id="-10000" name="empty"/--> <Tile colour="white" id="-1" name="1 village"> <Station id="city1" position="002" type="Town"/> </Tile><Tile colour="white" id="-2" name="2 villages"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-20 21:31:23
|
Revision: 1429 http://rails.svn.sourceforge.net/rails/?rev=1429&view=rev Author: evos Date: 2010-09-20 21:31:16 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Allow hex sides to be "open", i.e. track can be laid against such sides, even if at a board edge. This is required for 1825. Modified Paths: -------------- trunk/18xx/data/1825/Map.xml trunk/18xx/rails/game/MapHex.java trunk/18xx/rails/ui/swing/hexmap/GUITile.java Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-19 19:30:35 UTC (rev 1428) +++ trunk/18xx/data/1825/Map.xml 2010-09-20 21:31:16 UTC (rev 1429) @@ -1,43 +1,15 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="R"> - <!-- The tiles numbered -10000 do not exist on the board. - These are there only to enable edge tile placement, - which is allowed where board extensions exist. - The tiles are not upgradable, i.e. no yellow tiles can be laid on these hexes --> - <!-- Edge tiles in case Unit 2 is not used --> - <Hex name="Q9" tile="-10000"/> - <Hex name="Q11" tile="-10000"/> - <Hex name="Q13" tile="-10000"/> - <Hex name="Q15" tile="-10000"/> - <Hex name="Q17" tile="-10000"/> - <Hex name="Q19" tile="-10000"/> - <!-- End of U2 edge tiles --> - <!-- Edge tiles in case kit R3 (North Norfolk) is not used --> - <Hex name="Q23" tile="-10000"/> - <Hex name="Q25" tile="-10000"/> - <!-- End of R3 edge tiles --> - <!-- Edge tiles in case kit R1 (Wales) is not used --> - <Hex name="Q7" tile="-10000"/> - <Hex name="R6" tile="-10000"/> - <Hex name="S7" tile="-10000"/> - <Hex name="T6" tile="-10000"/> - <Hex name="U7" tile="-10000"/> - <Hex name="V6" tile="-10000"/> - <!-- End of R1 edge tiles --> - <!-- Edge tiles in case kit R2 (S/W England) is not used --> - <Hex name="X6" tile="-10000"/> - <Hex name="Y7" tile="-10000"/> - <!-- End of R2 edge tiles --> - <Hex name="R8" tile="0"/> - <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" /> - <Hex name="R12" tile="-20" orientation="1" city="Wolverhampton, Walsall"/> - <Hex name="R14" tile="0"/> - <Hex name="R16" tile="-10" city="Leicester" /> - <Hex name="R18" tile="0"/> - <Hex name="R20" tile="-1" city="Peterborough" orientation="3" /> - <Hex name="R22" tile="0"/> - <Hex name="R24" tile="-10" city="Norwich" orientation="4" /> - <Hex name="R26" tile="-1" city="Great Yarmouth" orientation="1" /> - <Hex name="S9" tile="0"/> + <Hex name="R8" tile="0" open="0,1,2,3"/> + <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" open="2,3"/> + <Hex name="R12" tile="-20" orientation="1" city="Wolverhampton, Walsall" open="2,3"/> + <Hex name="R14" tile="0" open="2,3"/> + <Hex name="R16" tile="-10" city="Leicester" open="2,3"/> + <Hex name="R18" tile="0" open="2,3"/> + <Hex name="R20" tile="-1" city="Peterborough" orientation="3" open="2"/> + <Hex name="R22" tile="0" open="3"/> + <Hex name="R24" tile="-10" city="Norwich" orientation="4" open="2,3"/> + <Hex name="R26" tile="-1" city="Great Yarmouth" orientation="1" open="2"/> + <Hex name="S9" tile="0" open="1"/> <Hex name="S11" tile="0"/> <Hex name="S13" tile="-25002" city="Birmingham" /> <Hex name="S15" tile="-1" city="Northampton" orientation="2" /> @@ -46,7 +18,7 @@ <Hex name="S21" tile="0"/> <Hex name="S23" tile="0"/> <Hex name="S25" tile="0"/> - <Hex name="T8" tile="0" cost="100"></Hex> + <Hex name="T8" tile="0" cost="100" open="0,1,2"></Hex> <Hex name="T10" tile="0"/> <Hex name="T12" tile="0"/> <Hex name="T14" tile="0"/> @@ -55,7 +27,7 @@ <Hex name="T20" tile="-1" city="Cambridge" /> <Hex name="T22" tile="0"/> <Hex name="T24" tile="-1" city="Ipswich" orientation="1" /> - <Hex name="U9" tile="0"/> + <Hex name="U9" tile="0" open="1"/> <Hex name="U11" tile="-1" cost="40" city="Gloucester" orientation="1" ></Hex> <Hex name="U13" tile="0"/> @@ -65,7 +37,7 @@ <Hex name="U21" tile="0"/> <Hex name="U23" tile="-1" city="Colchester" /> <Hex name="U25" tile="-104" orientation="2" city="Harwich"/> - <Hex name="V8" tile="-20" city="Cardiff, Newport" /> + <Hex name="V8" tile="-20" city="Cardiff, Newport" open="1,2"/> <Hex name="V10" tile="-25003" city="Bristol"/> <Hex name="V12" tile="0"/> <Hex name="V14" tile="-25005" city="Swindon"/> @@ -83,7 +55,7 @@ <Hex name="W21" tile="0"/> <Hex name="W23" tile="-10" city="Ashford" orientation="5" /> <Hex name="W25" tile="-5" orientation="2" city="Dover"/> - <Hex name="X8" tile="0"/> + <Hex name="X8" tile="0" open="0,1"/> <Hex name="X10" tile="0"/> <Hex name="X12" tile="0"/> <Hex name="X14" tile="-10" city="Southampton" orientation="5" /> @@ -93,7 +65,7 @@ <Hex name="X20" tile="-10" city="Brighton" orientation="5" /> <Hex name="X22" tile="-1" city="Hastings" orientation="2" /> <Hex name="X24" tile="0"/> - <Hex name="Y9" tile="0"/> + <Hex name="Y9" tile="0" open="1"/> <Hex name="Y11" tile="-1" city="Weymouth" orientation="3" /> <Hex name="Y13" tile="-25007" city="Bournemouth"/> <Hex name="Y17" tile="-7" orientation="4" /> Modified: trunk/18xx/rails/game/MapHex.java =================================================================== --- trunk/18xx/rails/game/MapHex.java 2010-09-19 19:30:35 UTC (rev 1428) +++ trunk/18xx/rails/game/MapHex.java 2010-09-20 21:31:16 UTC (rev 1429) @@ -112,6 +112,9 @@ /** Storage of revenueBonus that are bound to the hex */ protected List<RevenueBonusTemplate> revenueBonuses = null; + /** Any open sides against which track may be laid even at board edges (1825) */ + protected boolean[] openHexSides; + protected MapManager mapManager = null; protected static Logger log = @@ -207,6 +210,12 @@ revenueBonuses.add(bonus); } } + + // Open sides (as in 1825, track may be laid against some board edges) + for (int side : tag.getAttributeAsIntegerArray("open", new int[0])) { + if (openHexSides == null) openHexSides = new boolean[6]; + openHexSides[side%6] = true; + } } public void finishConfiguration (GameManagerI gameManager) { @@ -258,6 +267,10 @@ return true; } + public boolean isOpenSide (int side) { + return openHexSides != null && openHexSides[side%6]; + } + public int getTileOrientation() { return mapManager.getTileOrientation(); } @@ -1012,15 +1025,15 @@ /** * @return Returns false if no base tokens may yet be laid on this hex and station. - * + * * NOTE: this method currently only checks for prohibitions caused * by the presence of unlaid home base tokens. * It does NOT (yet) check for free space. * * * There are the following cases to check for each company located there - * - * A) City is decided or there is only one city + * + * A) City is decided or there is only one city * => check if the city has a free slot or not * (examples: NYNH in 1830 for a two city tile, NYC for a one city tile) * B) City is not decided (example: Erie in 1830) @@ -1029,14 +1042,14 @@ * - (false): no city of the hex has remaining slots available * C) Or the company does not block its home city at all (example:Pr in 1835) * then isBlockedForTokenLays attribute is used - * + * * NOTE: It now deals with more than one company with a home base on the - * same hex. - * + * same hex. + * * Previously there was only the variable isBlockedForTokenLays * which is set to yes to block the whole hex for the token lays * until the (home) company laid their token - * + * */ public boolean isBlockedForTokenLays(PublicCompanyI company, int cityNumber) { @@ -1071,7 +1084,7 @@ anyBlockCompanies ++; // companies which are located somewhere else } } - log.debug("IsBlockedForTokenLays: allBlockCompanies = " + allBlockCompanies + + log.debug("IsBlockedForTokenLays: allBlockCompanies = " + allBlockCompanies + ", anyBlockCompanies = " + anyBlockCompanies + " , cityBlockCompanies = " + cityBlockCompanies); // check if there are sufficient individual city slots if (allBlockCompanies + cityBlockCompanies + 1 > cityToLay.getTokenSlotsLeft()) { Modified: trunk/18xx/rails/ui/swing/hexmap/GUITile.java =================================================================== --- trunk/18xx/rails/ui/swing/hexmap/GUITile.java 2010-09-19 19:30:35 UTC (rev 1428) +++ trunk/18xx/rails/ui/swing/hexmap/GUITile.java 2010-09-20 21:31:16 UTC (rev 1429) @@ -80,7 +80,7 @@ MapHex nHex; boolean connected; - + int fixedRotation = getTile().getFixedOrientation(); if (fixedRotation >= 0) { setRotation (fixedRotation); @@ -102,7 +102,7 @@ if (tile.hasTracks(tempTileSide)) { // If the tile has tracks against that side, but there is no // neighbour, forbid this rotation. - if (!hex.hasNeighbour(j)) { + if (!hex.hasNeighbour(j) && !hex.isOpenSide(j)) { continue rot; } // If the tile must be connected (i.e. not laid on the @@ -111,7 +111,7 @@ // a side of this tile that also has a track. if (mustConnect) { nHex = hex.getNeighbor(j); - if (nHex.getCurrentTile().hasTracks( + if (nHex != null && nHex.getCurrentTile().hasTracks( j + 3 - nHex.getCurrentTileRotation())) { connected = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-19 19:30:41
|
Revision: 1428 http://rails.svn.sourceforge.net/rails/?rev=1428&view=rev Author: evos Date: 2010-09-19 19:30:35 +0000 (Sun, 19 Sep 2010) Log Message: ----------- Bugfix: company closure after withholding crashed the game. Modified Paths: -------------- trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/StockMarket.java Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2010-09-18 15:20:17 UTC (rev 1427) +++ trunk/18xx/rails/game/OperatingRound.java 2010-09-19 19:30:35 UTC (rev 1428) @@ -984,7 +984,7 @@ Bank.format(part), shares, operatingCompany.get().getShareUnit())); - new CashMove(bank, recipient, part); + pay (bank, recipient, part); } // Move the token @@ -1031,9 +1031,26 @@ * @param The revenue amount. */ public void withhold(int amount) { - if (amount > 0) new CashMove(bank, operatingCompany.get(), amount); + + PublicCompanyI company = operatingCompany.get(); + + // Payout revenue to company + pay (bank, company, amount); + // Move the token - operatingCompany.get().withhold(amount); + company.withhold(amount); + + // Check if company has entered a closing area + StockSpaceI newSpace = company.getCurrentSpace(); + if (newSpace.closesCompany() && company.canClose()) { + company.setClosed(); + ReportBuffer.add(LocalText.getText("CompanyClosesAt", + company.getName(), + newSpace.getName())); + finishTurn(); + return; + } + } /** Split a dividend. TODO Optional rounding down the payout @@ -1048,7 +1065,7 @@ int numberOfShares = operatingCompany.get().getNumberOfShares(); int withheld = (amount / (2 * numberOfShares)) * numberOfShares; - new CashMove(bank, operatingCompany.get(), withheld); + pay (bank, operatingCompany.get(), withheld); ReportBuffer.add(operatingCompany.get().getName() + " receives " + Bank.format(withheld)); // Payout the remainder Modified: trunk/18xx/rails/game/StockMarket.java =================================================================== --- trunk/18xx/rails/game/StockMarket.java 2010-09-18 15:20:17 UTC (rev 1427) +++ trunk/18xx/rails/game/StockMarket.java 2010-09-19 19:30:35 UTC (rev 1428) @@ -248,17 +248,6 @@ if (newrow > row) { newsquare = getStockSpace(newrow, col); } - /* - if (newsquare != oldsquare && newsquare.closesCompany()) { - company.setClosed(); - oldsquare.removeToken(company); - ReportBuffer.add(LocalText.getText("CompanyClosesAt", - company.getName(), - newsquare.getName())); - } else { - prepareMove(company, oldsquare, newsquare); - } - */ if (newsquare != oldsquare) { prepareMove(company, oldsquare, newsquare); } @@ -288,16 +277,7 @@ else { newsquare = oldsquare; } - if (newsquare.closesCompany()) { - if (!company.canClose()) return; // E.g. 1856 CGR - company.setClosed(); - oldsquare.removeToken(company); - ReportBuffer.add(LocalText.getText("CompanyClosesAt", - company.getName(), - newsquare.getName())); - } else { - prepareMove(company, oldsquare, newsquare); - } + prepareMove(company, oldsquare, newsquare); } protected void prepareMove(PublicCompanyI company, StockSpaceI from, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-18 15:20:24
|
Revision: 1427 http://rails.svn.sourceforge.net/rails/?rev=1427&view=rev Author: evos Date: 2010-09-18 15:20:17 +0000 (Sat, 18 Sep 2010) Log Message: ----------- Log player net worth gain/loss per OR in the Report window. Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/rails/game/OperatingRound.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-09-17 22:24:13 UTC (rev 1426) +++ trunk/18xx/LocalisedText.properties 2010-09-18 15:20:17 UTC (rev 1427) @@ -437,6 +437,7 @@ OPTIONS=Options OR=or ORWORTHINCR=OR +/- +ORWorthIncrease=Net worth gain/loss of {0} in OR {1} is {2} PAR=Par PASS=Pass PASSES={0} passes. Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2010-09-17 22:24:13 UTC (rev 1426) +++ trunk/18xx/rails/game/OperatingRound.java 2010-09-18 15:20:17 UTC (rev 1427) @@ -1530,13 +1530,20 @@ // priv.checkClosingIfExercised(true); //} + ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber)); + // Update the worth increase per player + int orWorthIncrease; for (Player player : gameManager.getPlayers()) { player.setLastORWorthIncrease(); + orWorthIncrease = player.getLastORWorthIncrease().intValue(); + ReportBuffer.add(LocalText.getText("ORWorthIncrease", + player.getName(), + thisOrNumber, + Bank.format(orWorthIncrease))); } // OR done. Inform GameManager. - ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber)); finishRound(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-17 22:24:19
|
Revision: 1426 http://rails.svn.sourceforge.net/rails/?rev=1426&view=rev Author: evos Date: 2010-09-17 22:24:13 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Added GameStatus row to display the increase of player worth in th elast complete OR Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/game/Player.java trunk/18xx/rails/ui/swing/GameStatus.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-09-17 21:44:24 UTC (rev 1425) +++ trunk/18xx/LocalisedText.properties 2010-09-17 22:24:13 UTC (rev 1426) @@ -436,6 +436,7 @@ OK=OK OPTIONS=Options OR=or +ORWORTHINCR=OR +/- PAR=Par PASS=Pass PASSES={0} passes. Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2010-09-17 21:44:24 UTC (rev 1425) +++ trunk/18xx/rails/game/OperatingRound.java 2010-09-17 22:24:13 UTC (rev 1426) @@ -10,10 +10,7 @@ import rails.game.move.CashMove; import rails.game.move.MapChange; import rails.game.special.*; -import rails.game.state.ArrayListState; -import rails.game.state.EnumState; -import rails.game.state.GenericState; -import rails.game.state.HashMapState; +import rails.game.state.*; import rails.util.LocalText; import rails.util.SequenceUtil; @@ -41,8 +38,8 @@ protected GenericState<PublicCompanyI> operatingCompany; // do not use a operatingCompany.getObject() as reference - // protected PublicCompanyI operatingCompany.getObject() = null; - + // protected PublicCompanyI operatingCompany.getObject() = null; + // Non-persistent lists (are recreated after each user action) protected List<SpecialPropertyI> currentSpecialProperties = null; @@ -114,6 +111,10 @@ ReportBuffer.add(LocalText.getText("START_OR", thisOrNumber)); + for (Player player : gameManager.getPlayers()) { + player.setWorthAtORStart(); + } + privatesPayOut(); if (operatingCompanies.size() > 0) { @@ -800,7 +801,7 @@ ReportBuffer.add(LocalText.getText("CompanyRevenue", action.getCompanyName(), Bank.format(action.getActualRevenue()))); - + int remainingAmount = checkForDeductions (action); if (remainingAmount < 0) { // A share selling round will be run to raise cash to pay debts @@ -1298,8 +1299,8 @@ * of the tile laying step. */ protected void getNormalTileLays() { - - // duplicate the phase colours + + // duplicate the phase colours Map<String, Integer> newTileColours = new HashMap<String, Integer>(getCurrentPhase().getTileColours()); for (String colour : newTileColours.keySet()) { int allowedNumber = operatingCompany.get().getNumberOfTileLays(colour); @@ -1307,7 +1308,7 @@ newTileColours.put(colour, new Integer(allowedNumber)); } // store to state - tileLaysPerColour.initFromMap(newTileColours); + tileLaysPerColour.initFromMap(newTileColours); } protected void setNormalTileLays() { @@ -1529,6 +1530,11 @@ // priv.checkClosingIfExercised(true); //} + // Update the worth increase per player + for (Player player : gameManager.getPlayers()) { + player.setLastORWorthIncrease(); + } + // OR done. Inform GameManager. ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber)); finishRound(); Modified: trunk/18xx/rails/game/Player.java =================================================================== --- trunk/18xx/rails/game/Player.java 2010-09-17 21:44:24 UTC (rev 1425) +++ trunk/18xx/rails/game/Player.java 2010-09-17 22:24:13 UTC (rev 1426) @@ -3,6 +3,7 @@ import rails.game.model.*; import rails.game.state.BooleanState; +import rails.game.state.IntegerState; /** * Player class holds all player-specific data @@ -26,6 +27,8 @@ private CalculatedMoneyModel freeCash; private CalculatedMoneyModel worth; private BooleanState bankrupt; + private MoneyModel lastORWorthIncrease; + private IntegerState worthAtORStart; private boolean hasBoughtStockThisTurn = false; @@ -42,6 +45,9 @@ worth = new CalculatedMoneyModel(this, "getWorth"); wallet.addDependent(worth); bankrupt = new BooleanState (name+"_isBankrupt", false); + lastORWorthIncrease = new MoneyModel (name+"_lastORIncome"); + lastORWorthIncrease.setOption(MoneyModel.ALLOW_NEGATIVE); + worthAtORStart = new IntegerState (name+"_worthAtORStart"); } /** @@ -88,10 +94,10 @@ int worth; if (bankrupt.booleanValue()) { worth = 0; - } else { + } else { worth = wallet.getCash(); } - + for (PublicCertificateI cert : portfolio.getCertificates()) { worth += cert.getCompany().getGameEndPrice() * cert.getShares(); } @@ -105,6 +111,18 @@ return worth; } + public MoneyModel getLastORWorthIncrease () { + return lastORWorthIncrease; + } + + public void setWorthAtORStart () { + worthAtORStart.set(getWorth()); + } + + public void setLastORWorthIncrease () { + lastORWorthIncrease.set(getWorth() - worthAtORStart.intValue()); + } + public void updateWorth () { worth.update(); } Modified: trunk/18xx/rails/ui/swing/GameStatus.java =================================================================== --- trunk/18xx/rails/ui/swing/GameStatus.java 2010-09-17 21:44:24 UTC (rev 1425) +++ trunk/18xx/rails/ui/swing/GameStatus.java 2010-09-17 22:24:13 UTC (rev 1426) @@ -68,6 +68,8 @@ protected int playerPrivatesXOffset, playerPrivatesYOffset; protected Field playerWorth[]; protected int playerWorthXOffset, playerWorthYOffset; + protected Field playerORWorthIncrease[]; + protected int playerORWorthIncreaseXOffset, playerORWorthIncreaseYOffset; protected Field playerCertCount[]; protected int playerCertCountXOffset, playerCertCountYOffset; protected int certLimitXOffset, certLimitYOffset; @@ -173,6 +175,7 @@ playerCashButton = new ClickField[np]; playerPrivates = new Field[np]; playerWorth = new Field[np]; + playerORWorthIncrease = new Field[np]; playerCertCount = new Field[np]; upperPlayerCaption = new Caption[np]; lowerPlayerCaption = new Caption[np]; @@ -219,6 +222,8 @@ playerPrivatesYOffset = ++lastY; playerWorthXOffset = certPerPlayerXOffset; playerWorthYOffset = ++lastY; + playerORWorthIncreaseXOffset = certPerPlayerXOffset; + playerORWorthIncreaseYOffset = ++lastY; playerCertCountXOffset = certPerPlayerXOffset; playerCertCountYOffset = ++lastY; certLimitXOffset = certInPoolXOffset; @@ -455,6 +460,13 @@ addField(f, playerWorthXOffset + i, playerWorthYOffset, 1, 1, 0, true); } + addField(new Caption(LocalText.getText("ORWORTHINCR")), 0, + playerORWorthIncreaseYOffset, 1, 1, WIDE_RIGHT, true); + for (int i = 0; i < np; i++) { + f = playerORWorthIncrease[i] = new Field(players[i].getLastORWorthIncrease()); + addField(f, playerORWorthIncreaseXOffset + i, playerORWorthIncreaseYOffset, 1, 1, 0, true); + } + addField(new Caption("Certs"), 0, playerCertCountYOffset, 1, 1, WIDE_RIGHT + WIDE_TOP, true); for (int i = 0; i < np; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-17 21:44:30
|
Revision: 1425 http://rails.svn.sourceforge.net/rails/?rev=1425&view=rev Author: stefanfrey Date: 2010-09-17 21:44:24 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Fixed terminate modifier Modified Paths: -------------- trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java Modified: trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java 2010-09-17 21:24:13 UTC (rev 1424) +++ trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java 2010-09-17 21:44:24 UTC (rev 1425) @@ -43,8 +43,10 @@ } public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) { - // remove invalid runs - optimalRuns.removeAll(identifyInvalidRuns(optimalRuns)); + // set invalid runs to be empty + for (RevenueTrainRun run:identifyInvalidRuns(optimalRuns)) { + run.getRunVertices().clear(); + } } public String prettyPrint(RevenueAdapter adapter) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-17 21:24:20
|
Revision: 1424 http://rails.svn.sourceforge.net/rails/?rev=1424&view=rev Author: stefanfrey Date: 2010-09-17 21:24:13 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Added support for 1825 revenue calculation Modified Paths: -------------- trunk/18xx/rails/algorithms/NetworkTrain.java trunk/18xx/rails/algorithms/RevenueAdapter.java trunk/18xx/rails/algorithms/RevenueDynamicModifier.java trunk/18xx/rails/algorithms/RevenueManager.java trunk/18xx/rails/algorithms/RevenueTrainRun.java trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java trunk/18xx/rails/game/state/ArrayListState.java Added Paths: ----------- trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java Modified: trunk/18xx/rails/algorithms/NetworkTrain.java =================================================================== --- trunk/18xx/rails/algorithms/NetworkTrain.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/algorithms/NetworkTrain.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -19,7 +19,7 @@ private final TrainI railsTrain; - NetworkTrain(int majors, int minors, boolean ignoreMinors, + public NetworkTrain(int majors, int minors, boolean ignoreMinors, int multiplyMajors, int multiplyMinors, String trainName, TrainI train) { this.majors = majors; this.minors = minors; @@ -110,6 +110,10 @@ return ignoreMinors; } + public String getTrainName() { + return trainName; + } + public TrainI getRailsTrain() { return railsTrain; } Modified: trunk/18xx/rails/algorithms/RevenueAdapter.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueAdapter.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/algorithms/RevenueAdapter.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -75,7 +75,7 @@ private List<NetworkVertex> rcVertices; private List<NetworkEdge> rcEdges; private List<RevenueTrainRun> optimalRun; - private Set<RevenueDynamicModifier> dynamicModifiers; + private List<RevenueDynamicModifier> dynamicModifiers; // revenue listener to communicate results @@ -163,6 +163,10 @@ } } + public void addTrain(NetworkTrain train) { + trains.add(train); + } + public void removeTrain(NetworkTrain train) { trains.remove(train); } @@ -285,7 +289,7 @@ if (gameManager.getRevenueManager() != null) { dynamicModifiers = gameManager.getRevenueManager().callDynamicModifiers(this); } else { - dynamicModifiers = new HashSet<RevenueDynamicModifier>(); + dynamicModifiers = new ArrayList<RevenueDynamicModifier>(); } // define optimized graph @@ -573,6 +577,10 @@ public List<RevenueTrainRun> getOptimalRun() { if (optimalRun == null) { optimalRun = convertRcRun(rc.getOptimalRun()); + // allow dynamic modifiers to change the optimal run + for (RevenueDynamicModifier modifier:dynamicModifiers) { + modifier.adjustOptimalRun(optimalRun); + } } return optimalRun; } @@ -587,7 +595,7 @@ int dynamicEvaluation() { int value = 0; for (RevenueDynamicModifier modifier:dynamicModifiers) { - value += modifier.evaluationValue(this.getCurrentRun()); + value += modifier.evaluationValue(this.getCurrentRun(), false); } return value; } @@ -641,12 +649,15 @@ } if (includeDetails) { for (RevenueDynamicModifier modifier:dynamicModifiers) { - runPrettyPrint.append(modifier.prettyPrint(this)); + String modifierText = modifier.prettyPrint(this); + if (modifierText != null) { + runPrettyPrint.append(modifierText); + } } } else { int dynamicBonuses = 0; for (RevenueDynamicModifier modifier:dynamicModifiers) { - dynamicBonuses += modifier.evaluationValue(this.getOptimalRun()); + dynamicBonuses += modifier.evaluationValue(this.getOptimalRun(), true); } if (dynamicBonuses != 0) { runPrettyPrint.append("; " + Modified: trunk/18xx/rails/algorithms/RevenueDynamicModifier.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueDynamicModifier.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/algorithms/RevenueDynamicModifier.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -20,9 +20,12 @@ /** returns the value used for prediction */ public int predictionValue(); - /** returns the value used for evaluation (at the run supplied) */ - public int evaluationValue(List<RevenueTrainRun> runs); + /** returns the value used for evaluation (at the runs supplied) */ + public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns); + /** allows to adjust the run list of the optimal train run output */ + public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns); + /** returns the results as pretty prints */ public String prettyPrint(RevenueAdapter adapter); Modified: trunk/18xx/rails/algorithms/RevenueManager.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueManager.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/algorithms/RevenueManager.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -1,8 +1,8 @@ package rails.algorithms; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Set; import org.apache.log4j.Logger; @@ -10,7 +10,7 @@ import rails.game.ConfigurableComponentI; import rails.game.ConfigurationException; import rails.game.GameManagerI; -import rails.game.state.HashSetState; +import rails.game.state.ArrayListState; import rails.util.LocalText; import rails.util.Tag; @@ -30,15 +30,15 @@ Logger.getLogger(RevenueManager.class.getPackage().getName()); - private final HashSetState<NetworkGraphModifier> graphModifiers; - private final HashSetState<RevenueStaticModifier> staticModifiers; - private final HashSetState<RevenueDynamicModifier> dynamicModifiers; + private final ArrayListState<NetworkGraphModifier> graphModifiers; + private final ArrayListState<RevenueStaticModifier> staticModifiers; + private final ArrayListState<RevenueDynamicModifier> dynamicModifiers; private final HashSet<ConfigurableComponentI> configurableModifiers; public RevenueManager() { - graphModifiers = new HashSetState<NetworkGraphModifier>("NetworkGraphModifiers"); - staticModifiers = new HashSetState<RevenueStaticModifier>("RevenueStaticModifiers"); - dynamicModifiers = new HashSetState<RevenueDynamicModifier>("RevenueDynamicModifiers"); + graphModifiers = new ArrayListState<NetworkGraphModifier>("NetworkGraphModifiers"); + staticModifiers = new ArrayListState<RevenueStaticModifier>("RevenueStaticModifiers"); + dynamicModifiers = new ArrayListState<RevenueDynamicModifier>("RevenueDynamicModifiers"); configurableModifiers = new HashSet<ConfigurableComponentI>(); } @@ -145,20 +145,20 @@ } void callGraphModifiers(NetworkGraphBuilder graphBuilder) { - for (NetworkGraphModifier modifier:graphModifiers.viewSet()) { + for (NetworkGraphModifier modifier:graphModifiers.viewList()) { modifier.modifyGraph(graphBuilder); } } void callStaticModifiers(RevenueAdapter revenueAdapter) { - for (RevenueStaticModifier modifier:staticModifiers.viewSet()) { + for (RevenueStaticModifier modifier:staticModifiers.viewList()) { modifier.modifyCalculator(revenueAdapter); } } - Set<RevenueDynamicModifier> callDynamicModifiers(RevenueAdapter revenueAdapter) { - Set<RevenueDynamicModifier> activeModifiers = new HashSet<RevenueDynamicModifier>(); - for (RevenueDynamicModifier modifier:dynamicModifiers.viewSet()) { + List<RevenueDynamicModifier> callDynamicModifiers(RevenueAdapter revenueAdapter) { + List<RevenueDynamicModifier> activeModifiers = new ArrayList<RevenueDynamicModifier>(); + for (RevenueDynamicModifier modifier:dynamicModifiers.viewList()) { if (modifier.prepareModifier(revenueAdapter)) activeModifiers.add(modifier); } Modified: trunk/18xx/rails/algorithms/RevenueTrainRun.java =================================================================== --- trunk/18xx/rails/algorithms/RevenueTrainRun.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/algorithms/RevenueTrainRun.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -3,6 +3,7 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -20,10 +21,9 @@ /** * Links the results from the revenue calculator to the rails program * Each object defines the run of one train - * @author freystef * */ -public class RevenueTrainRun { +public class RevenueTrainRun implements Comparable<RevenueTrainRun> { private static final int PRETTY_PRINT_LENGTH = 100; private static final int PRETTY_PRINT_INDENT = 10; @@ -49,16 +49,44 @@ public List<NetworkVertex> getRunVertices() { return vertices; } + + /** + * returns true if train has a valid run (at least two vertices) + */ + public boolean hasAValidRun() { + return vertices.size() >= 2; + } + /** + * returns the first vertex of a train run + */ + public NetworkVertex getFirstVertex() { + NetworkVertex startVertex = null; + NetworkVertex firstVertex = null; + for (NetworkVertex vertex:vertices) { + if (startVertex == vertex) return firstVertex; + if (startVertex == null) startVertex = vertex; + firstVertex = vertex; + } + return startVertex; + } + + /** + * returns the last vertex of a train run + */ + public NetworkVertex getLastVertex() { + return vertices.get(vertices.size()-1); + } + public Set<NetworkVertex> getUniqueVertices() { return new HashSet<NetworkVertex>(vertices); } - + public NetworkTrain getTrain() { return train; } - int getRunValue() { + public int getRunValue() { int value = 0; NetworkVertex startVertex = null; for (NetworkVertex vertex:vertices) { @@ -288,4 +316,9 @@ } return path; } + + public int compareTo(RevenueTrainRun other) { + return ((Integer)this.getRunValue()).compareTo(other.getRunValue()); + } + } \ No newline at end of file Added: trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -0,0 +1,123 @@ +package rails.game.specific._1825; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.apache.log4j.Logger; + +import rails.algorithms.NetworkTrain; +import rails.algorithms.RevenueAdapter; +import rails.algorithms.RevenueDynamicModifier; +import rails.algorithms.RevenueTrainRun; +/** + * 1825 modifiers: + * Trains have to start and end in a major station + * Allows two 2-trains to run as a 3-train (double heading) + */ +public class DoubleHeadingModifier implements RevenueDynamicModifier { + + protected static Logger log = + Logger.getLogger(DoubleHeadingModifier.class.getPackage().getName()); + + private final static String TRAIN_2_NAME = "2"; + private final static String DUALHEAD_NAME = "2&2"; + + 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)) { + nbTrain2 ++; + } + } + + // 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); + revenueAdapter.addTrain(dualHead); + hasDualHead = true; + nbTrain2 -= 2; + } + + return hasDualHead; + } + + /** + * the prediction value itself is zero, as the add value stems from the train above + */ + public int predictionValue() { + return 0; + } + + /** + * returns the runs of the of the double heading trains + */ + private List<RevenueTrainRun> identifyDoubleHeadingTrains(List<RevenueTrainRun> runs) { + // find and sort the train2Revenues + List<RevenueTrainRun> train2Runs = new ArrayList<RevenueTrainRun>(); + for (RevenueTrainRun run:runs) { + if (run.getTrain().getTrainName().equals(TRAIN_2_NAME)) { + train2Runs.add(run); + } + } + Collections.sort(train2Runs); + + log.debug("Train2Runs=" + train2Runs); + + // keep index on train2Runs + int index2Runs = 0; + // 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) { + // two trains get removed + index2Runs += 2; + } + } + return train2Runs.subList(0, index2Runs); + } + + + /** + * - checks if runs start and end at major stations + * - allows doubleheading + */ + public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns) { + + + if (optimalRuns) return 0; // optimalRuns are adjusted + + // count the adjustments + int changeRevenues = 0; + for (RevenueTrainRun run:identifyDoubleHeadingTrains(runs)) { + changeRevenues -= run.getRunValue(); + } + return changeRevenues; + } + + public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) { + // remove the double heading runs from the revenue list + optimalRuns.removeAll(identifyDoubleHeadingTrains(optimalRuns)); + + // 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) { + removeDoubleHeading.add(run); + } + } + optimalRuns.removeAll(removeDoubleHeading); + } + + public String prettyPrint(RevenueAdapter adapter) { + // nothing to print + return null; + } + +} Property changes on: trunk/18xx/rails/game/specific/_1825/DoubleHeadingModifier.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -0,0 +1,55 @@ +package rails.game.specific._1825; + +import java.util.ArrayList; +import java.util.List; + +import rails.algorithms.RevenueAdapter; +import rails.algorithms.RevenueDynamicModifier; +import rails.algorithms.RevenueTrainRun; + +public class TerminateAtMajorModifier implements RevenueDynamicModifier { + + public boolean prepareModifier(RevenueAdapter revenueAdapter) { + // always active + return true; + } + + public int predictionValue() { + // cannot be predicted + return 0; + } + + private List<RevenueTrainRun> identifyInvalidRuns(List<RevenueTrainRun> runs) { + // check if runs end and start at major stations + List<RevenueTrainRun> invalidRuns = new ArrayList<RevenueTrainRun>(); + for (RevenueTrainRun run:runs) { + if (!run.hasAValidRun()) continue; + if (!run.getFirstVertex().isMajor() || !run.getLastVertex().isMajor()) { + invalidRuns.add(run); + } + } + return invalidRuns; + } + + public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns) { + // optimal runs is already adjusted + if (optimalRuns) return 0; + // otherwise check invalid runs + int changeRevenues = 0; + for (RevenueTrainRun run:identifyInvalidRuns(runs)) { + changeRevenues -= run.getRunValue(); + } + return changeRevenues; + } + + public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) { + // remove invalid runs + optimalRuns.removeAll(identifyInvalidRuns(optimalRuns)); + } + + public String prettyPrint(RevenueAdapter adapter) { + // nothing to do + return null; + } + +} Property changes on: trunk/18xx/rails/game/specific/_1825/TerminateAtMajorModifier.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -102,7 +102,7 @@ return bonusMaximum; } - public int evaluationValue(List<RevenueTrainRun> runs) { + public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns) { int bonusValue = 0; // due to the geography (off-map areas!) each train can only score one bonus for (RevenueBonus bonus:bonuses) { @@ -116,6 +116,10 @@ return bonusValue; } + public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) { + // do nothing here (all is done by changing the evaluation value) + } + public String prettyPrint(RevenueAdapter revenueAdapter) { List<RevenueTrainRun> runs = revenueAdapter.getOptimalRun(); StringBuffer prettyPrint = new StringBuffer(); @@ -131,4 +135,5 @@ } + } Modified: trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java =================================================================== --- trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -32,7 +32,7 @@ return true; } - public int evaluationValue(List<RevenueTrainRun> runs) { + public int evaluationValue(List<RevenueTrainRun> runs, boolean optimalRuns) { return pullmanValue(runs); } @@ -49,6 +49,10 @@ return maxValue; } + public void adjustOptimalRun(List<RevenueTrainRun> optimalRuns) { + // do nothing here (all is done by changing the evaluation value) + } + public String prettyPrint(RevenueAdapter revenueAdapter) { return LocalText.getText("Pullman") + " = " + pullmanValue(revenueAdapter.getOptimalRun()); } @@ -61,4 +65,5 @@ } return maximum; } + } Modified: trunk/18xx/rails/game/state/ArrayListState.java =================================================================== --- trunk/18xx/rails/game/state/ArrayListState.java 2010-09-17 18:39:08 UTC (rev 1423) +++ trunk/18xx/rails/game/state/ArrayListState.java 2010-09-17 21:24:13 UTC (rev 1424) @@ -7,6 +7,7 @@ import rails.game.move.AddToList; import rails.game.move.RemoveFromList; +import rails.game.move.SetChange; /** * State class that wraps an ArrayList @@ -49,8 +50,13 @@ new AddToList<E>(list, element, listName).atIndex(index); } - public void remove(E element) { - new RemoveFromList<E>(list, element, listName); + public boolean remove(E element) { + if (list.contains(element)) { + new RemoveFromList<E>(list, element, listName); + return true; + } else { + return false; + } } public void clear() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-17 18:39:15
|
Revision: 1423 http://rails.svn.sourceforge.net/rails/?rev=1423&view=rev Author: evos Date: 2010-09-17 18:39:08 +0000 (Fri, 17 Sep 2010) Log Message: ----------- 1825U1: added tile -10000 at the left edge where extension kits exist Removed Q21 and Q27, which do not exist on any extension. Modified Paths: -------------- trunk/18xx/data/1825/Map.xml Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-16 21:04:10 UTC (rev 1422) +++ trunk/18xx/data/1825/Map.xml 2010-09-17 18:39:08 UTC (rev 1423) @@ -1,17 +1,32 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="R"> - <!-- The Q row doesn't exist on the board - it is there to facilitate edge tile placement. - The tiles are not upgradable, i.e. no tiles can be laid here--> + <!-- The tiles numbered -10000 do not exist on the board. + These are there only to enable edge tile placement, + which is allowed where board extensions exist. + The tiles are not upgradable, i.e. no yellow tiles can be laid on these hexes --> + <!-- Edge tiles in case Unit 2 is not used --> <Hex name="Q9" tile="-10000"/> <Hex name="Q11" tile="-10000"/> <Hex name="Q13" tile="-10000"/> <Hex name="Q15" tile="-10000"/> <Hex name="Q17" tile="-10000"/> <Hex name="Q19" tile="-10000"/> - <Hex name="Q21" tile="-10000"/> + <!-- End of U2 edge tiles --> + <!-- Edge tiles in case kit R3 (North Norfolk) is not used --> <Hex name="Q23" tile="-10000"/> <Hex name="Q25" tile="-10000"/> - <Hex name="Q27" tile="-10000"/> - <!-- End of nonexistent Q row --> + <!-- End of R3 edge tiles --> + <!-- Edge tiles in case kit R1 (Wales) is not used --> + <Hex name="Q7" tile="-10000"/> + <Hex name="R6" tile="-10000"/> + <Hex name="S7" tile="-10000"/> + <Hex name="T6" tile="-10000"/> + <Hex name="U7" tile="-10000"/> + <Hex name="V6" tile="-10000"/> + <!-- End of R1 edge tiles --> + <!-- Edge tiles in case kit R2 (S/W England) is not used --> + <Hex name="X6" tile="-10000"/> + <Hex name="Y7" tile="-10000"/> + <!-- End of R2 edge tiles --> <Hex name="R8" tile="0"/> <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" /> <Hex name="R12" tile="-20" orientation="1" city="Wolverhampton, Walsall"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-16 21:04:16
|
Revision: 1422 http://rails.svn.sourceforge.net/rails/?rev=1422&view=rev Author: evos Date: 2010-09-16 21:04:10 +0000 (Thu, 16 Sep 2010) Log Message: ----------- 1825: Replaced extra Q row by white tiles. 18EU: used centered city tiles -3007 (Y) and -3008 instead of -10 Modified Paths: -------------- trunk/18xx/data/1825/Map.xml trunk/18xx/data/1825/TileSet.xml trunk/18xx/data/1825/Tiles.xml trunk/18xx/data/18EU/Map.xml trunk/18xx/data/18EU/TileSet.xml trunk/18xx/data/18EU/Tiles.xml trunk/18xx/tiles/Tiles.xml Added Paths: ----------- trunk/18xx/tiles/svg/tile-10000.svg Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/1825/Map.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -1,15 +1,16 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="R"> - <!-- The Q row doesn't exist on the board - it is there to facilitate edge tile placement--> - <Hex name="Q9" tile="0"/> - <Hex name="Q11" tile="0"/> - <Hex name="Q13" tile="0"/> - <Hex name="Q15" tile="0"/> - <Hex name="Q17" tile="0"/> - <Hex name="Q19" tile="0"/> - <Hex name="Q21" tile="0"/> - <Hex name="Q23" tile="0"/> - <Hex name="Q25" tile="0"/> - <Hex name="Q27" tile="0"/> + <!-- The Q row doesn't exist on the board - it is there to facilitate edge tile placement. + The tiles are not upgradable, i.e. no tiles can be laid here--> + <Hex name="Q9" tile="-10000"/> + <Hex name="Q11" tile="-10000"/> + <Hex name="Q13" tile="-10000"/> + <Hex name="Q15" tile="-10000"/> + <Hex name="Q17" tile="-10000"/> + <Hex name="Q19" tile="-10000"/> + <Hex name="Q21" tile="-10000"/> + <Hex name="Q23" tile="-10000"/> + <Hex name="Q25" tile="-10000"/> + <Hex name="Q27" tile="-10000"/> <!-- End of nonexistent Q row --> <Hex name="R8" tile="0"/> <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" /> Modified: trunk/18xx/data/1825/TileSet.xml =================================================================== --- trunk/18xx/data/1825/TileSet.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/1825/TileSet.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -1,8 +1,9 @@ <TileManager tiles="Tiles.xml"> <!-- Preprinted tiles --> <Tile id="0"><!-- Empty space --> - <Upgrade id="7,8,9" hex="-Q9,Q11,Q13,Q15,Q17,Q19,Q21,Q23,Q25,Q27"/> + <Upgrade id="7,8,9"/> </Tile> + <Tile id="-10000"/><!-- Empty space, not upgradeable (for borders between units and kits) --> <Tile id="-1"><!-- 1 town --> <Upgrade id="3,4"/> </Tile> Modified: trunk/18xx/data/1825/Tiles.xml =================================================================== --- trunk/18xx/data/1825/Tiles.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/1825/Tiles.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -1,4 +1,8 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><Tiles><Tile colour="white" id="0" name="empty"/><Tile colour="white" id="-1" name="1 village"> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<Tiles> + <Tile colour="white" id="0" name="empty"/> + <Tile colour="white" id="-10000" name="empty"/> + <Tile colour="white" id="-1" name="1 village"> <Station id="city1" position="002" type="Town"/> </Tile><Tile colour="white" id="-2" name="2 villages"> <Station id="city1" position="102" type="Town"/> Modified: trunk/18xx/data/18EU/Map.xml =================================================================== --- trunk/18xx/data/18EU/Map.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/18EU/Map.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -2,7 +2,7 @@ <!-- 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"/> - <Hex name="C4" label="Y" tile="-10" city="Amsterdam"/> + <Hex name="C4" label="Y" tile="-3007" city="Amsterdam"/> <Hex name="C6" tile="-1" city="Bremen"/> <Hex name="C8" tile="0" /> <Hex name="C10" tile="0" /> @@ -19,19 +19,19 @@ <Hex name="E14" value="20,30" tile="-901" orientation="2" city="Warsaw"/> <Hex name="F1" value="40,70" tile="-902" orientation="1" city="London"/> <Hex name="F3" tile="-1" city="Antwerp"/> - <Hex name="F5" tile="-10" city="Dortmund"/> + <Hex name="F5" tile="-3008" city="Dortmund"/> <Hex name="F7" tile="-1" city="Hannover"/> <Hex name="F9" tile="0" /> <Hex name="F11" tile="0" /> <Hex name="F13" tile="0" /> <Hex name="G2" tile="-1" city="Lille"/> - <Hex name="G4" tile="-10" city="Cologne"/> + <Hex name="G4" tile="-3008" city="Cologne"/> <Hex name="G6" tile="0" /> <Hex name="G8" tile="-1" city="Magdeburg"/> - <Hex name="G10" label="Y" tile="-10" city="Dresden"/> + <Hex name="G10" label="Y" tile="-3007" city="Dresden"/> <Hex name="G12" tile="0" /> <Hex name="H1" tile="0" /> - <Hex name="H3" label="Y" tile="-10" city="Brussels"/> + <Hex name="H3" label="Y" tile="-3007" city="Brussels"/> <Hex name="H5" tile="0" /> <Hex name="H7" tile="0" /> <Hex name="H9" tile="-1" city="Leipzig"/> @@ -39,7 +39,7 @@ <Hex name="H13" tile="0" /> <Hex name="I2" tile="0" /> <Hex name="I4" cost="60" tile="0" /> - <Hex name="I6" tile="-10" city="Frankfurt"/> + <Hex name="I6" tile="-3008" city="Frankfurt"/> <Hex name="I8" tile="0" /> <Hex name="I10" cost="60" tile="0" /> <Hex name="I12" cost="60" tile="0" /> @@ -54,17 +54,17 @@ <Hex name="K4" cost="60" tile="0" /> <Hex name="K6" tile="-1" city="Augsburg"/> <Hex name="K8" tile="0" /> - <Hex name="K10" tile="-10" city="Prague"/> + <Hex name="K10" tile="-3008" city="Prague"/> <Hex name="K12" tile="0" /> <Hex name="L1" tile="0" /> <Hex name="L3" tile="0" /> <Hex name="L5" tile="-1" city="Stuttgart"/> - <Hex name="L7" tile="-10" city="Munich"/> + <Hex name="L7" tile="-3007" label="Y" city="Munich"/> <Hex name="L9" cost="60" tile="0" /> <Hex name="L11" tile="-1" city="Brünn"/> <Hex name="L13" tile="0" /> <Hex name="M2" tile="-1" city="Dijon"/> - <Hex name="M4" label="Y" tile="-10" city="Strasbourg"/> + <Hex name="M4" label="Y" tile="-3007" city="Strasbourg"/> <Hex name="M6" tile="0" /> <Hex name="M8" tile="0" /> <Hex name="M10" cost="60" tile="0" /> @@ -91,8 +91,8 @@ <Hex name="P7" cost="60" tile="0" /> <Hex name="P9" cost="120,60" label="M" tile="0" /><!-- Arlberg --> <Hex name="P11" cost="60" label="M" tile="8" orientation="1"/><!-- Semmering --> - <Hex name="P13" label="Y" tile="-10" city="Budapest"/> - <Hex name="Q2" label="Y" tile="-10" city="Lyon"/> + <Hex name="P13" label="Y" tile="-3007" city="Budapest"/> + <Hex name="Q2" label="Y" tile="-3007" city="Lyon"/> <Hex name="Q4" cost="120,60" label="M" tile="0" /><!-- Lotschberg --> <Hex name="Q6" cost="120,60" label="M" tile="0" /><!-- Gotthard --> <Hex name="Q8" cost="120,60" label="M" tile="0" /><!-- Brenner --> @@ -101,18 +101,18 @@ <Hex name="Q14" value="30,50" tile="-901" orientation="3" city="Bucharest"/> <Hex name="R1" tile="0" /> <Hex name="R3" cost="120,60" label="M" tile="0" /><!-- Frejus --> - <Hex name="R5" label="Y" tile="-10" city="Milan"/> + <Hex name="R5" label="Y" tile="-3007" city="Milan"/> <Hex name="R7" cost="120,60" label="M" tile="0" /><!-- Albula --> - <Hex name="R9" tile="-10" orientation="4" city="Trieste"/> + <Hex name="R9" tile="-3008" orientation="4" city="Trieste"/> <Hex name="R11" tile="0" /> - <Hex name="S2" tile="-10" city="Marseille"/> - <Hex name="S4" tile="-10" city="Turin"/> + <Hex name="S2" tile="-3008" city="Marseille"/> + <Hex name="S4" tile="-3008" city="Turin"/> <Hex name="S6" tile="0" /> - <Hex name="S8" label="Y" tile="-10" city="Venice"/> + <Hex name="S8" label="Y" tile="-3007" city="Venice"/> <Hex name="S10" tile="0" /> <Hex name="T1" tile="0" /> <Hex name="T3" cost="60" tile="-1" city="Nice"/> - <Hex name="T5" tile="-10" city="Genoa"/> + <Hex name="T5" tile="-3008" city="Genoa"/> <Hex name="T7" tile="-1" city="Bologna"/> <Hex name="T9" port="yes" value="10" tile="-800" orientation="3"/> <Hex name="U2" port="yes" value="10" tile="-800" orientation="3"/> Modified: trunk/18xx/data/18EU/TileSet.xml =================================================================== --- trunk/18xx/data/18EU/TileSet.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/18EU/TileSet.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -6,10 +6,12 @@ <Tile id="-1"><!-- 1 town --> <Upgrade id="3,4,58"/> </Tile> - <Tile id="-10"><!-- 1 city --> - <Upgrade id="57" hex="F5,G4,I6,K10,R9,S2,S4,T5" /> - <Upgrade id="201,202" hex="C4,G10,H3,L7,M4,P13,Q2,R5,S8" /> + <Tile id="-3008"><!-- 1 city --> + <Upgrade id="57"/> </Tile> + <Tile id="-3007"><!-- 1 Y city --> + <Upgrade id="201,202"/> + </Tile> <Tile id="-3"/> <Tile id="-800"/> <Tile id="-901"/> Modified: trunk/18xx/data/18EU/Tiles.xml =================================================================== --- trunk/18xx/data/18EU/Tiles.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/data/18EU/Tiles.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -4,9 +4,12 @@ <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 colour="white" id="-3007" name="Y city (cent)"> + <Station id="city1" position="0" slots="1" type="City"/> </Tile> + <Tile colour="white" id="-3008" name="city (cent.)"> + <Station id="city1" position="0" slots="1" type="City"/> + </Tile> <Tile colour="fixed" id="-3" name="MF 3"> <Station id="city1" position="252" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side2"/> Modified: trunk/18xx/tiles/Tiles.xml =================================================================== --- trunk/18xx/tiles/Tiles.xml 2010-09-16 20:12:37 UTC (rev 1421) +++ trunk/18xx/tiles/Tiles.xml 2010-09-16 21:04:10 UTC (rev 1422) @@ -62,6 +62,7 @@ <Station id="city1" position="002" type="Town"/> </Tile> <Tile colour="white" id="0" name="empty"/> + <Tile colour="white" id="-10000" name="empty"/> <Tile colour="yellow" id="1" name="1"> <Station id="city1" position="408" type="Town" value="10"/> <Station id="city2" position="108" type="Town" value="10"/> Added: trunk/18xx/tiles/svg/tile-10000.svg =================================================================== --- trunk/18xx/tiles/svg/tile-10000.svg (rev 0) +++ trunk/18xx/tiles/svg/tile-10000.svg 2010-09-16 21:04:10 UTC (rev 1422) @@ -0,0 +1,6 @@ +<?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="#FFFFFF" stroke="#FFFFFF" stroke-width="1" + stroke-linejoin="round"/> +</svg> \ 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...> - 2010-09-16 20:12:43
|
Revision: 1421 http://rails.svn.sourceforge.net/rails/?rev=1421&view=rev Author: evos Date: 2010-09-16 20:12:37 +0000 (Thu, 16 Sep 2010) Log Message: ----------- Extra 'Q' row cannot be upgraded. Modified Paths: -------------- trunk/18xx/data/1825/TileSet.xml Modified: trunk/18xx/data/1825/TileSet.xml =================================================================== --- trunk/18xx/data/1825/TileSet.xml 2010-09-15 15:44:14 UTC (rev 1420) +++ trunk/18xx/data/1825/TileSet.xml 2010-09-16 20:12:37 UTC (rev 1421) @@ -1,7 +1,7 @@ <TileManager tiles="Tiles.xml"> <!-- Preprinted tiles --> <Tile id="0"><!-- Empty space --> - <Upgrade id="7,8,9"/> + <Upgrade id="7,8,9" hex="-Q9,Q11,Q13,Q15,Q17,Q19,Q21,Q23,Q25,Q27"/> </Tile> <Tile id="-1"><!-- 1 town --> <Upgrade id="3,4"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2010-09-15 15:44:21
|
Revision: 1420 http://rails.svn.sourceforge.net/rails/?rev=1420&view=rev Author: wakko666 Date: 2010-09-15 15:44:14 +0000 (Wed, 15 Sep 2010) Log Message: ----------- Apply 1825 patch from Phil Davies <de...@gm...> Modified Paths: -------------- trunk/18xx/data/1825/CompanyManager.xml trunk/18xx/data/1825/Game.xml trunk/18xx/data/1825/Map.xml trunk/18xx/data/1825/StockMarket.xml trunk/18xx/data/1825/TileSet.xml trunk/18xx/data/1825/Tiles.xml trunk/18xx/data/GamesList.xml trunk/18xx/rails/game/PublicCompany.java trunk/18xx/rails/game/PublicCompanyI.java Added Paths: ----------- trunk/18xx/rails/game/specific/_1825/ trunk/18xx/rails/game/specific/_1825/OperatingRound_1825.java trunk/18xx/rails/game/specific/_1825/PublicCompany_1825.java trunk/18xx/rails/game/specific/_1825/StartRound_1825.java trunk/18xx/rails/game/specific/_1825/StockRound_1825.java Modified: trunk/18xx/data/1825/CompanyManager.xml =================================================================== --- trunk/18xx/data/1825/CompanyManager.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/CompanyManager.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -2,10 +2,10 @@ <CompanyManager> <CompanyType name="Private" class="rails.game.PrivateCompany"> </CompanyType> - <CompanyType name="Public" class="rails.game.PublicCompany"> - <PoolPaysOut/> + + <CompanyType name="Public" class="rails.game.specific._1825.PublicCompany_1825"> <Float percentage="60"/> - <ShareUnit percentage="10"/> + <StockPrice par="yes"></StockPrice><ShareUnit percentage="10"/> <BaseTokens> <!-- HomeBase lay options: "whenStarted", "whenFloated", "firstOR" (default) --> ` <HomeBase lay="firstOR"/> @@ -14,8 +14,9 @@ </BaseTokens> <Certificate type="President" shares="2"/> <Certificate shares="1" number="8"/> - <Trains number="4,4,3,-1,-1"/> - </CompanyType> + <Trains number="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"> </Company> <Company name="CHP" type="Private" basePrice="75" revenue="12" @@ -31,39 +32,47 @@ <!-- Note two supported colour specification formats: RGB decimal with commas and RGB hexadecimal without commas --> <Company name="LNWR" type="Public" tokens="6" fgColour="FFFFFF" - bgColour="000000" longname="London & North Western Railway"> + bgColour="000000" longname="London & North Western Railway" startspace="P1"> <Home hex="T16" /> </Company> <Company name="GWR" type="Public" tokens="6" fgColour="FFFFFF" - bgColour="006600" longname="Great Western Railway"> + bgColour="006600" longname="Great Western Railway" available="no" + startspace="O1"> <Home hex="V14" /> </Company> - - + + <Company name="LSWR" type="Public" tokens="5" fgColour="000000" - bgColour="99FF66" longname="London & South Western Railway"> - <Home hex="V20" city="1"/> + bgColour="99FF66" longname="London & South Western Railway" + available="no" startspace="M1"> + <Home hex="V20" city="6" /> </Company> <Company name="GER" type="Public" tokens="5" fgColour="FFFFFF" - bgColour="000066" longname="Great Eastern"> - <Home hex="V20" city="5" /> + bgColour="000066" longname="Great Eastern" available="no" + startspace="M1"> + <Home hex="V20" city="4" /> </Company> - <Company name="SECR" type="Public" tokens="5" fgColour="000000" bgColour="FFFF00" - longname="South Eastern & Chatham Railway"> + <Company name="SECR" type="Public" tokens="5" fgColour="000000" + bgColour="FFFF00" longname="South Eastern & Chatham Railway" + available="no" startspace="L1"> <Home hex="W23"></Home> </Company> <Company name="LBSC" type="Public" tokens="4" fgColour="000000" - bgColour="FF9900" longname="London, Brighton & South Coast Railway"> + bgColour="FF9900" + longname="London, Brighton & South Coast Railway" available="no" + startspace="K1"> <Home hex="X20"></Home> </Company> - - <StartPacket roundClass="rails.game.specific._1851.StartRound_1851"> + + <StartPacket roundClass="rails.game.specific._1825.StartRound_1825"> <Item name="S&M" type="Private" basePrice="30"/> <Item name="CHP" type="Private" basePrice="75"/> <Item name="C&W" type="Private" basePrice="130"/> <Item name="L&M" type="Private" basePrice="210"/> <IfOption name="NumberOfPlayers" value="5"> - <Item name="LNWR" type="Public" president="yes"></Item></IfOption></StartPacket> + <Item name="LNWR" type="Public" president="yes" + basePrice="200"> + </Item></IfOption></StartPacket> <StockRoundRules> <!-- Will probably move later to a GameManager XML--> <NoSaleInFirstSR/> Modified: trunk/18xx/data/1825/Game.xml =================================================================== --- trunk/18xx/data/1825/Game.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/Game.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -15,18 +15,20 @@ <GameOption name="RouteAwareness" values="Highlight,Deactivate" default="Deactivate" /> <GameOption name="RevenueCalculation" values="Suggest,Deactivate" default="Deactivate" /> <GameOption name="SeparateSalesAtSamePrice" type="toggle" default="yes"/> - <PlayerShareLimit percentage="100"/> - <BankPoolLimit percentage="100"></BankPoolLimit> <EndOfGame> <Bankruptcy/> - <BankBreaks limit="0" finish="setOfORs"/> + <BankBreaks limit="0" finish="CurrentOR"/> <!-- "Runs out"; when "broken", -1 is the limit --> </EndOfGame> - </Component> + <GameParameters><PlayerShareLimit percentage="100" /><BankPoolShareLimit percentage="100"></BankPoolShareLimit> + <StockRound sequence="SellBuySell" class="rails.game.specific._1825.StockRound_1825"> + <NoSaleInFirstSR></NoSaleInFirstSR></StockRound> + <OperatingRound class="rails.game.specific._1825.OperatingRound_1825"></OperatingRound></GameParameters></Component> <Component name="PlayerManager" class="rails.game.PlayerManager"> - <Players number="3" cash="800" certLimit="20"/> - <Players number="4" cash="630" certLimit="16"/> - <Players number="5" cash="504" certLimit="13"/> + <Players number="2" cash="1200" certLimit="24"/> + <Players number="3" cash="830" certLimit="16"/> + <Players number="4" cash="630" certLimit="12"/> + <Players number="5" cash="504" certLimit="10"/> </Component> <Component name="Bank" class="rails.game.Bank"> <Bank amount="12000"/> @@ -80,10 +82,7 @@ number="3"> </OperatingRounds> </Phase> - <Phase name="4"> - <Tiles colour="yellow,green,brown,grey"/> - </Phase> - <Phase name="5"> - </Phase> </Component> + <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> + </Component> </ComponentManager> Modified: trunk/18xx/data/1825/Map.xml =================================================================== --- trunk/18xx/data/1825/Map.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/Map.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -1,4 +1,16 @@ <Map mapClass="rails.ui.swing.hexmap.EWHexMap" tileOrientation="EW" letterOrientation="vertical" even="R"> + <!-- The Q row doesn't exist on the board - it is there to facilitate edge tile placement--> + <Hex name="Q9" tile="0"/> + <Hex name="Q11" tile="0"/> + <Hex name="Q13" tile="0"/> + <Hex name="Q15" tile="0"/> + <Hex name="Q17" tile="0"/> + <Hex name="Q19" tile="0"/> + <Hex name="Q21" tile="0"/> + <Hex name="Q23" tile="0"/> + <Hex name="Q25" tile="0"/> + <Hex name="Q27" tile="0"/> + <!-- End of nonexistent Q row --> <Hex name="R8" tile="0"/> <Hex name="R10" tile="-1" city="Shrewsbury" orientation="3" /> <Hex name="R12" tile="-20" orientation="1" city="Wolverhampton, Walsall"/> Modified: trunk/18xx/data/1825/StockMarket.xml =================================================================== --- trunk/18xx/data/1825/StockMarket.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/StockMarket.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -1,38 +1,39 @@ <StockMarket type="linear"> <!-- Note two supported colour specification formats: RGB decimal with commas and RGB hexadecimal without commas --> - - <StockSpace name="A1" price="0"/> - <StockSpace name="B1" price="5"/> - <StockSpace name="C1" price="10"/> - <StockSpace name="D1" price="16"/> - <StockSpace name="E1" price="24"></StockSpace> - <StockSpace name="F1" price="34"/> - <StockSpace name="G1" price="42"/> - <StockSpace name="H1" price="49"/> - <StockSpace name="I1" price="55" /> - <StockSpace name="J1" price="61"></StockSpace> - <StockSpace name="A2" price="67"> - <StartSpace></StartSpace></StockSpace> - <StockSpace name="B2" price="71"> - <StartSpace></StartSpace></StockSpace> - <StockSpace name="C2" price="76"> - <StartSpace></StartSpace></StockSpace> - <StockSpace name="D2" price="82"/> - <StockSpace name="E2" price="90"> - <StartSpace></StartSpace></StockSpace> - <StockSpace name="F2" price="100"> - <StartSpace></StartSpace></StockSpace> - <StockSpace name="G2" price="112"/> - <StockSpace name="H2" price="126" /> - <StockSpace name="I2" price="142" /> - <StockSpace name="A3" price="160"/> - <StockSpace name="B3" price="180"/> - <StockSpace name="C3" price="205"></StockSpace> - <StockSpace name="D3" price="230"/> - <StockSpace name="E3" price="255"/> - <StockSpace name="F3" price="280"/> - <StockSpace name="G3" price="300"/> - <StockSpace name="H3" price="320"/> - <StockSpace name="I3" price="340" /> + <StockSpaceType name="yellow" colour="255,255,0"> + <NoCertLimit/> + </StockSpaceType> + <StockSpace name="A1" price="0" type="yellow"> + <ClosesCompany/> + </StockSpace> + <StockSpace name="B1" price="5" type="yellow"/> + <StockSpace name="C1" price="10" type="yellow"/> + <StockSpace name="D1" price="16" type="yellow"/> + <StockSpace name="E1" price="24" type="yellow"/> + <StockSpace name="F1" price="34" type="yellow"/> + <StockSpace name="G1" price="42" type="yellow"/> + <StockSpace name="H1" price="49" type="yellow"/> + <StockSpace name="I1" price="55"/> + <StockSpace name="J1" price="61"/> + <StockSpace name="K1" price="67"/> + <StockSpace name="L1" price="71"/> + <StockSpace name="M1" price="76"/> + <StockSpace name="N1" price="82"/> + <StockSpace name="O1" price="90"/> + <StockSpace name="P1" price="100"/> + <StockSpace name="Q1" price="112"/> + <StockSpace name="R1" price="126"/> + <StockSpace name="S1" price="142"/> + <StockSpace name="T1" price="160"/> + <StockSpace name="U1" price="180"/> + <StockSpace name="V1" price="205"/> + <StockSpace name="W1" price="230"/> + <StockSpace name="X1" price="255"/> + <StockSpace name="Y1" price="280"/> + <StockSpace name="Z1" price="300"/> + <StockSpace name="[1" price="320"/> + <StockSpace name="\1" price="340"> + <GameOver/> + </StockSpace> </StockMarket> Modified: trunk/18xx/data/1825/TileSet.xml =================================================================== --- trunk/18xx/data/1825/TileSet.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/TileSet.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -13,7 +13,7 @@ <Upgrade id="5,6"/> </Tile> <Tile id="-20"><!-- 2 OO cities --> - <Upgrade id="52" relayBaseTokens="yes"/> + <Upgrade id="1052" relayBaseTokens="yes"/> </Tile> <Tile id="-5"><!--Dover--></Tile> <Tile id="-7"><!--Preprinted tight bend--></Tile> @@ -47,7 +47,7 @@ <Tile id="8" quantity="8" > <Upgrade id="16,19,23,24,25,28,29"></Upgrade></Tile> <Tile id="9" quantity="7" > - <Upgrade id="19,23,24,25,28,29"></Upgrade></Tile> + <Upgrade id="19,20,23,24,26,27"></Upgrade></Tile> <Tile id="55" quantity="1"> <Upgrade id="14"></Upgrade> </Tile> @@ -94,8 +94,8 @@ <Tile id="29" quantity="1"> <Upgrade id="45"></Upgrade> </Tile> - <Tile id="52" quantity="2"> - <Upgrade id="34"></Upgrade> + <Tile id="1052" quantity="2"> + <Upgrade id="64,65,66,67,68"></Upgrade> </Tile> <Tile id="87" quantity="1"> </Tile> Modified: trunk/18xx/data/1825/Tiles.xml =================================================================== --- trunk/18xx/data/1825/Tiles.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/1825/Tiles.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -1,38 +1,27 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<Tiles> - <Tile colour="white" id="0" name="empty"/> - <Tile colour="white" id="-1" name="1 village"> +<?xml version="1.0" encoding="UTF-8" standalone="no"?><Tiles><Tile colour="white" id="0" name="empty"/><Tile colour="white" id="-1" name="1 village"> <Station id="city1" position="002" type="Town"/> - </Tile> - <Tile colour="white" id="-2" name="2 villages"> + </Tile><Tile colour="white" id="-2" name="2 villages"> <Station id="city1" position="102" type="Town"/> <Station id="city2" position="302" type="Town"/> - </Tile> - <Tile colour="white" id="-10" name="1 city"> + </Tile><Tile colour="white" id="-10" name="1 city"> <Station id="city1" position="302" slots="1" type="City"/> - </Tile> - <Tile colour="yellow" id="-20" name="2 cities"> + </Tile><Tile colour="yellow" id="-20" name="2 cities"> <Station id="city1" position="002" slots="1" type="City"/> <Station id="city2" position="302" slots="1" type="City"/> - </Tile> - <Tile colour="fixed" id="-5" name="MF 5"> + </Tile><Tile colour="fixed" id="-5" name="MF 5"> <Station id="city1" position="0" slots="1" type="City" value="20"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side1"/> - </Tile> - <Tile colour="fixed" id="-7" name="MF 7"> + </Tile><Tile colour="fixed" id="-7" name="MF 7"> <Track from="side2" gauge="normal" to="side1"/> - </Tile> - <Tile colour="fixed" id="-41" name="-41"> + </Tile><Tile colour="fixed" id="-41" name="-41"> <Track from="side0" gauge="normal" to="side3"/> <Track from="side4" gauge="normal" to="side0"/> <Track from="side4" gauge="normal" to="side3"/> - </Tile> - <Tile colour="fixed" id="-104" name="MF 104"> + </Tile><Tile colour="fixed" id="-104" name="MF 104"> <Station id="city1" position="0" slots="1" type="City" value="20"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="green" id="-25001" name="London"> + </Tile><Tile colour="green" id="-25001" name="London"> <Station id="city1" position="403" slots="1" type="City" value="50"/> <Station id="city2" position="503" slots="1" type="City" value="50"/> <Station id="city3" position="003" slots="1" type="City" value="50"/> @@ -45,196 +34,160 @@ <Track from="side2" gauge="normal" to="city5"/> <Track from="side1" gauge="normal" to="city4"/> <Track from="side0" gauge="normal" to="city3"/> - </Tile> - <Tile colour="green" id="-25002" name="Birmingham"> + </Tile><Tile colour="green" id="-25002" name="Birmingham"> <Station id="city1" position="402" slots="1" type="City" value="40"/> <Station id="city2" position="002" slots="1" type="City" value="40"/> <Station id="city3" position="202" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city3" gauge="normal" to="side2"/> <Track from="side0" gauge="normal" to="city2"/> - </Tile> - <Tile colour="green" id="-25003" name="Bristol"> + </Tile><Tile colour="green" id="-25003" name="Bristol"> <Station id="city1" position="0" slots="1" type="City" value="30"/> <Track from="side3" gauge="normal" to="city1"/> <Track from="city1" gauge="normal" to="side1"/> - </Tile> - <Tile colour="fixed" id="-25004" name="Wolverton"> + </Tile><Tile colour="fixed" id="-25004" name="Wolverton"> <Station id="city1" position="0" slots="1" type="City" value="10"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="fixed" id="-25005" name="Swindon"> + </Tile><Tile colour="fixed" id="-25005" name="Swindon"> <Station id="city1" position="0" slots="1" type="City" value="10"/> <Track from="side4" gauge="normal" to="city1"/> <Track from="side5" gauge="normal" to="city1"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="fixed" id="-25006" name="Southend"> + </Tile><Tile colour="fixed" id="-25006" name="Southend"> <Station id="city1" position="102" slots="1" type="City" value="20"/> <Track from="side4" gauge="normal" to="side0"/> <Track from="side4" gauge="normal" to="city1"/> <Track from="side3" gauge="normal" to="side2"/> - </Tile> - <Tile colour="fixed" id="-25007" name="Bournemouth"> + </Tile><Tile colour="fixed" id="-25007" name="Bournemouth"> <Station id="city1" position="0" slots="1" type="City" value="20"/> <Station id="city2" position="0" slots="1" type="City" value="20"/> <Track from="side4" gauge="normal" to="city2"/> <Track from="side5" gauge="normal" to="city2"/> <Track from="side0" gauge="normal" to="city2"/> - </Tile> - <Tile colour="yellow" id="1" name="1"> + </Tile><Tile colour="yellow" id="1" name="1"> <Station id="city1" position="408" type="Town" value="10"/> <Station id="city2" position="108" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side3"/> - </Tile> - <Tile colour="yellow" id="2" name="2"> + </Tile><Tile colour="yellow" id="2" name="2"> <Station id="city1" position="302" type="Town" value="10"/> <Station id="city2" position="109" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side2"/> - </Tile> - <Tile colour="yellow" id="3" name="3"> + </Tile><Tile colour="yellow" id="3" name="3"> <Station id="city1" position="352" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side4"/> - </Tile> - <Tile colour="yellow" id="4" name="4"> + </Tile><Tile colour="yellow" id="4" name="4"> <Station id="city1" position="0" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side0"/> - </Tile> - <Tile colour="yellow" id="5" name="5"> + </Tile><Tile colour="yellow" id="5" name="5"> <Station id="city1" position="0" slots="1" type="City" value="20"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="yellow" id="6" name="6"> + </Tile><Tile colour="yellow" id="6" name="6"> <Station id="city1" position="0" slots="1" type="City" value="20"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="yellow" id="7" name="7"> + </Tile><Tile colour="yellow" id="7" name="7"> <Track from="side3" gauge="normal" to="side4"/> - </Tile> - <Tile colour="yellow" id="8" name="8"> + </Tile><Tile colour="yellow" id="8" name="8"> <Track from="side3" gauge="normal" to="side5"/> - </Tile> - <Tile colour="yellow" id="9" name="9"> + </Tile><Tile colour="yellow" id="9" name="9"> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="yellow" id="55" name="55"> + </Tile><Tile colour="yellow" id="55" name="55"> <Station id="city1" position="202" type="Town" value="10"/> <Station id="city2" position="302" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side5"/> <Track from="city2" gauge="normal" to="side3"/> <Track from="city2" gauge="normal" to="side0"/> - </Tile> - <Tile colour="yellow" id="56" name="56"> + </Tile><Tile colour="yellow" id="56" name="56"> <Station id="city1" position="407" type="Town" value="10"/> <Station id="city2" position="108" type="Town" value="10"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side2"/> - </Tile> - <Tile colour="green" id="12" name="12"> + </Tile><Tile colour="green" id="12" name="12"> <Station id="city1" position="0" slots="1" 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"/> - </Tile> - <Tile colour="green" id="13" name="13"> + </Tile><Tile colour="green" id="13" name="13"> <Station id="city1" position="0" slots="1" type="City" value="30"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side4"/> - </Tile> - <Tile colour="green" id="14" name="14"> + </Tile><Tile colour="green" id="14" name="14"> <Station id="city1" position="0" slots="2" type="City" value="30"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="15" name="15"> + </Tile><Tile colour="green" id="15" name="15"> <Station id="city1" position="0" slots="2" type="City" value="30"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> <Track from="city1" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="16" name="16"> + </Tile><Tile colour="green" id="16" name="16"> <Track from="side3" gauge="normal" to="side5"/> <Track from="side4" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="19" name="19"> + </Tile><Tile colour="green" id="19" name="19"> <Track from="side5" gauge="normal" to="side1"/> <Track from="side0" gauge="normal" to="side3"/> - </Tile> - <Tile colour="green" id="20" name="20"> + </Tile><Tile colour="green" id="20" name="20"> <Track from="side1" gauge="normal" to="side4"/> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="23" name="23"> + </Tile><Tile colour="green" id="23" name="23"> <Track from="side4" gauge="normal" to="side0"/> <Track from="side0" gauge="normal" to="side3"/> - </Tile> - <Tile colour="green" id="24" name="24"> + </Tile><Tile colour="green" id="24" name="24"> <Track from="side3" gauge="normal" to="side5"/> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="25" name="25"> + </Tile><Tile colour="green" id="25" name="25"> <Track from="side1" gauge="normal" to="side3"/> <Track from="side3" gauge="normal" to="side5"/> - </Tile> - <Tile colour="green" id="26" name="26"> + </Tile><Tile colour="green" id="26" name="26"> <Track from="side5" gauge="normal" to="side0"/> <Track from="side0" gauge="normal" to="side3"/> - </Tile> - <Tile colour="green" id="27" name="27"> + </Tile><Tile colour="green" id="27" name="27"> <Track from="side3" gauge="normal" to="side4"/> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="green" id="28" name="28"> + </Tile><Tile colour="green" id="28" name="28"> <Track from="side3" gauge="normal" to="side5"/> <Track from="side4" gauge="normal" to="side5"/> - </Tile> - <Tile colour="green" id="29" name="29"> + </Tile><Tile colour="green" id="29" name="29"> <Track from="side3" gauge="normal" to="side4"/> <Track from="side3" gauge="normal" to="side5"/> - </Tile> - <Tile colour="green" id="52" name="52"> - <Station id="city1" position="0" slots="2" type="City" value="30"/> - <Track from="city1" gauge="normal" to="side5"/> - <Track from="city1" gauge="normal" to="side0"/> + </Tile><Tile colour="green" id="1052" name="52"> + <Station id="city1" position="152" slots="1" type="City" value="40"/> + <Station id="city2" position="452" slots="1" type="City" value="40"/> <Track from="city1" gauge="normal" to="side2"/> - <Track from="city1" gauge="normal" to="side4"/> - </Tile> - <Tile colour="green" id="87" name="87"> + <Track from="city2" gauge="normal" to="side4"/> + </Tile><Tile colour="green" id="87" name="87"> <Station id="city1" position="0" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> - </Tile> - <Tile colour="green" id="88" name="88"> + </Tile><Tile colour="green" id="88" name="88"> <Station id="city1" position="0" type="Town" value="10"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> - </Tile> - <Tile colour="brown" id="32" name="32"> + </Tile><Tile colour="brown" id="32" name="32"> <Station id="city1" position="303" slots="1" type="City" value="70"/> <Station id="city2" position="403" slots="1" type="City" value="70"/> <Station id="city3" position="503" slots="1" type="City" value="70"/> @@ -247,8 +200,7 @@ <Track from="city3" gauge="normal" to="side5"/> <Track from="city2" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side3"/> - </Tile> - <Tile colour="brown" id="34" name="34"> + </Tile><Tile colour="brown" id="34" name="34"> <Station id="city1" position="352" slots="1" type="City" value="50"/> <Station id="city2" position="052" slots="1" type="City" value="50"/> <Station id="city3" position="502" slots="1" type="City" value="50"/> @@ -256,80 +208,68 @@ <Track from="city1" gauge="normal" to="side4"/> <Track from="city3" gauge="normal" to="side2"/> <Track from="city3" gauge="normal" to="side5"/> - </Tile> - <Tile colour="brown" id="38" name="38"> + </Tile><Tile colour="brown" id="38" name="38"> <Station id="city1" position="0" slots="2" type="City" value="40"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city1" gauge="normal" to="side2"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side5"/> - </Tile> - <Tile colour="brown" id="41" name="41"> + </Tile><Tile colour="brown" id="41" name="41"> <Track from="side4" gauge="normal" to="side0"/> <Track from="side4" gauge="normal" to="side3"/> <Track from="side0" gauge="normal" to="side3"/> - </Tile> - <Tile colour="brown" id="42" name="42"> + </Tile><Tile colour="brown" id="42" name="42"> <Track from="side3" gauge="normal" to="side5"/> <Track from="side3" gauge="normal" to="side0"/> <Track from="side5" gauge="normal" to="side0"/> - </Tile> - <Tile colour="brown" id="45" name="45"> + </Tile><Tile colour="brown" id="45" name="45"> <Track from="side1" gauge="normal" to="side5"/> <Track from="side1" gauge="normal" to="side3"/> <Track from="side5" gauge="normal" to="side0"/> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="brown" id="46" name="46"> + </Tile><Tile colour="brown" id="46" name="46"> <Track from="side1" gauge="normal" to="side5"/> <Track from="side1" gauge="normal" to="side0"/> <Track from="side3" gauge="normal" to="side5"/> <Track from="side3" gauge="normal" to="side0"/> - </Tile> - <Tile colour="brown" id="47" name="47"> + </Tile><Tile colour="brown" id="47" name="47"> <Track from="side3" gauge="normal" to="side0"/> <Track from="side3" gauge="normal" to="side1"/> <Track from="side4" gauge="normal" to="side0"/> <Track from="side4" gauge="normal" to="side1"/> - </Tile> - <Tile colour="brown" id="64" name="64"> + </Tile><Tile colour="brown" id="64" name="64"> <Station id="city1" position="401" slots="1" type="City" value="50"/> <Station id="city2" position="052" slots="1" type="City" value="50"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side5"/> <Track from="city2" gauge="normal" to="side1"/> <Track from="city2" gauge="normal" to="side0"/> - </Tile> - <Tile colour="brown" id="65" name="65"> + </Tile><Tile colour="brown" id="65" name="65"> <Station id="city1" position="501" slots="1" type="City" value="50"/> <Station id="city2" position="252" slots="1" type="City" value="50"/> <Track from="city1" gauge="normal" to="side4"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city2" gauge="normal" to="side2"/> <Track from="city2" gauge="normal" to="side3"/> - </Tile> - <Tile colour="brown" id="66" name="66"> + </Tile><Tile colour="brown" id="66" name="66"> <Station id="city1" position="002" slots="1" type="City" value="50"/> <Station id="city2" position="452" slots="1" type="City" value="50"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city1" gauge="normal" to="side0"/> <Track from="city2" gauge="normal" to="side4"/> <Track from="city2" gauge="normal" to="side5"/> - </Tile> - <Tile colour="brown" id="67" name="67"> + </Tile><Tile colour="brown" id="67" name="67"> <Station id="city1" position="307" slots="1" type="City" value="50"/> <Station id="city2" position="502" slots="1" type="City" value="50"/> <Track from="city1" gauge="normal" to="side1"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city2" gauge="normal" to="side5"/> <Track from="city2" gauge="normal" to="side2"/> - </Tile> - <Tile colour="brown" id="68" name="68"> + </Tile><Tile colour="brown" id="68" name="68"> <Station id="city1" position="302" slots="1" type="City" value="50"/> <Station id="city2" position="502" slots="1" type="City" value="50"/> <Track from="city1" gauge="normal" to="side3"/> <Track from="city2" gauge="normal" to="side2"/> <Track from="city2" gauge="normal" to="side5"/> <Track from="city1" gauge="normal" to="side0"/> - </Tile> -</Tiles> \ No newline at end of file + </Tile></Tiles> \ No newline at end of file Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/data/GamesList.xml 2010-09-15 15:44:14 UTC (rev 1420) @@ -201,9 +201,31 @@ (c) 1994 Hartland Trefoil Ltd. Designed by Francis Tresham -Limitation: -- No random assignment of private companies (players should do this off-line and enter the result) - </Description> +Known Issues: +- BUG: prompt on placing GWR token when upgrading London, needs investigation +- BUG: Trains do not have to own a train and directors cannot fund the purchase of one +- Tile lays that send track off the board are legal in 1825 as long as they don't run into the + sea or the edge of a pre-placed tile with no track on. Currently Rails will not allow some + of these edge placements. The workaround is to use map correction mode to place the tile you want. + ADDITIONAL NOTE: Map correction might still not work, I think route awareness is confused by track going out of the board... + We might need a different fix +- Upgrades to pre-printed tiles are lays, not promotions so you are allowed two of these in a turn. + Rails currently only allows you to lay 2 yellow tiles in a turn. Again, use map correction + for a workaround +- The rule about the two tiles place on your turn not being adjacent is currently not enforced by rails + and must be enforced manually by players +- Revenue Calc: Routes BEGIN and END with large stations, this is currently not checked +- Revenue Calc: Trains may not visit two stations on the same tile, this is currently not checked +- Revenue Calc: 2 2T's can be double headed as a 3T +- The minimum £10 for a train purchase between companies is not enforced +- Money: The boardgame uses company credits, rails does not, as such the bank will potentially break slightly earlier +- Game currently doesn't end when a company reaches the top of the stock market + It needs to end at the end of that companies turn. +- Hexags reserved for certain companies (currently not enforced in EU either) +- Corps that reach the top of the market should end the game at the end of that corps turn +- Not implemented: selling privates back to the bank +- Not implemented: receivership +</Description> <Players minimum="3" maximum="5" /> <Option name="RouteAwareness" values="Highlight,Deactivate" default="Highlight" /> <Option name="RevenueCalculation" values="Suggest,Deactivate" default="Suggest" /> Modified: trunk/18xx/rails/game/PublicCompany.java =================================================================== --- trunk/18xx/rails/game/PublicCompany.java 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/rails/game/PublicCompany.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -269,6 +269,8 @@ protected StockMarketI stockMarket; protected MapManager mapManager; + //PD: used to track floatation order for games that need this (1825) + protected int formationOrderIndex = 0; /** * The constructor. The way this class is instantiated does not allow * arguments. @@ -2007,5 +2009,13 @@ public String getExtraShareMarks () { return ""; } + + public int getFormationOrderIndex() { + return formationOrderIndex; + } + public void setFormationOrderIndex(int formationOrderIndex) { + this.formationOrderIndex = formationOrderIndex; + } + } Modified: trunk/18xx/rails/game/PublicCompanyI.java =================================================================== --- trunk/18xx/rails/game/PublicCompanyI.java 2010-09-10 21:57:19 UTC (rev 1419) +++ trunk/18xx/rails/game/PublicCompanyI.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -358,7 +358,7 @@ public ModelObject getInGameModel (); public ModelObject getIsClosedModel (); - - + public int getFormationOrderIndex (); + public void setFormationOrderIndex (int formationOrderIndex); } Added: trunk/18xx/rails/game/specific/_1825/OperatingRound_1825.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/OperatingRound_1825.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/OperatingRound_1825.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -0,0 +1,40 @@ +package rails.game.specific._1825; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import rails.game.GameManagerI; +import rails.game.OperatingRound; +import rails.game.PublicCompanyI; + +public class OperatingRound_1825 extends OperatingRound { + + public OperatingRound_1825(GameManagerI gameManager) { + super(gameManager); + } + + @Override + public List<PublicCompanyI> setOperatingCompanies() { + Map<Integer, PublicCompanyI> operatingCompanies = new TreeMap<Integer, PublicCompanyI>(); + int space; + int key; + for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { + if (!canCompanyOperateThisRound(company)) continue; + // Key must put companies in reverse operating order, because sort + // is ascending. + space = company.getIPOPrice(); + //Corps operate in descending IPO price + //Corps with the same IPO price operate in the order they were floated + //IPO price will inherently be in the right order + //subtracting the formation order index will put it at the right point to operate + //This wouldn't work if there are lots of corps at the same price + //there are not too many corps in each banding for this to be an issue in 1825 even with all 3 units + key = 1000000 - (space - company.getFormationOrderIndex()); + operatingCompanies.put(new Integer(key), company); + } + return new ArrayList<PublicCompanyI>(operatingCompanies.values()); + } + +} \ No newline at end of file Property changes on: trunk/18xx/rails/game/specific/_1825/OperatingRound_1825.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/rails/game/specific/_1825/PublicCompany_1825.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/PublicCompany_1825.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/PublicCompany_1825.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -0,0 +1,48 @@ +package rails.game.specific._1825; + +import rails.game.PublicCompany; +import rails.game.PublicCompanyI; + +public class PublicCompany_1825 extends PublicCompany { + + + @Override + public void payout(int amount) { + if (amount == 0) return; + //Get current price + int curSharePrice = currentPrice.getPrice().getPrice(); + // Move the token + // Work out number of spaces to move by dividing amount by current share price and rounding + // Move stock token a number of times equal to this multiplier + if (hasStockPrice){ + float shareMultiplier = amount/(float)curSharePrice; + if(shareMultiplier<1){ + shareMultiplier = Math.round(shareMultiplier); + }else{ + shareMultiplier = (float)Math.floor(shareMultiplier); + } + + for (int i = 0; i < shareMultiplier && i < 4; i++) { + stockMarket.payOut(this); + } + } + } + + @Override + public void setFloated() { + super.setFloated(); + + //Need to find out if other corps exist at this IPO price + //If so increment formationOrderIndex to control Operating sequence + for (PublicCompanyI company : gameManager.getAllPublicCompanies()) { + if (this.getIPOPrice() == company.getIPOPrice() && (this.getName() != company.getName())){ + //Yes, we share IPO prices, has this other company been launched yet? + if (company.hasFloated()){ + //it has, we need to skip ahead of this corp + formationOrderIndex++; + } + } + + } + } +} Property changes on: trunk/18xx/rails/game/specific/_1825/PublicCompany_1825.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/rails/game/specific/_1825/StartRound_1825.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/StartRound_1825.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/StartRound_1825.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -0,0 +1,133 @@ +package rails.game.specific._1825; + +import java.util.List; + +import rails.game.*; +import rails.game.action.*; +import rails.util.LocalText; + +public class StartRound_1825 extends StartRound { + + /** + * Constructor, only to be used in dynamic instantiation. + */ + public StartRound_1825(GameManagerI gameManager) { + super(gameManager); + hasBidding = false; + } + + /** + * Start the 1825-style start round. + * + * @param startPacket The startpacket to be sold in this start round. + */ + @Override + public void start() { + super.start(); + + if (!setPossibleActions()) { + /* + * If nobody can do anything, keep executing Operating and Start + * rounds until someone has got enough money to buy one of the + * remaining items. The game mechanism ensures that this will + * ultimately be possible. + */ + finishRound(); + } + + } + + /** + * Get a list + * + * @return An array of start items that can be bought. + */ + + @Override + public boolean setPossibleActions() { + + StartItemAction action; + List<StartItem> startItems = startPacket.getItems(); + boolean itemAvailable = false; + int soldShares = 0; + possibleActions.clear(); + + for (StartItem item : startItems) { + //Do we already have an item available for sale? + if (itemAvailable == false){ + //If not, check whether this has already been sold + if (!item.isSold()){ + item.setStatus(StartItem.BUYABLE); + possibleActions.add(action = + new BuyStartItem(item, item.getBasePrice(), false)); + log.debug(getCurrentPlayer().getName() + " may: " + + action.toString()); + //Found one, no need to find any others + itemAvailable = true; + } + } + } + //Does everyone have at least one private? + //If so, then we're officially into the first share round so passing is allowed + for (StartItem item : startItems) { + if (item.isSold()){ + soldShares++; + } + if (soldShares == playerManager.getPlayers().size()){ + //Enable passing + possibleActions.add(new NullAction(NullAction.PASS)); + } + } + return true; + } + + @Override + public List<StartItem> getStartItems() { + Player currentPlayer = getCurrentPlayer(); + int cashToSpend = currentPlayer.getCash(); + List<StartItem> startItems = startPacket.getItems(); + + for (StartItem item : startItems) { + if (item.isSold()) { + item.setStatus(StartItem.SOLD); + } else if (item.getBasePrice() > cashToSpend) { + item.setStatus(StartItem.UNAVAILABLE); + } else { + item.setStatus(StartItem.BUYABLE); + } + } + return startItems; + } + + @Override + public boolean bid(String playerName, BidStartItem item) { + + DisplayBuffer.add(LocalText.getText("InvalidAction")); + return false; + } + + /** + * Process a player's pass. + * + * @param playerName The name of the current player (for checking purposes). + */ + @Override + public boolean pass(String playerName) { + ReportBuffer.add(LocalText.getText("PASSES", playerName)); + numPasses.add(1); + if (numPasses.intValue() >= numPlayers) { + //Everyone has passed + ReportBuffer.add(LocalText.getText("ALL_PASSED")); + numPasses.set(0); + finishRound(); + } + setNextPlayer(); + return true; + } + + @Override + public String getHelp() { + return "1825 Start Round help text"; + } + +} Property changes on: trunk/18xx/rails/game/specific/_1825/StartRound_1825.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/18xx/rails/game/specific/_1825/StockRound_1825.java =================================================================== --- trunk/18xx/rails/game/specific/_1825/StockRound_1825.java (rev 0) +++ trunk/18xx/rails/game/specific/_1825/StockRound_1825.java 2010-09-15 15:44:14 UTC (rev 1420) @@ -0,0 +1,82 @@ +/** + * This class implements the 1835 rules for making new companies + * being available in the IPO after buying shares of another company. + */ +package rails.game.specific._1825; + +import java.util.ArrayList; +import java.util.List; + +import rails.game.*; + +public class StockRound_1825 extends StockRound { + + protected int[] priceBands = {100,90,82,76,71,67}; + private List<PublicCompanyI> lPublicCompanies = companyManager.getAllPublicCompanies(); + /** + * Constructor with the GameManager, will call super class (StockRound's) Constructor to initialize + * + * @param aGameManager The GameManager Object needed to initialize the Stock Round + * + */ + public StockRound_1825 (GameManagerI aGameManager) { + super (aGameManager); + } + + protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { + // Sales do not affect share price, do nothing + } + + /** + * In 1825, whenever a company is sold out, the block of companies with the next lowest price become available. + * + * Hopefully this logic is generic enough to withstand any combination of units for future implementation + * + * @param boughtfrom The portfolio from which a certificate has been bought. + * @param company The company of which a share has been traded. + */ + @Override + protected void gameSpecificChecks (Portfolio boughtFrom, PublicCompanyI company) { + if (boughtFrom != ipo) return; + + int sharesInIPO = ipo.getShare(company); + + // Check for group releases + if (sharesInIPO == 0) { + //Need to release the next block of companies + + //First find out what price band we were just in + //then find out what the next price band is + //then cycle through companies to find ones at that price + //then set them buyable + for (int i = 0; i < priceBands.length; i++) { + if (priceBands[i] == company.getParPriceModel().getPrice().getPrice()) { + //Found the price band we were in + //We had better break out now if it was the last price band or the next loop + //will run infinitely + if (priceBands[i] == priceBands[priceBands.length - 1]) return; + List<PublicCompanyI> lCompaniesToRelease = new ArrayList<PublicCompanyI>(); + while (lCompaniesToRelease.isEmpty()) { + //while loop needed in case we have no corps at the next valid price band + for (int k = 0; k < companyManager.getAllPublicCompanies().size(); k++){ + //for each public company + if (lPublicCompanies.get(k).getIPOPrice() == priceBands[i+1]){ + //this companies IPO matches the next price band value, add it to the list + lCompaniesToRelease.add(lPublicCompanies.get(k)); + } + } + //If we found corps the loop won't repeat, if we didn't we need the next price band + i++; + } + //We should have found some companies to release now, so do that + for (int j = 0; j < lCompaniesToRelease.size(); j++) { + releaseCompanyShares(lCompaniesToRelease.get(j)); + lCompaniesToRelease.get(j).setBuyable(true); + } + } + } + } + + } + +} Property changes on: trunk/18xx/rails/game/specific/_1825/StockRound_1825.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...> - 2010-09-10 21:57:25
|
Revision: 1419 http://rails.svn.sourceforge.net/rails/?rev=1419&view=rev Author: evos Date: 2010-09-10 21:57:19 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Further refactoring of (very old) share selling code to simplify structure and unravel cash and certificate movements. There now is a central pay() method for cash transfer. Modified Paths: -------------- trunk/18xx/rails/game/Round.java trunk/18xx/rails/game/ShareSellingRound.java trunk/18xx/rails/game/StartRound.java trunk/18xx/rails/game/StockMarket.java trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/TreasuryShareRound.java Modified: trunk/18xx/rails/game/Round.java =================================================================== --- trunk/18xx/rails/game/Round.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/Round.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -113,7 +113,7 @@ protected int getNumberOfPlayers() { return gameManager.getNumberOfPlayers(); } - + protected int getNumberOfActivePlayers () { int number = 0; for (Player player : getPlayers()) { @@ -268,7 +268,7 @@ int minorNo = 0; for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { if (!canCompanyOperateThisRound(company)) continue; - + // Key must put companies in reverse operating order, because sort // is ascending. if (company.hasStockPrice()) { @@ -291,7 +291,7 @@ protected boolean canCompanyOperateThisRound (PublicCompanyI company) { return company.hasFloated() && !company.isClosed(); } - + /** * Check if a company must be floated, and if so, do it. <p>This method is * included here because it is used in various types of Round. @@ -423,15 +423,32 @@ return getClass().getName().replaceAll(".*\\.", ""); } - protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price) { + protected void transferCertificate(Certificate cert, Portfolio newHolder) { - Portfolio oldHolder = (Portfolio) cert.getHolder(); cert.moveTo(newHolder); + } - if (price != 0) { - new CashMove(newHolder.getOwner(), oldHolder.getOwner(), price); + // Note: all transferred shares must come from the same old shareholder. + protected void transferCertificates(List<? extends Certificate> certs, + Portfolio newHolder) { + + for (Certificate cert : certs) { + if (cert != null) { + cert.moveTo(newHolder); + } + } + } + + protected void pay (CashHolder from, CashHolder to, int amount) { + if (to != null && amount != 0) { + new CashMove (from, to, amount); } + } + protected void pay (Portfolio from, Portfolio to, int amount) { + if (to != null && amount != 0) { + new CashMove (from.getOwner(), to.getOwner(), amount); + } } public GameManagerI getGameManager() { Modified: trunk/18xx/rails/game/ShareSellingRound.java =================================================================== --- trunk/18xx/rails/game/ShareSellingRound.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/ShareSellingRound.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -366,6 +366,7 @@ price = sellPrice.getPrice(); sellPrices.put(companyName, sellPrice); } + int cashAmount = numberSold * price * shareUnits; moveStack.start(true).linkToPreviousMoveSet(); @@ -375,48 +376,17 @@ company.getShareUnit(), numberSold * company.getShareUnit(), companyName, - Bank.format(numberSold * price) )); + Bank.format(cashAmount) )); boolean soldBefore = sellPrices.containsKey(companyName); + + pay (bank, company, cashAmount); adjustSharePrice (company, numberSold, soldBefore); if (!company.isClosed()) { - // Check if the presidency has changed - if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - dumpedPlayer.getName(), - companyName)); - // First swap the certificates - Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); - List<PublicCertificateI> swapped = - portfolio.swapPresidentCertificate(company, dumpedPortfolio); - for (int i = 0; i < presSharesToSell; i++) { - certsToSell.add(swapped.get(i)); - } - } - // Transfer the sold certificates - for (PublicCertificateI cert2 : certsToSell) { - if (cert2 != null) { - executeTradeCertificate (cert2, pool, cert2.getShares() * price); - } - } - - // Check if we still have the presidency - if (currentPlayer == company.getPresident()) { - Player otherPlayer; - for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { - otherPlayer = gameManager.getPlayerByIndex(i); - if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { - portfolio.swapPresidentCertificate(company, - otherPlayer.getPortfolio()); - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - otherPlayer.getName(), - company.getName())); - break; - } - } - } + executeShareTransfer (company, certsToSell, + dumpedPlayer, presSharesToSell); } cashToRaise.add(-numberSold * price); Modified: trunk/18xx/rails/game/StartRound.java =================================================================== --- trunk/18xx/rails/game/StartRound.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/StartRound.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -257,14 +257,15 @@ player.getName(), primary.getName(), Bank.format(price) )); - executeTradeCertificate (primary, player.getPortfolio(), price); + pay (player, bank, price); + transferCertificate (primary, player.getPortfolio()); checksOnBuying(primary, sharePrice); if (item.hasSecondary()) { Certificate extra = item.getSecondary(); ReportBuffer.add(LocalText.getText("ALSO_GETS", player.getName(), extra.getName() )); - executeTradeCertificate (extra, player.getPortfolio(), 0); + transferCertificate (extra, player.getPortfolio()); checksOnBuying(extra, sharePrice); } item.setSold(player, price); Modified: trunk/18xx/rails/game/StockMarket.java =================================================================== --- trunk/18xx/rails/game/StockMarket.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/StockMarket.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -248,6 +248,7 @@ if (newrow > row) { newsquare = getStockSpace(newrow, col); } + /* if (newsquare != oldsquare && newsquare.closesCompany()) { company.setClosed(); oldsquare.removeToken(company); @@ -257,6 +258,10 @@ } else { prepareMove(company, oldsquare, newsquare); } + */ + if (newsquare != oldsquare) { + prepareMove(company, oldsquare, newsquare); + } } protected void moveRightOrUp(PublicCompanyI company) { Modified: trunk/18xx/rails/game/StockRound.java =================================================================== --- trunk/18xx/rails/game/StockRound.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/StockRound.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -1045,6 +1045,7 @@ // Selling price int price = getCurrentSellPrice (company); + int cashAmount = numberSold * price * shareUnits; // Save original price as it may be reused in subsequent sale actions in the same turn boolean soldBefore = sellPrices.containsKey(companyName); @@ -1059,7 +1060,7 @@ playerName, company.getShareUnit() * shareUnits, companyName, - Bank.format(numberSold * price * shareUnits) )); + Bank.format(cashAmount) )); } else { ReportBuffer.add(LocalText.getText("SELL_SHARES_LOG", playerName, @@ -1067,51 +1068,16 @@ company.getShareUnit() * shareUnits, numberSold * company.getShareUnit() * shareUnits, companyName, - Bank.format(numberSold * price * shareUnits) )); + Bank.format(cashAmount) )); } + pay (bank, currentPlayer, cashAmount); adjustSharePrice (company, numberSold, soldBefore); if (!company.isClosed()) { - // Check if the presidency has changed - if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - dumpedPlayer.getName(), - companyName )); - // First swap the certificates - Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); - List<PublicCertificateI> swapped = - portfolio.swapPresidentCertificate(company, dumpedPortfolio); - for (int i = 0; i < presSharesToSell; i++) { - certsToSell.add(swapped.get(i)); - } - } - - // Transfer the sold certificates - Iterator<PublicCertificateI> it = certsToSell.iterator(); - while (it.hasNext()) { - cert = it.next(); - if (cert != null) { - executeTradeCertificate(cert, pool, cert.getShares() * price); - } - } - - // Check if we still have the presidency - if (currentPlayer == company.getPresident()) { - Player otherPlayer; - for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { - otherPlayer = gameManager.getPlayerByIndex(i); - if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { - portfolio.swapPresidentCertificate(company, - otherPlayer.getPortfolio()); - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - otherPlayer.getName(), - company.getName() )); - break; - } - } - } + executeShareTransfer (company, certsToSell, + dumpedPlayer, presSharesToSell); } // Remember that the player has sold this company this round. @@ -1125,6 +1091,46 @@ return true; } + protected void executeShareTransfer (PublicCompanyI company, + List<PublicCertificateI> certsToSell, + Player dumpedPlayer, int presSharesToSell) { + + Portfolio portfolio = currentPlayer.getPortfolio(); + + // Check if the presidency has changed + if (dumpedPlayer != null && presSharesToSell > 0) { + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + dumpedPlayer.getName(), + company.getName() )); + // First swap the certificates + Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); + List<PublicCertificateI> swapped = + portfolio.swapPresidentCertificate(company, dumpedPortfolio); + for (int i = 0; i < presSharesToSell; i++) { + certsToSell.add(swapped.get(i)); + } + } + + transferCertificates (certsToSell, pool); + + // Check if we still have the presidency + if (currentPlayer == company.getPresident()) { + Player otherPlayer; + int currentIndex = getCurrentPlayerIndex(); + for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { + otherPlayer = gameManager.getPlayerByIndex(i); + if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { + portfolio.swapPresidentCertificate(company, + otherPlayer.getPortfolio()); + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + otherPlayer.getName(), + company.getName() )); + break; + } + } + } + } + protected int getCurrentSellPrice (PublicCompanyI company) { String companyName = company.getName(); @@ -1143,9 +1149,22 @@ protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { - if (company.canSharePriceVary()) { - stockMarket.sell(company, numberSold); + if (!company.canSharePriceVary()) return; + + stockMarket.sell(company, numberSold); + + StockSpaceI newSpace = company.getCurrentSpace(); + + if (newSpace.closesCompany() && company.canClose()) { + company.setClosed(); + ReportBuffer.add(LocalText.getText("CompanyClosesAt", + company.getName(), + newSpace.getName())); + return; } + + // Company is still open + } public boolean useSpecialProperty(UseSpecialProperty action) { Modified: trunk/18xx/rails/game/TreasuryShareRound.java =================================================================== --- trunk/18xx/rails/game/TreasuryShareRound.java 2010-09-10 16:30:21 UTC (rev 1418) +++ trunk/18xx/rails/game/TreasuryShareRound.java 2010-09-10 21:57:19 UTC (rev 1419) @@ -338,6 +338,8 @@ return false; } + int cashAmount = shares * price; + // All seems OK, now buy the shares. if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", @@ -345,7 +347,7 @@ shareUnit, companyName, from.getName(), - Bank.format(shares * price) )); + Bank.format(cashAmount) )); } else { ReportBuffer.add(LocalText.getText("BUY_SHARES_LOG", companyName, @@ -354,14 +356,16 @@ number * shareUnit, companyName, from.getName(), - Bank.format(shares * price) )); + Bank.format(cashAmount) )); } moveStack.start(true); + + pay (company, bank, cashAmount); PublicCertificateI cert2; for (int i = 0; i < number; i++) { cert2 = from.findCertificate(company, sharePerCert/shareUnit, false); - executeTradeCertificate(cert2, portfolio, cert2.getShares() * price); + transferCertificate(cert2, portfolio); } hasBought.set(true); @@ -481,20 +485,25 @@ moveStack.start(true); + int cashAmount = numberSold * price; ReportBuffer.add(LocalText.getText("SELL_SHARES_LOG", companyName, numberSold, company.getShareUnit(), (numberSold * company.getShareUnit()), companyName, - Bank.format(numberSold * price) )); + Bank.format(cashAmount) )); + pay (bank, company, cashAmount); // Transfer the sold certificates + transferCertificates (certsToSell, pool); + /* for (PublicCertificateI cert2 : certsToSell) { if (cert2 != null) { - executeTradeCertificate (cert2, pool, cert2.getShares() * price); + transferCertificate (cert2, pool, cert2.getShares() * price); } } + */ stockMarket.sell(company, numberSold); hasSold.set(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-10 16:30:27
|
Revision: 1418 http://rails.svn.sourceforge.net/rails/?rev=1418&view=rev Author: stefanfrey Date: 2010-09-10 16:30:21 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Removed check for special tile lay, that the new tile should be allowed in the current phase (breaks existing game files) Modified Paths: -------------- trunk/18xx/rails/game/OperatingRound.java Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2010-09-08 21:42:53 UTC (rev 1417) +++ trunk/18xx/rails/game/OperatingRound.java 2010-09-10 16:30:21 UTC (rev 1418) @@ -1339,9 +1339,11 @@ if (!operatingCompany.get().canUseSpecialProperties()) return; for (SpecialTileLay stl : getSpecialProperties(SpecialTileLay.class)) { - if (getCurrentPhase().isTileColourAllowed(stl.getTile().getColourName()) + if ( +// stl.getTile() != null && getCurrentPhase().isTileColourAllowed(stl.getTile().getColourName()) && // if a tile is specified it must have a tile colour currently available - && (stl.isExtra() || !currentNormalTileLays.isEmpty())) { + // commented out as it is not required and makes 1856 save files invalid + (stl.isExtra() || !currentNormalTileLays.isEmpty())) { // If the special tile lay is not extra, it is only allowed if // normal tile lays are also (still) allowed currentSpecialTileLays.add(new LayTile(stl)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-08 21:42:59
|
Revision: 1417 http://rails.svn.sourceforge.net/rails/?rev=1417&view=rev Author: stefanfrey Date: 2010-09-08 21:42:53 +0000 (Wed, 08 Sep 2010) Log Message: ----------- Fixed problem with import functionality in configuration UI Modified Paths: -------------- trunk/18xx/rails/ui/swing/ConfigWindow.java trunk/18xx/rails/util/Config.java Modified: trunk/18xx/rails/ui/swing/ConfigWindow.java =================================================================== --- trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-09-08 21:41:33 UTC (rev 1416) +++ trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-09-08 21:42:53 UTC (rev 1417) @@ -535,7 +535,7 @@ { File file = fc.getSelectedFile(); if (Config.importProfileFromFile(file)) { - changeProfile(Config.getActiveProfileName()); + repaintLater(); } else { JOptionPane.showMessageDialog(ConfigWindow.this, LocalText.getText("CONFIG_LOAD_ERROR_MESSAGE", Config.getActiveProfileName()), LocalText.getText("CONFIG_LOAD_TITLE"), JOptionPane.ERROR_MESSAGE); @@ -545,6 +545,10 @@ private void changeProfile(String profileName) { Config.changeActiveProfile(profileName); + repaintLater(); + } + + private void repaintLater() { EventQueue.invokeLater(new Runnable() { public void run() { init(); Modified: trunk/18xx/rails/util/Config.java =================================================================== --- trunk/18xx/rails/util/Config.java 2010-09-08 21:41:33 UTC (rev 1416) +++ trunk/18xx/rails/util/Config.java 2010-09-08 21:42:53 UTC (rev 1417) @@ -441,7 +441,7 @@ * loads an external user profile * defined by the filepath */ - public static boolean importProfileFromFile(File file) { + public static boolean loadProfileFromFile(File file) { String filepath = file.getPath(); if (loadPropertyFile(userProperties, filepath, false)) { String profile = userProperties.getProperty(PROFILENAME_PROPERTY); @@ -449,7 +449,7 @@ profile = STANDARD_PROFILE_SELECTION; } selectedProfile = profile; -// setActiveFilepath(filepath); // do not set filepath on import + setActiveFilepath(filepath); // do not set filepath on import loadDefaultProfile(); setSaveDirDefaults(); return true; @@ -457,6 +457,22 @@ 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; + } + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-08 21:41:40
|
Revision: 1416 http://rails.svn.sourceforge.net/rails/?rev=1416&view=rev Author: stefanfrey Date: 2010-09-08 21:41:33 +0000 (Wed, 08 Sep 2010) Log Message: ----------- Issues: a) In 1889 the port tile can be laid on a hex already containing a yellow broad curve town tile. b) In 18AL the lumberjack tile can be laid on a hex already containig a yellow broad curve tile. c) In 1830 the D&H allows upgrading to green tiles. Possible Solution: - Special tile lays always increase tile colour number. - Special tile lays always check the allowed tile colour of the current phase. - Add tile="57" to D&H special property Modified Paths: -------------- trunk/18xx/data/1830/CompanyManager.xml trunk/18xx/rails/game/OperatingRound.java trunk/18xx/rails/ui/swing/UpgradesPanel.java Modified: trunk/18xx/data/1830/CompanyManager.xml =================================================================== --- trunk/18xx/data/1830/CompanyManager.xml 2010-09-07 19:42:01 UTC (rev 1415) +++ trunk/18xx/data/1830/CompanyManager.xml 2010-09-08 21:41:33 UTC (rev 1416) @@ -39,7 +39,7 @@ <Blocking hex="F16"/> <SpecialProperties> <SpecialProperty condition="ifOwnedByCompany" when="tileLayingStep" class="rails.game.special.SpecialTileLay"> - <SpecialTileLay location="F16" extra="no" free="no"/> + <SpecialTileLay location="F16" extra="no" free="no" tile="57" /> </SpecialProperty> <SpecialProperty condition="ifOwnedByCompany" when="tokenLayingStep" class="rails.game.special.SpecialTokenLay"> <SpecialTokenLay location="F16" extra="no" free="yes"/> Modified: trunk/18xx/rails/game/OperatingRound.java =================================================================== --- trunk/18xx/rails/game/OperatingRound.java 2010-09-07 19:42:01 UTC (rev 1415) +++ trunk/18xx/rails/game/OperatingRound.java 2010-09-08 21:41:33 UTC (rev 1416) @@ -1339,11 +1339,11 @@ if (!operatingCompany.get().canUseSpecialProperties()) return; for (SpecialTileLay stl : getSpecialProperties(SpecialTileLay.class)) { - if (stl.isExtra() || !currentNormalTileLays.isEmpty()) { - /* - * If the special tile lay is not extra, it is only allowed if - * normal tile lays are also (still) allowed - */ + if (getCurrentPhase().isTileColourAllowed(stl.getTile().getColourName()) + // if a tile is specified it must have a tile colour currently available + && (stl.isExtra() || !currentNormalTileLays.isEmpty())) { + // If the special tile lay is not extra, it is only allowed if + // normal tile lays are also (still) allowed currentSpecialTileLays.add(new LayTile(stl)); } } Modified: trunk/18xx/rails/ui/swing/UpgradesPanel.java =================================================================== --- trunk/18xx/rails/ui/swing/UpgradesPanel.java 2010-09-07 19:42:01 UTC (rev 1415) +++ trunk/18xx/rails/ui/swing/UpgradesPanel.java 2010-09-08 21:41:33 UTC (rev 1416) @@ -100,6 +100,9 @@ } } else { for (TileI tile : tiles) { + // special check: does the tile increase the colour number? + // this avoids that a special tile lay down or equalgrades existing tiles + if (tile.getColourNumber() <= uiHex.getCurrentTile().getColourNumber()) continue; if (!orUIManager.tileUpgrades.contains(tile)) orUIManager.tileUpgrades.add(tile); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-07 19:42:07
|
Revision: 1415 http://rails.svn.sourceforge.net/rails/?rev=1415&view=rev Author: evos Date: 2010-09-07 19:42:01 +0000 (Tue, 07 Sep 2010) Log Message: ----------- Some share selling code reorganisation to allow (later) centralizing of follow-up actions. Modified Paths: -------------- trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/specific/_1856/StockRound_1856.java Modified: trunk/18xx/rails/game/StockRound.java =================================================================== --- trunk/18xx/rails/game/StockRound.java 2010-09-07 19:14:48 UTC (rev 1414) +++ trunk/18xx/rails/game/StockRound.java 2010-09-07 19:42:01 UTC (rev 1415) @@ -1070,7 +1070,6 @@ Bank.format(numberSold * price * shareUnits) )); } - // PROVISIONALLY MOVED UPWARDS adjustSharePrice (company, numberSold, soldBefore); if (!company.isClosed()) { @@ -1097,8 +1096,6 @@ executeTradeCertificate(cert, pool, cert.getShares() * price); } } - // PROVISIONALLY MOVED UPWARDS - //adjustSharePrice (company, numberSold, soldBefore); // Check if we still have the presidency if (currentPlayer == company.getPresident()) { Modified: trunk/18xx/rails/game/specific/_1856/StockRound_1856.java =================================================================== --- trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2010-09-07 19:14:48 UTC (rev 1414) +++ trunk/18xx/rails/game/specific/_1856/StockRound_1856.java 2010-09-07 19:42:01 UTC (rev 1415) @@ -64,24 +64,21 @@ @Override protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { + if (!company.canSharePriceVary()) return; + + int numberOfSpaces = numberSold; if (company instanceof PublicCompany_CGR) { - if (company.canSharePriceVary()) { - int numberOfSpaces; - if (company.getShareUnit() == 5) { - // Take care for selling 5% shares in multiple blocks per turn - numberOfSpaces - = (sharesSoldSoFar.intValue() + numberSold)/2 - - squaresDownSoFar.intValue(); - sharesSoldSoFar.add(numberSold); - squaresDownSoFar.add(numberOfSpaces); - } else { - numberOfSpaces = numberSold; - } - stockMarket.sell(company, numberOfSpaces); + if (company.getShareUnit() == 5) { + // Take care for selling 5% shares in multiple blocks per turn + numberOfSpaces + = (sharesSoldSoFar.intValue() + numberSold)/2 + - squaresDownSoFar.intValue(); + sharesSoldSoFar.add(numberSold); + squaresDownSoFar.add(numberOfSpaces); } - } else { - super.adjustSharePrice (company, numberSold, soldBefore); } + + super.adjustSharePrice (company, numberOfSpaces, soldBefore); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-07 19:14:54
|
Revision: 1414 http://rails.svn.sourceforge.net/rails/?rev=1414&view=rev Author: evos Date: 2010-09-07 19:14:48 +0000 (Tue, 07 Sep 2010) Log Message: ----------- Removed redundant actions (such as presidency swapping) when a company price token reaches a "close" area. Modified Paths: -------------- trunk/18xx/rails/game/ShareSellingRound.java trunk/18xx/rails/game/StockRound.java Modified: trunk/18xx/rails/game/ShareSellingRound.java =================================================================== --- trunk/18xx/rails/game/ShareSellingRound.java 2010-09-06 21:20:12 UTC (rev 1413) +++ trunk/18xx/rails/game/ShareSellingRound.java 2010-09-07 19:14:48 UTC (rev 1414) @@ -126,27 +126,27 @@ /* * If the current Player is president, check if he can dump the * presidency onto someone else - * + * * Two reasons for the check: * A) President not allowed to sell that company * Thus keep enough shares to stay president - * + * * Example here * share = 60%, other player holds 40%, maxShareToSell > 30% - * => requires selling of president + * => requires selling of president * B) President allowed to sell that company * In that case the president share can be sold - * + * * Example here * share = 60%, , president share = 20%, maxShareToSell > 40% - * => requires selling of president + * => requires selling of president */ if (company.getPresident() == currentPlayer) { int presidentShare = company.getCertificates().get(0).getShare(); boolean dumpPossible; - log.debug("Forced selling check: company = " + company + + log.debug("Forced selling check: company = " + company + ", share = " + share + ", maxShareToSell = " + maxShareToSell); if (company == cashNeedingCompany || !dumpOtherCompaniesAllowed) { // case A: selling of president not allowed (either company triggered share selling or no dump of others) @@ -377,43 +377,46 @@ companyName, Bank.format(numberSold * price) )); - // Check if the presidency has changed - if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - dumpedPlayer.getName(), - companyName)); - // First swap the certificates - Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); - List<PublicCertificateI> swapped = - portfolio.swapPresidentCertificate(company, dumpedPortfolio); - for (int i = 0; i < presSharesToSell; i++) { - certsToSell.add(swapped.get(i)); - } - } - - // Transfer the sold certificates - for (PublicCertificateI cert2 : certsToSell) { - if (cert2 != null) { - executeTradeCertificate (cert2, pool, cert2.getShares() * price); - } - } boolean soldBefore = sellPrices.containsKey(companyName); adjustSharePrice (company, numberSold, soldBefore); - // Check if we still have the presidency - if (currentPlayer == company.getPresident()) { - Player otherPlayer; - for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { - otherPlayer = gameManager.getPlayerByIndex(i); - if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { - portfolio.swapPresidentCertificate(company, - otherPlayer.getPortfolio()); - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - otherPlayer.getName(), - company.getName())); - break; - } - } + if (!company.isClosed()) { + // Check if the presidency has changed + if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + dumpedPlayer.getName(), + companyName)); + // First swap the certificates + Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); + List<PublicCertificateI> swapped = + portfolio.swapPresidentCertificate(company, dumpedPortfolio); + for (int i = 0; i < presSharesToSell; i++) { + certsToSell.add(swapped.get(i)); + } + } + + // Transfer the sold certificates + for (PublicCertificateI cert2 : certsToSell) { + if (cert2 != null) { + executeTradeCertificate (cert2, pool, cert2.getShares() * price); + } + } + + // Check if we still have the presidency + if (currentPlayer == company.getPresident()) { + Player otherPlayer; + for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { + otherPlayer = gameManager.getPlayerByIndex(i); + if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { + portfolio.swapPresidentCertificate(company, + otherPlayer.getPortfolio()); + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + otherPlayer.getName(), + company.getName())); + break; + } + } + } } cashToRaise.add(-numberSold * price); Modified: trunk/18xx/rails/game/StockRound.java =================================================================== --- trunk/18xx/rails/game/StockRound.java 2010-09-06 21:20:12 UTC (rev 1413) +++ trunk/18xx/rails/game/StockRound.java 2010-09-07 19:14:48 UTC (rev 1414) @@ -417,8 +417,8 @@ * original price is still valid */ price = getCurrentSellPrice(company); - - // removed as this is done in getCurrentSellPrice + + // removed as this is done in getCurrentSellPrice // price /= company.getShareUnitsForSharePrice(); /* Allow for different share units (as in 1835) */ @@ -1070,44 +1070,51 @@ Bank.format(numberSold * price * shareUnits) )); } - // Check if the presidency has changed - if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - dumpedPlayer.getName(), - companyName )); - // First swap the certificates - Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); - List<PublicCertificateI> swapped = - portfolio.swapPresidentCertificate(company, dumpedPortfolio); - for (int i = 0; i < presSharesToSell; i++) { - certsToSell.add(swapped.get(i)); - } - } + // PROVISIONALLY MOVED UPWARDS + adjustSharePrice (company, numberSold, soldBefore); - // Transfer the sold certificates - Iterator<PublicCertificateI> it = certsToSell.iterator(); - while (it.hasNext()) { - cert = it.next(); - if (cert != null) { - executeTradeCertificate(cert, pool, cert.getShares() * price); + if (!company.isClosed()) { + + // Check if the presidency has changed + if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + dumpedPlayer.getName(), + companyName )); + // First swap the certificates + Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); + List<PublicCertificateI> swapped = + portfolio.swapPresidentCertificate(company, dumpedPortfolio); + for (int i = 0; i < presSharesToSell; i++) { + certsToSell.add(swapped.get(i)); + } } - } - adjustSharePrice (company, numberSold, soldBefore); - // Check if we still have the presidency - if (currentPlayer == company.getPresident()) { - Player otherPlayer; - for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { - otherPlayer = gameManager.getPlayerByIndex(i); - if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { - portfolio.swapPresidentCertificate(company, - otherPlayer.getPortfolio()); - ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", - otherPlayer.getName(), - company.getName() )); - break; - } - } + // Transfer the sold certificates + Iterator<PublicCertificateI> it = certsToSell.iterator(); + while (it.hasNext()) { + cert = it.next(); + if (cert != null) { + executeTradeCertificate(cert, pool, cert.getShares() * price); + } + } + // PROVISIONALLY MOVED UPWARDS + //adjustSharePrice (company, numberSold, soldBefore); + + // Check if we still have the presidency + if (currentPlayer == company.getPresident()) { + Player otherPlayer; + for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { + otherPlayer = gameManager.getPlayerByIndex(i); + if (otherPlayer.getPortfolio().getShare(company) > portfolio.getShare(company)) { + portfolio.swapPresidentCertificate(company, + otherPlayer.getPortfolio()); + ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", + otherPlayer.getName(), + company.getName() )); + break; + } + } + } } // Remember that the player has sold this company this round. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-09-06 21:20:18
|
Revision: 1413 http://rails.svn.sourceforge.net/rails/?rev=1413&view=rev Author: stefanfrey Date: 2010-09-06 21:20:12 +0000 (Mon, 06 Sep 2010) Log Message: ----------- Fixed several bugs on 1835: - Tile 213 update: fixed - Pr funding money not given : fixed, (was missing and see TODO 1) - PR formation round acts as a stock round (side effect: price increase, wrong round names): fixed (removed call to super.finishRound()) - Undo inside PR formation round creates weird states: fixed (changed to linked moveSets) - Nationalisation does not check certificate limits before action (post-action check was ok): fixed (missing check) - Nationalisation prevents selling of stocks: fixed (removed self-nationalize) - Pr 5% shares only 1/4 of value, 10% shares only 1/2 of value(report window, executed correctly): fixed (fixed currentSellPrice, see TODO 2 and 3, adjusted output) - Closing of OBB not possible: fixed TODO: 1) Implement SharePriceUnits everywhere it is appropriate (e.g. Round method floating()) 2) SellPrices is not a stateful map (=> undo side effects!) 3) Selling PR president is shown as selling two 5 percent shares (which might be correct) but selling those creates all kind of crazy effects Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/data/1835/CompanyManager.xml trunk/18xx/data/1835/TileSet.xml trunk/18xx/rails/game/StockRound.java trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java trunk/18xx/rails/game/specific/_1835/StockRound_1835.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/LocalisedText.properties 2010-09-06 21:20:12 UTC (rev 1413) @@ -239,6 +239,7 @@ END_SR=\nAll 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 ENTER_PRICE_OR_CANCEL=Enter a valid price or hit Cancel ERROR=Error EXCHANGED=exchanged Modified: trunk/18xx/data/1835/CompanyManager.xml =================================================================== --- trunk/18xx/data/1835/CompanyManager.xml 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/data/1835/CompanyManager.xml 2010-09-06 21:20:12 UTC (rev 1413) @@ -55,6 +55,7 @@ <ClosingConditions> <Phase>5</Phase> <SpecialProperties condition="ifAllExercised"/> + <CloseManually/> <!-- If second tile is laid not via special property --> </ClosingConditions> </Company> <Company name="PfB" longname="Pfalzbahnen" type="Private" basePrice="150" revenue="15"> Modified: trunk/18xx/data/1835/TileSet.xml =================================================================== --- trunk/18xx/data/1835/TileSet.xml 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/data/1835/TileSet.xml 2010-09-06 21:20:12 UTC (rev 1413) @@ -165,7 +165,7 @@ <Upgrade id="218"/> </Tile> <Tile id="213" quantity="1"> - <Upgrade id="218"/> + <Upgrade id="219"/> </Tile> <Tile id="214" quantity="1"> <Upgrade id="219"/> Modified: trunk/18xx/rails/game/StockRound.java =================================================================== --- trunk/18xx/rails/game/StockRound.java 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/rails/game/StockRound.java 2010-09-06 21:20:12 UTC (rev 1413) @@ -417,7 +417,9 @@ * original price is still valid */ price = getCurrentSellPrice(company); - price /= company.getShareUnitsForSharePrice(); + + // removed as this is done in getCurrentSellPrice + // price /= company.getShareUnitsForSharePrice(); /* Allow for different share units (as in 1835) */ for (int i = 1; i <= 4; i++) { @@ -802,7 +804,7 @@ if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", playerName, - shareUnit, + share, companyName, from.getName(), Bank.format(cost) )); @@ -810,8 +812,8 @@ ReportBuffer.add(LocalText.getText("BUY_SHARES_LOG", playerName, number, - shareUnit, - number * shareUnit, + share, + shares, companyName, from.getName(), Bank.format(cost) )); @@ -1055,17 +1057,17 @@ if (numberSold == 1) { ReportBuffer.add(LocalText.getText("SELL_SHARE_LOG", playerName, - company.getShareUnit(), + company.getShareUnit() * shareUnits, companyName, - Bank.format(numberSold * price) )); + Bank.format(numberSold * price * shareUnits) )); } else { ReportBuffer.add(LocalText.getText("SELL_SHARES_LOG", playerName, numberSold, - company.getShareUnit(), - numberSold * company.getShareUnit(), + company.getShareUnit() * shareUnits, + numberSold * company.getShareUnit() * shareUnits, companyName, - Bank.format(numberSold * price) )); + Bank.format(numberSold * price * shareUnits) )); } // Check if the presidency has changed @@ -1128,8 +1130,10 @@ && GameOption.convertValueToBoolean(getGameOption("SeparateSalesAtSamePrice"))) { price = (sellPrices.get(companyName)).getPrice(); } else { - price = company.getCurrentSpace().getPrice() / company.getShareUnitsForSharePrice(); + price = company.getCurrentSpace().getPrice(); } + // stored price is the previous unadjusted price + price = price / company.getShareUnitsForSharePrice(); return price; } Modified: trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java =================================================================== --- trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/rails/game/specific/_1835/PrussianFormationRound.java 2010-09-06 21:20:12 UTC (rev 1413) @@ -229,7 +229,8 @@ return false; } - moveStack.start(false); + // all actions linked during formation round to avoid serious undo problems + moveStack.start(false).linkToPreviousMoveSet(); if (folding) executeStartPrussian(false); @@ -246,6 +247,21 @@ ReportBuffer.add(message); if (display) DisplayBuffer.add(message); + // add money from sold shares + // Move cash and shares where required + int capFactor = getSoldPercentage(prussian) / (prussian.getShareUnit() * prussian.getShareUnitsForSharePrice()); + int cash = capFactor * prussian.getIPOPrice(); + + if (cash > 0) { + new CashMove(bank, prussian, cash); + ReportBuffer.add(LocalText.getText("FloatsWithCash", + prussian.getName(), + Bank.format(cash) )); + } else { + ReportBuffer.add(LocalText.getText("Floats", + prussian.getName())); + } + executeExchange (Arrays.asList(new CompanyI[]{m2}), true, false); prussian.setFloated(); } @@ -271,7 +287,8 @@ return false; } - moveStack.start(false); + // all actions linked during formation round to avoid serious undo problems + moveStack.start(false).linkToPreviousMoveSet(); // Execute if (folding) executeExchange (folded, false, false); @@ -415,9 +432,19 @@ @Override protected void finishRound() { + RoundI interruptedRound = gameManager.getInterruptedRound(); + if (interruptedRound != null) { + ReportBuffer.add(LocalText.getText("EndOfFormationRound", PR_ID, + interruptedRound.getRoundName())); + } else { + ReportBuffer.add(LocalText.getText("EndOfFormationRoundNoInterrupt", PR_ID)); + } + if (prussian.hasStarted()) prussian.checkPresidency(); prussian.setOperated(); // To allow immediate share selling - super.finishRound(); + // super.finishRound(); + // Inform GameManager + gameManager.nextRound(this); } public static boolean prussianIsComplete(GameManagerI gameManager) { Modified: trunk/18xx/rails/game/specific/_1835/StockRound_1835.java =================================================================== --- trunk/18xx/rails/game/specific/_1835/StockRound_1835.java 2010-09-06 17:39:47 UTC (rev 1412) +++ trunk/18xx/rails/game/specific/_1835/StockRound_1835.java 2010-09-06 21:20:12 UTC (rev 1413) @@ -45,8 +45,13 @@ otherPlayers.clear(); for (PublicCertificateI cert : company.getCertificates()) { holder = (Portfolio)cert.getHolder(); - owner = holder.getOwner(); - if (owner instanceof Player) { + owner = holder.getOwner(); + /* Would the player exceed the total certificate limit? */ + StockSpaceI stockSpace = company.getCurrentSpace(); + if ((stockSpace == null || !stockSpace.isNoCertLimit()) && !mayPlayerBuyCertificate( + currentPlayer, company, cert.getCertificateCount())) continue; + // only nationalize other players + if (owner instanceof Player && owner != currentPlayer) { otherPlayer = (Player) owner; if (!otherPlayers.contains(otherPlayer)) { price = (int)(1.5 * company.getCurrentPriceModel().getPrice().getPrice()); @@ -88,9 +93,11 @@ if (sellPrices.containsKey(companyName)) { price = (sellPrices.get(companyName)).getPrice(); } else { - price = company.getCurrentSpace().getPrice() / company.getShareUnitsForSharePrice(); + price = company.getCurrentSpace().getPrice(); } - return price; + // stored price is the previous unadjusted price + price = price / company.getShareUnitsForSharePrice(); + return price; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2010-09-06 17:39:53
|
Revision: 1412 http://rails.svn.sourceforge.net/rails/?rev=1412&view=rev Author: evos Date: 2010-09-06 17:39:47 +0000 (Mon, 06 Sep 2010) Log Message: ----------- Fix: closing company (1856) to transfer trains and cash Modified Paths: -------------- trunk/18xx/rails/game/PublicCompany.java Modified: trunk/18xx/rails/game/PublicCompany.java =================================================================== --- trunk/18xx/rails/game/PublicCompany.java 2010-08-28 18:52:52 UTC (rev 1411) +++ trunk/18xx/rails/game/PublicCompany.java 2010-09-06 17:39:47 UTC (rev 1412) @@ -1017,6 +1017,13 @@ } } + // Any trains go to the pool (from the 1856 rules) + Util.moveObjects(portfolio.getTrainList(), bank.getPool()); + + // Any cash goes to the bank (from the 1856 rules) + int cash = treasury.getCash(); + if (cash > 0) new CashMove (this, bank, cash); + lastRevenue.setOption(MoneyModel.SUPPRESS_ZERO); setLastRevenue(0); treasury.setOption(CashModel.SUPPRESS_ZERO); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wak...@us...> - 2010-08-28 18:52:59
|
Revision: 1411 http://rails.svn.sourceforge.net/rails/?rev=1411&view=rev Author: wakko666 Date: 2010-08-28 18:52:52 +0000 (Sat, 28 Aug 2010) Log Message: ----------- Remove some old code from branches from the conversion from CVS. Added Paths: ----------- .project Removed Paths: ------------- branches/game/ Added: .project =================================================================== --- .project (rev 0) +++ .project 2010-08-28 18:52:52 UTC (rev 1411) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>rails</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + </buildSpec> + <natures> + </natures> +</projectDescription> Property changes on: .project ___________________________________________________________________ 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: <wak...@us...> - 2010-08-28 17:56:08
|
Revision: 1410 http://rails.svn.sourceforge.net/rails/?rev=1410&view=rev Author: wakko666 Date: 2010-08-28 17:56:01 +0000 (Sat, 28 Aug 2010) Log Message: ----------- Added Paths: ----------- tags/rails_1_4/ tags/rails_1_4/build.xml tags/rails_1_4/rails/game/Game.java tags/rails_1_4/rails.bat tags/rails_1_4/rails.sh Removed Paths: ------------- tags/rails_1_4/build.xml tags/rails_1_4/rails/game/Game.java tags/rails_1_4/rails.bat tags/rails_1_4/rails.sh Deleted: tags/rails_1_4/build.xml =================================================================== --- trunk/18xx/build.xml 2010-08-28 17:08:52 UTC (rev 1408) +++ tags/rails_1_4/build.xml 2010-08-28 17:56:01 UTC (rev 1410) @@ -1,160 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- WARNING: Eclipse auto-generated file. - Any modifications will be overwritten. - To include a user specific buildfile here, simply create one in the same - directory with the processing instruction <?eclipse.ant.import?> - as the first entry and export the buildfile again. --> -<project basedir="." default="build" name="18xx"> - <property environment="env"/> - <property name="debuglevel" value="source,lines,vars"/> - <property name="target" value="1.5"/> - <property name="source" value="1.5"/> - <property name="version" value="1.3"/> - <taskdef name="jarbundler" - classpath="tools/lib/jarbundler-2.1.0.jar" - classname="net.sourceforge.jarbundler.JarBundler" /> - <path id="18xx.classpath"> - <pathelement location="classes"/> - <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> - <pathelement location="lib/batik-1.6/batik-rasterizer.jar"/> - <pathelement location="lib/batik-1.6/batik.jar"/> - <pathelement location="lib/jgraph5/jgraph.jar"/> - <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> - <pathelement location="lib/junit_3.8.2/junit.jar"/> - </path> - <target depends="clean" name="init"> - <mkdir dir="classes"/> - <copy includeemptydirs="false" todir="classes"> - <fileset dir="."> - <exclude name="**/*.launch"/> - <exclude name="**/*.java"/> - <exclude name="tools/**"/> - <exclude name="images/**"/> - </fileset> - </copy> - </target> - <target name="clean"> - <delete dir="classes"/> - <delete dir="jar"/> - </target> - <target depends="clean" name="cleanall"> - <delete dir="rails-${version}"/> - <delete dir="rails-mac-${version}"/> - <delete file="18xx.log"/> - </target> - <target depends="build-subprojects,build-project,build-release" name="build"/> - <target name="build-subprojects"/> - <target depends="init" name="build-project"> - <echo message="${ant.project.name}: ${ant.file}"/> - <javac debug="true" debuglevel="${debuglevel}" destdir="classes" source="${source}" target="${target}"> - <src path="."/> - <classpath refid="18xx.classpath"/> - </javac> - </target> - <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> - <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> - <copy todir="${ant.library.dir}"> - <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> - </copy> - <unzip dest="${ant.library.dir}"> - <patternset includes="jdtCompilerAdapter.jar"/> - <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> - </unzip> - </target> - <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> - <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> - <antcall target="build"/> - </target> - <target name="build-release"> - <mkdir dir="jar"/> - <copy includeemptydirs="false" todir="jar"> - <fileset dir="classes"> - <exclude name="**/*.launch"/> - <exclude name="**/*.java"/> - <exclude name="rails/test/*"/> - <exclude name="18xx.log"/> - <exclude name="build.xml"/> - <exclude name="buildinfo.xml"/> - <exclude name="manifest"/> - <exclude name="doc/*"/> - <exclude name="html/*"/> - <exclude name="lib/**"/> - <exclude name="rails-${version}/**"/> - <exclude name="rails-*-${version}/**"/> - <exclude name="rails.bat"/> - <exclude name="rails.sh"/> - <exclude name=".project"/> - <exclude name=".classpath"/> - <exclude name="**/CVS/*"/> - <exclude name="**/.settings/*"/> - <exclude name="**/rails-${version}.jar"/> - </fileset> - </copy> - <mkdir dir="rails-${version}"/> - <copy includeemptydirs="false" todir="rails-${version}"> - <fileset dir="."> - <include name="LICENSE"/> - <include name="README"/> - <include name="AUTHORS"/> - <include name="rails.bat"/> - <include name="rails.sh"/> - <include name="my.properties"/> - <include name="LocalisedText.properties"/> - <include name="games.properties"/> - <include name="lib/**"/> - </fileset> - </copy> - <jar destfile="rails-${version}/rails-${version}.jar" basedir="jar" duplicate="preserve"> - <manifest> - <attribute name="Main-Class" value="rails.util.RunGame" /> - <attribute name="Class-Path" value="./my.properties ./LocalisedText.properties ./lib/log4j-1.2/log4j-1.2.14.jar ./lib/batik-1.6/lib/batik-transcoder.jar ./lib/batik-1.6/batik.jar ./lib/batik-1.6/lib/batik-util.jar ./lib/batik-1.6/lib/batik-script.jar ./lib/batik-1.6/lib/batik-bridge.jar ./lib/batik-1.6/lib/batik-ext.jar ./lib/batik-1.6/lib/batik-awt-util.jar ./lib/batik-1.6/lib/batik-dom.jar ./lib/batik-1.6/lib/batik-gvt.jar ./lib/jgraph5/jgraph.jar ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> - </manifest> - </jar> - </target> - <target name="build-mac"> - <mkdir dir="rails-mac-${version}" /> - <copy includeemptydirs="false" todir="rails-mac-${version}"> - <fileset dir="."> - <include name="LICENSE"/> - <include name="README"/> - <include name="AUTHORS"/> - <include name="my.properties"/> - </fileset> - </copy> - <jarbundler dir="rails-mac-${version}" - name="Rails" - mainclass="rails.util.RunGame" - icon="images/icon/rails.icns" - version="${version}"> - <jarfileset dir="rails-${version}"> - <include name="rails-${version}.jar"/> - <include name="lib/**"/> - </jarfileset> - <javaproperty name="apple.laf.useScreenMenuBar" value="true"/> - </jarbundler> - </target> - <target name="RunGame"> - <java classname="rails.util.RunGame" failonerror="true" fork="yes"> - <classpath refid="18xx.classpath"/> - </java> - </target> - <target name="TestGames"> - <property name="test.xml.dir" value="test/xml"/> - <property name="test.report.dir" value="test/report"/> - <mkdir dir="${test.xml.dir}"/> - <mkdir dir="${test.report.dir}"/> - <junit> - <classpath refid="18xx.classpath"/> - <formatter type="brief" usefile="false" /> - <formatter type="xml" /> - <test name ="test.TestGameBuilder" todir="${test.xml.dir}"/> - </junit> - <junitreport todir="${test.xml.dir}"> - <fileset dir="${test.xml.dir}"> - <include name="TEST-*.xml"/> - </fileset> - <report format="noframes" todir="${test.report.dir}"/> - </junitreport> - </target> - -</project> Copied: tags/rails_1_4/build.xml (from rev 1409, trunk/18xx/build.xml) =================================================================== --- tags/rails_1_4/build.xml (rev 0) +++ tags/rails_1_4/build.xml 2010-08-28 17:56:01 UTC (rev 1410) @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- WARNING: Eclipse auto-generated file. + Any modifications will be overwritten. + To include a user specific buildfile here, simply create one in the same + directory with the processing instruction <?eclipse.ant.import?> + as the first entry and export the buildfile again. --> +<project basedir="." default="build" name="18xx"> + <property environment="env"/> + <property name="debuglevel" value="source,lines,vars"/> + <property name="target" value="1.5"/> + <property name="source" value="1.5"/> + <property name="version" value="1.4"/> + <taskdef name="jarbundler" + classpath="tools/lib/jarbundler-2.1.0.jar" + classname="net.sourceforge.jarbundler.JarBundler" /> + <path id="18xx.classpath"> + <pathelement location="classes"/> + <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> + <pathelement location="lib/batik-1.6/batik-rasterizer.jar"/> + <pathelement location="lib/batik-1.6/batik.jar"/> + <pathelement location="lib/jgraph5/jgraph.jar"/> + <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> + <pathelement location="lib/junit_3.8.2/junit.jar"/> + </path> + <target depends="clean" name="init"> + <mkdir dir="classes"/> + <copy includeemptydirs="false" todir="classes"> + <fileset dir="."> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="tools/**"/> + <exclude name="images/**"/> + </fileset> + </copy> + </target> + <target name="clean"> + <delete dir="classes"/> + <delete dir="jar"/> + </target> + <target depends="clean" name="cleanall"> + <delete dir="rails-${version}"/> + <delete dir="rails-mac-${version}"/> + <delete file="18xx.log"/> + </target> + <target depends="build-subprojects,build-project,build-release" name="build"/> + <target name="build-subprojects"/> + <target depends="init" name="build-project"> + <echo message="${ant.project.name}: ${ant.file}"/> + <javac debug="true" debuglevel="${debuglevel}" destdir="classes" source="${source}" target="${target}"> + <src path="."/> + <classpath refid="18xx.classpath"/> + </javac> + </target> + <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> + <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> + <copy todir="${ant.library.dir}"> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </copy> + <unzip dest="${ant.library.dir}"> + <patternset includes="jdtCompilerAdapter.jar"/> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </unzip> + </target> + <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> + <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> + <antcall target="build"/> + </target> + <target name="build-release"> + <mkdir dir="jar"/> + <copy includeemptydirs="false" todir="jar"> + <fileset dir="classes"> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="rails/test/*"/> + <exclude name="18xx.log"/> + <exclude name="build.xml"/> + <exclude name="buildinfo.xml"/> + <exclude name="manifest"/> + <exclude name="doc/*"/> + <exclude name="html/*"/> + <exclude name="lib/**"/> + <exclude name="rails-${version}/**"/> + <exclude name="rails-*-${version}/**"/> + <exclude name="rails.bat"/> + <exclude name="rails.sh"/> + <exclude name=".project"/> + <exclude name=".classpath"/> + <exclude name="**/CVS/*"/> + <exclude name="**/.settings/*"/> + <exclude name="**/rails-${version}.jar"/> + </fileset> + </copy> + <mkdir dir="rails-${version}"/> + <copy includeemptydirs="false" todir="rails-${version}"> + <fileset dir="."> + <include name="LICENSE"/> + <include name="README"/> + <include name="AUTHORS"/> + <include name="rails.bat"/> + <include name="rails.sh"/> + <include name="my.properties"/> + <include name="LocalisedText.properties"/> + <include name="games.properties"/> + <include name="lib/**"/> + </fileset> + </copy> + <jar destfile="rails-${version}/rails-${version}.jar" basedir="jar" duplicate="preserve"> + <manifest> + <attribute name="Main-Class" value="rails.util.RunGame" /> + <attribute name="Class-Path" value="./my.properties ./LocalisedText.properties ./lib/log4j-1.2/log4j-1.2.14.jar ./lib/batik-1.6/lib/batik-transcoder.jar ./lib/batik-1.6/batik.jar ./lib/batik-1.6/lib/batik-util.jar ./lib/batik-1.6/lib/batik-script.jar ./lib/batik-1.6/lib/batik-bridge.jar ./lib/batik-1.6/lib/batik-ext.jar ./lib/batik-1.6/lib/batik-awt-util.jar ./lib/batik-1.6/lib/batik-dom.jar ./lib/batik-1.6/lib/batik-gvt.jar ./lib/jgraph5/jgraph.jar ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + </manifest> + </jar> + </target> + <target name="build-mac"> + <mkdir dir="rails-mac-${version}" /> + <copy includeemptydirs="false" todir="rails-mac-${version}"> + <fileset dir="."> + <include name="LICENSE"/> + <include name="README"/> + <include name="AUTHORS"/> + <include name="my.properties"/> + </fileset> + </copy> + <jarbundler dir="rails-mac-${version}" + name="Rails" + mainclass="rails.util.RunGame" + icon="images/icon/rails.icns" + version="${version}"> + <jarfileset dir="rails-${version}"> + <include name="rails-${version}.jar"/> + <include name="lib/**"/> + </jarfileset> + <javaproperty name="apple.laf.useScreenMenuBar" value="true"/> + </jarbundler> + </target> + <target name="RunGame"> + <java classname="rails.util.RunGame" failonerror="true" fork="yes"> + <classpath refid="18xx.classpath"/> + </java> + </target> + <target name="TestGames"> + <property name="test.xml.dir" value="test/xml"/> + <property name="test.report.dir" value="test/report"/> + <mkdir dir="${test.xml.dir}"/> + <mkdir dir="${test.report.dir}"/> + <junit> + <classpath refid="18xx.classpath"/> + <formatter type="brief" usefile="false" /> + <formatter type="xml" /> + <test name ="test.TestGameBuilder" todir="${test.xml.dir}"/> + </junit> + <junitreport todir="${test.xml.dir}"> + <fileset dir="${test.xml.dir}"> + <include name="TEST-*.xml"/> + </fileset> + <report format="noframes" todir="${test.report.dir}"/> + </junitreport> + </target> + +</project> Deleted: tags/rails_1_4/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2010-08-28 17:08:52 UTC (rev 1408) +++ tags/rails_1_4/rails/game/Game.java 2010-08-28 17:56:01 UTC (rev 1410) @@ -1,339 +0,0 @@ -/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/Game.java,v 1.56 2010/06/06 13:01:00 evos Exp $ */ -package rails.game; - -import java.io.*; -import java.util.*; - -import org.apache.log4j.Logger; - -import rails.algorithms.RevenueManager; -import rails.game.action.PossibleAction; -import rails.game.special.SpecialProperty; -import rails.util.LocalText; -import rails.util.Tag; - -public class Game { - public static final String version = "1.3+"; - - /** The component Manager */ - protected ComponentManager componentManager; - protected GameManager gameManager; - protected CompanyManagerI companyManager; - protected PlayerManager playerManager; - protected PhaseManager phaseManager; - protected TrainManager trainManager; - protected StockMarketI stockMarket; - protected MapManager mapManager; - protected TileManager tileManager; - protected RevenueManager revenueManager; - protected Bank bank; - protected String name; - protected Tag componentManagerTag; - protected static String GAME_XML_FILE = "Game.xml"; - protected List<String> directories = new ArrayList<String>(); - protected Map<String, String> gameOptions; - - protected List<String> players; - - protected static Logger log = - Logger.getLogger(Game.class.getPackage().getName()); - - // The new Game entry point - public Game(String name, List<String> players, Map<String, String> options) { - - this.name = name; - this.gameOptions = options; - - gameOptions.put(GameOption.NUMBER_OF_PLAYERS, - String.valueOf(players.size())); - - for (String playerName : players) { - log.debug("Player: " + playerName); - } - for (String optionName : gameOptions.keySet()) { - log.debug("Option: " + optionName + "=" - + gameOptions.get(optionName)); - } - directories.add("data"); - directories.add("data/" + name); - - this.players = players; - } - - public String start() { - - if (players.size() < playerManager.minPlayers - || players.size() > playerManager.maxPlayers) { - return name+" is not configured to be played with "+players.size()+" players\n" - + "Please enter a valid number of players, or add a <Players> entry to data/"+name+"/Game.xml"; - } - - gameManager.startGame(gameOptions); - return null; - } - - public boolean setup() { - - try { - componentManagerTag = - Tag.findTopTagInFile(GAME_XML_FILE, directories, - ComponentManager.ELEMENT_ID); - if (componentManagerTag == null) { - throw new ConfigurationException( - "No Game XML element found in file " + GAME_XML_FILE); - } - - componentManagerTag.setGameOptions(gameOptions); - componentManager = - ComponentManager.configureInstance(name, componentManagerTag, gameOptions); - - log.info("========== Start of rails.game " + name + " =========="); - log.info("Rails version "+version); - ReportBuffer.add(LocalText.getText("GameIs", name)); - - // set special properties and token static variables - SpecialProperty.init(); - Token.init(); - - // Have the ComponentManager work through the other rails.game files - componentManager.finishPreparation(); - - playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); - if (playerManager == null) { - throw new ConfigurationException( - "No PlayerManager XML element found in file " + GAME_XML_FILE); - } - - bank = (Bank) componentManager.findComponent("Bank"); - if (bank == null) { - throw new ConfigurationException( - "No Bank XML element found in file " + GAME_XML_FILE); - } - - companyManager = - (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); - if (companyManager == null) { - throw new ConfigurationException( - "No CompanyManager XML element found in file " - + GAME_XML_FILE); - } - stockMarket = - (StockMarketI) componentManager.findComponent(StockMarketI.COMPONENT_NAME); - if (stockMarket == null) { - throw new ConfigurationException( - "No StockMarket XML element found in file " - + GAME_XML_FILE); - } - gameManager = - (GameManager) componentManager.findComponent("GameManager"); - if (gameManager == null) { - throw new ConfigurationException( - "No GameManager XML element found in file " - + GAME_XML_FILE); - } - - phaseManager = - (PhaseManager) componentManager.findComponent("PhaseManager"); - if (phaseManager == null) { - throw new ConfigurationException( - "No PhaseManager XML element found in file " - + GAME_XML_FILE); - } - - trainManager = - (TrainManager) componentManager.findComponent("TrainManager"); - if (trainManager == null) { - throw new ConfigurationException( - "No TrainManager XML element found in file " - + GAME_XML_FILE); - } - - mapManager = - (MapManager) componentManager.findComponent("Map"); - if (mapManager == null) { - throw new ConfigurationException( - "No Map XML element found in file " - + GAME_XML_FILE); - } - - tileManager = - (TileManager) componentManager.findComponent("TileManager"); - if (tileManager == null) { - throw new ConfigurationException( - "No TileManager XML element found in file " - + GAME_XML_FILE); - } - - revenueManager = - (RevenueManager) componentManager.findComponent("RevenueManager"); - // revenueManager is optional so far -// if (revenueManager == null) { -// throw new ConfigurationException( -// "No RevenueManager XML element found in file " -// + GAME_XML_FILE); -// } - - /* - * Initialisations that involve relations between components can - * only be done after all XML has been processed. - */ - playerManager.setPlayers(players, bank); - gameManager.init(name, playerManager, companyManager, - phaseManager, trainManager, stockMarket, mapManager, - tileManager, revenueManager, bank); - - companyManager.finishConfiguration(gameManager); - trainManager.finishConfiguration(gameManager); - phaseManager.finishConfiguration(gameManager); - mapManager.finishConfiguration(gameManager); - bank.finishConfiguration(gameManager); - stockMarket.finishConfiguration(gameManager); - tileManager.finishConfiguration(gameManager); - if (revenueManager != null) - revenueManager.finishConfiguration(gameManager); - } catch (Exception e) { - String message = - LocalText.getText("GameSetupFailed", GAME_XML_FILE); - log.fatal(message, e); - System.out.println(e.getMessage()); - e.printStackTrace(); - DisplayBuffer.add(message + ":\n " + e.getMessage()); - return false; - } - - return true; - } - - @SuppressWarnings("unchecked") - public static Game load(String filepath) { - - Game game = null; - - 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(); - 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(); - } - - long versionID = (Long) object; - log.debug("Saved versionID="+versionID+" (object="+object+")"); - long saveFileVersionID = GameManager.saveFileVersionID; - if (versionID != saveFileVersionID) { - throw new Exception("Save version " + versionID - + " is incompatible with current version " - + saveFileVersionID); - } - 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(); - - game = new Game(name, playerNames, selectedGameOptions); - - if (!game.setup()) { - throw new ConfigurationException("Error in setting up " + name); - } - - String startError = game.start(); - if (startError != null) { - DisplayBuffer.add(startError); - return null; - } - GameManagerI gameManager = game.getGameManager(); - int numberOfActions = 0; - - log.debug("Starting to execute loaded actions"); - - 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) { - // Old-style: one List of PossibleActions - List<PossibleAction> executedActions = - (List<PossibleAction>) actionObject; - numberOfActions = executedActions.size(); - for (PossibleAction action : executedActions) { - if (!gameManager.processOnReload(action)) { - log.error ("Load interrupted"); - DisplayBuffer.add(LocalText.getText("LoadInterrupted")); - break; - } - } - } else if (actionObject instanceof PossibleAction) { - // New style: separate PossibleActionsObjects, since Rails 1.3.1 - while (actionObject instanceof PossibleAction) { - numberOfActions++; - if (!gameManager.processOnReload((PossibleAction)actionObject)) { - log.error ("Load interrupted"); - DisplayBuffer.add(LocalText.getText("LoadInterrupted")); - break; - } - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - break; - } - } - } - break; - } - - // load user comments (is the last - 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(); - - game.getGameManager().finishLoading(); - return game; - - } catch (Exception e) { - log.error("Load failed", e); - DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); - } - - return null; - } - - /*----- Getters -----*/ - - public GameManagerI getGameManager() { - return gameManager; - } - -} Copied: tags/rails_1_4/rails/game/Game.java (from rev 1409, trunk/18xx/rails/game/Game.java) =================================================================== --- tags/rails_1_4/rails/game/Game.java (rev 0) +++ tags/rails_1_4/rails/game/Game.java 2010-08-28 17:56:01 UTC (rev 1410) @@ -0,0 +1,339 @@ +/* $Header: /Users/blentz/rails_rcs/cvs/18xx/rails/game/Game.java,v 1.56 2010/06/06 13:01:00 evos Exp $ */ +package rails.game; + +import java.io.*; +import java.util.*; + +import org.apache.log4j.Logger; + +import rails.algorithms.RevenueManager; +import rails.game.action.PossibleAction; +import rails.game.special.SpecialProperty; +import rails.util.LocalText; +import rails.util.Tag; + +public class Game { + public static final String version = "1.4"; + + /** The component Manager */ + protected ComponentManager componentManager; + protected GameManager gameManager; + protected CompanyManagerI companyManager; + protected PlayerManager playerManager; + protected PhaseManager phaseManager; + protected TrainManager trainManager; + protected StockMarketI stockMarket; + protected MapManager mapManager; + protected TileManager tileManager; + protected RevenueManager revenueManager; + protected Bank bank; + protected String name; + protected Tag componentManagerTag; + protected static String GAME_XML_FILE = "Game.xml"; + protected List<String> directories = new ArrayList<String>(); + protected Map<String, String> gameOptions; + + protected List<String> players; + + protected static Logger log = + Logger.getLogger(Game.class.getPackage().getName()); + + // The new Game entry point + public Game(String name, List<String> players, Map<String, String> options) { + + this.name = name; + this.gameOptions = options; + + gameOptions.put(GameOption.NUMBER_OF_PLAYERS, + String.valueOf(players.size())); + + for (String playerName : players) { + log.debug("Player: " + playerName); + } + for (String optionName : gameOptions.keySet()) { + log.debug("Option: " + optionName + "=" + + gameOptions.get(optionName)); + } + directories.add("data"); + directories.add("data/" + name); + + this.players = players; + } + + public String start() { + + if (players.size() < playerManager.minPlayers + || players.size() > playerManager.maxPlayers) { + return name+" is not configured to be played with "+players.size()+" players\n" + + "Please enter a valid number of players, or add a <Players> entry to data/"+name+"/Game.xml"; + } + + gameManager.startGame(gameOptions); + return null; + } + + public boolean setup() { + + try { + componentManagerTag = + Tag.findTopTagInFile(GAME_XML_FILE, directories, + ComponentManager.ELEMENT_ID); + if (componentManagerTag == null) { + throw new ConfigurationException( + "No Game XML element found in file " + GAME_XML_FILE); + } + + componentManagerTag.setGameOptions(gameOptions); + componentManager = + ComponentManager.configureInstance(name, componentManagerTag, gameOptions); + + log.info("========== Start of rails.game " + name + " =========="); + log.info("Rails version "+version); + ReportBuffer.add(LocalText.getText("GameIs", name)); + + // set special properties and token static variables + SpecialProperty.init(); + Token.init(); + + // Have the ComponentManager work through the other rails.game files + componentManager.finishPreparation(); + + playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); + if (playerManager == null) { + throw new ConfigurationException( + "No PlayerManager XML element found in file " + GAME_XML_FILE); + } + + bank = (Bank) componentManager.findComponent("Bank"); + if (bank == null) { + throw new ConfigurationException( + "No Bank XML element found in file " + GAME_XML_FILE); + } + + companyManager = + (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); + if (companyManager == null) { + throw new ConfigurationException( + "No CompanyManager XML element found in file " + + GAME_XML_FILE); + } + stockMarket = + (StockMarketI) componentManager.findComponent(StockMarketI.COMPONENT_NAME); + if (stockMarket == null) { + throw new ConfigurationException( + "No StockMarket XML element found in file " + + GAME_XML_FILE); + } + gameManager = + (GameManager) componentManager.findComponent("GameManager"); + if (gameManager == null) { + throw new ConfigurationException( + "No GameManager XML element found in file " + + GAME_XML_FILE); + } + + phaseManager = + (PhaseManager) componentManager.findComponent("PhaseManager"); + if (phaseManager == null) { + throw new ConfigurationException( + "No PhaseManager XML element found in file " + + GAME_XML_FILE); + } + + trainManager = + (TrainManager) componentManager.findComponent("TrainManager"); + if (trainManager == null) { + throw new ConfigurationException( + "No TrainManager XML element found in file " + + GAME_XML_FILE); + } + + mapManager = + (MapManager) componentManager.findComponent("Map"); + if (mapManager == null) { + throw new ConfigurationException( + "No Map XML element found in file " + + GAME_XML_FILE); + } + + tileManager = + (TileManager) componentManager.findComponent("TileManager"); + if (tileManager == null) { + throw new ConfigurationException( + "No TileManager XML element found in file " + + GAME_XML_FILE); + } + + revenueManager = + (RevenueManager) componentManager.findComponent("RevenueManager"); + // revenueManager is optional so far +// if (revenueManager == null) { +// throw new ConfigurationException( +// "No RevenueManager XML element found in file " +// + GAME_XML_FILE); +// } + + /* + * Initialisations that involve relations between components can + * only be done after all XML has been processed. + */ + playerManager.setPlayers(players, bank); + gameManager.init(name, playerManager, companyManager, + phaseManager, trainManager, stockMarket, mapManager, + tileManager, revenueManager, bank); + + companyManager.finishConfiguration(gameManager); + trainManager.finishConfiguration(gameManager); + phaseManager.finishConfiguration(gameManager); + mapManager.finishConfiguration(gameManager); + bank.finishConfiguration(gameManager); + stockMarket.finishConfiguration(gameManager); + tileManager.finishConfiguration(gameManager); + if (revenueManager != null) + revenueManager.finishConfiguration(gameManager); + } catch (Exception e) { + String message = + LocalText.getText("GameSetupFailed", GAME_XML_FILE); + log.fatal(message, e); + System.out.println(e.getMessage()); + e.printStackTrace(); + DisplayBuffer.add(message + ":\n " + e.getMessage()); + return false; + } + + return true; + } + + @SuppressWarnings("unchecked") + public static Game load(String filepath) { + + Game game = null; + + 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(); + 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(); + } + + long versionID = (Long) object; + log.debug("Saved versionID="+versionID+" (object="+object+")"); + long saveFileVersionID = GameManager.saveFileVersionID; + if (versionID != saveFileVersionID) { + throw new Exception("Save version " + versionID + + " is incompatible with current version " + + saveFileVersionID); + } + 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(); + + game = new Game(name, playerNames, selectedGameOptions); + + if (!game.setup()) { + throw new ConfigurationException("Error in setting up " + name); + } + + String startError = game.start(); + if (startError != null) { + DisplayBuffer.add(startError); + return null; + } + GameManagerI gameManager = game.getGameManager(); + int numberOfActions = 0; + + log.debug("Starting to execute loaded actions"); + + 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) { + // Old-style: one List of PossibleActions + List<PossibleAction> executedActions = + (List<PossibleAction>) actionObject; + numberOfActions = executedActions.size(); + for (PossibleAction action : executedActions) { + if (!gameManager.processOnReload(action)) { + log.error ("Load interrupted"); + DisplayBuffer.add(LocalText.getText("LoadInterrupted")); + break; + } + } + } else if (actionObject instanceof PossibleAction) { + // New style: separate PossibleActionsObjects, since Rails 1.3.1 + while (actionObject instanceof PossibleAction) { + numberOfActions++; + if (!gameManager.processOnReload((PossibleAction)actionObject)) { + log.error ("Load interrupted"); + DisplayBuffer.add(LocalText.getText("LoadInterrupted")); + break; + } + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + break; + } + } + } + break; + } + + // load user comments (is the last + 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(); + + game.getGameManager().finishLoading(); + return game; + + } catch (Exception e) { + log.error("Load failed", e); + DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); + } + + return null; + } + + /*----- Getters -----*/ + + public GameManagerI getGameManager() { + return gameManager; + } + +} Deleted: tags/rails_1_4/rails.bat =================================================================== (Binary files differ) Copied: tags/rails_1_4/rails.bat (from rev 1409, trunk/18xx/rails.bat) =================================================================== (Binary files differ) Deleted: tags/rails_1_4/rails.sh =================================================================== --- trunk/18xx/rails.sh 2010-08-28 17:08:52 UTC (rev 1408) +++ tags/rails_1_4/rails.sh 2010-08-28 17:56:01 UTC (rev 1410) @@ -1,3 +0,0 @@ -#!/bin/bash - -java -jar ./rails-1.3.jar $1 \ No newline at end of file Copied: tags/rails_1_4/rails.sh (from rev 1409, trunk/18xx/rails.sh) =================================================================== --- tags/rails_1_4/rails.sh (rev 0) +++ tags/rails_1_4/rails.sh 2010-08-28 17:56:01 UTC (rev 1410) @@ -0,0 +1,3 @@ +#!/bin/bash + +java -jar ./rails-1.4.jar $1 \ 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: <wak...@us...> - 2010-08-28 17:53:25
|
Revision: 1409 http://rails.svn.sourceforge.net/rails/?rev=1409&view=rev Author: wakko666 Date: 2010-08-28 17:53:19 +0000 (Sat, 28 Aug 2010) Log Message: ----------- Remove CVSROOT directory. Bump version strings to 1.4 Modified Paths: -------------- trunk/18xx/build.xml trunk/18xx/rails/game/Game.java trunk/18xx/rails.bat trunk/18xx/rails.sh Removed Paths: ------------- trunk/CVSROOT/ Modified: trunk/18xx/build.xml =================================================================== --- trunk/18xx/build.xml 2010-08-28 17:08:52 UTC (rev 1408) +++ trunk/18xx/build.xml 2010-08-28 17:53:19 UTC (rev 1409) @@ -9,7 +9,7 @@ <property name="debuglevel" value="source,lines,vars"/> <property name="target" value="1.5"/> <property name="source" value="1.5"/> - <property name="version" value="1.3"/> + <property name="version" value="1.4"/> <taskdef name="jarbundler" classpath="tools/lib/jarbundler-2.1.0.jar" classname="net.sourceforge.jarbundler.JarBundler" /> Modified: trunk/18xx/rails/game/Game.java =================================================================== --- trunk/18xx/rails/game/Game.java 2010-08-28 17:08:52 UTC (rev 1408) +++ trunk/18xx/rails/game/Game.java 2010-08-28 17:53:19 UTC (rev 1409) @@ -13,7 +13,7 @@ import rails.util.Tag; public class Game { - public static final String version = "1.3+"; + public static final String version = "1.4"; /** The component Manager */ protected ComponentManager componentManager; Modified: trunk/18xx/rails.bat =================================================================== (Binary files differ) Modified: trunk/18xx/rails.sh =================================================================== --- trunk/18xx/rails.sh 2010-08-28 17:08:52 UTC (rev 1408) +++ trunk/18xx/rails.sh 2010-08-28 17:53:19 UTC (rev 1409) @@ -1,3 +1,3 @@ #!/bin/bash -java -jar ./rails-1.3.jar $1 \ No newline at end of file +java -jar ./rails-1.4.jar $1 \ 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: <ste...@us...> - 2010-08-28 17:08:58
|
Revision: 1408 http://rails.svn.sourceforge.net/rails/?rev=1408&view=rev Author: stefanfrey Date: 2010-08-28 17:08:52 +0000 (Sat, 28 Aug 2010) Log Message: ----------- Added noMap option to 18AL Modified Paths: -------------- trunk/18xx/data/18AL/Game.xml trunk/18xx/data/GamesList.xml Modified: trunk/18xx/data/18AL/Game.xml =================================================================== --- trunk/18xx/data/18AL/Game.xml 2010-08-28 16:57:59 UTC (rev 1407) +++ trunk/18xx/data/18AL/Game.xml 2010-08-28 17:08:52 UTC (rev 1408) @@ -4,6 +4,7 @@ <Game name="18AL"/> <GameOption name="RouteAwareness" values="Highlight,Deactivate" default="Deactivate" /> <GameOption name="RevenueCalculation" values="Suggest,Deactivate" default="Deactivate" /> + <GameOption name="NoMapMode" type="toggle" default="no" /> <GameOption name ="18ALOptimizeNamedTrains" default="no"/> <GameOption name="UnlimitedTopTrains" parm="4D" type="toggle" default="no"/> <GameOption name="Obsolete4Trains" type="toggle" default="yes"/> Modified: trunk/18xx/data/GamesList.xml =================================================================== --- trunk/18xx/data/GamesList.xml 2010-08-28 16:57:59 UTC (rev 1407) +++ trunk/18xx/data/GamesList.xml 2010-08-28 17:08:52 UTC (rev 1408) @@ -104,6 +104,7 @@ </Description> <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 ="18ALOptimizeNamedTrains" type="toggle" default="yes"/> <Option name="UnlimitedTopTrains" parm="4D" type="toggle" default="no"/> <Option name="Obsolete4Trains" type="toggle" default="yes"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |