You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: Stefan F. <ste...@us...> - 2010-04-09 06:38:45
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv830 Modified Files: .classpath Log Message: Updated jgraph.jar, added junit.jar and updated .classpath Index: .classpath =================================================================== RCS file: /cvsroot/rails/18xx/.classpath,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** .classpath 8 Apr 2010 21:22:46 -0000 1.16 --- .classpath 9 Apr 2010 06:38:37 -0000 1.17 *************** *** 1,37 **** <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry path="" kind="src"/> ! <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true" kind="con"/> ! <classpathentry path="lib/batik-1.6/batik.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-transcoder.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-dom.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-bridge.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-util.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-gvt.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-script.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-ext.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-awt-util.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/extensions/batik-squiggle-ext.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-css.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-extension.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-gui-util.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-parser.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-svg-dom.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-svggen.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-swing.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/batik-xml.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/js.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/pdf-transcoder.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/xerces_2_5_0.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/lib/xml-apis.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/batik-rasterizer.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/batik-slideshow.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/batik-squiggle.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/batik-svgpp.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/batik-1.6/batik-ttf2svg.jar" exported="true" kind="lib"/> ! <classpathentry path="lib/log4j-1.2/log4j-1.2.14.jar" exported="true" kind="lib"/> ! <classpathentry path="C:/Java/eclipse521/plugins/org.junit_3.8.2.v20090203-1005/junit.jar" kind="lib"/> ! <classpathentry path="lib/jgraph5/jgraph.jar" kind="lib"/> ! <classpathentry path="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" kind="lib"/> ! <classpathentry path="classes" kind="output"/> </classpath> --- 1,37 ---- <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry kind="src" path=""/> ! <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-transcoder.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-dom.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-bridge.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-util.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-gvt.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-script.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-ext.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-awt-util.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/extensions/batik-squiggle-ext.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-css.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-extension.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-gui-util.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-parser.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-svg-dom.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-svggen.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-swing.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/batik-xml.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/js.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/pdf-transcoder.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/xerces_2_5_0.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/lib/xml-apis.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik-rasterizer.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik-slideshow.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik-squiggle.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik-svgpp.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/batik-1.6/batik-ttf2svg.jar"/> ! <classpathentry exported="true" kind="lib" path="lib/log4j-1.2/log4j-1.2.14.jar"/> ! <classpathentry kind="lib" path="lib/jgraph5/jgraph.jar"/> ! <classpathentry kind="lib" path="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> ! <classpathentry kind="lib" path="lib/junit_3.8.2/junit.jar"/> ! <classpathentry kind="output" path="classes"/> </classpath> |
From: Stefan F. <ste...@us...> - 2010-04-09 06:38:45
|
Update of /cvsroot/rails/18xx/lib/junit_3.8.2 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv830/lib/junit_3.8.2 Added Files: junit.jar Log Message: Updated jgraph.jar, added junit.jar and updated .classpath --- NEW FILE: junit.jar --- (This appears to be a binary file; contents omitted.) |
From: Stefan F. <ste...@us...> - 2010-04-09 06:38:45
|
Update of /cvsroot/rails/18xx/lib/jgraph5 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv830/lib/jgraph5 Modified Files: jgraph.jar Log Message: Updated jgraph.jar, added junit.jar and updated .classpath Index: jgraph.jar =================================================================== RCS file: /cvsroot/rails/18xx/lib/jgraph5/jgraph.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsNSvLmY and /tmp/cvsbB4qdm differ |
From: Stefan F. <ste...@us...> - 2010-04-09 06:38:16
|
Update of /cvsroot/rails/18xx/lib/junit_3.8.2 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv810/lib/junit_3.8.2 Log Message: Directory /cvsroot/rails/18xx/lib/junit_3.8.2 added to the repository |
From: Erik V. <ev...@us...> - 2010-04-08 21:25:58
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5369/rails/game/specific/_1835 Modified Files: OperatingRound_1835.java Log Message: No token lay on L6 before BA has laid home token OBB extra tiles cannot be laid in the same round Index: OperatingRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/OperatingRound_1835.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OperatingRound_1835.java 28 Mar 2010 20:14:20 -0000 1.1 --- OperatingRound_1835.java 8 Apr 2010 21:25:51 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package rails.game.specific._1835; + import rails.game.Bank; + import rails.game.DisplayBuffer; import rails.game.GameDef; import rails.game.GameManagerI; *************** *** 6,10 **** --- 8,16 ---- import rails.game.PhaseI; import rails.game.action.DiscardTrain; + import rails.game.action.LayBaseToken; + import rails.game.action.LayTile; + import rails.game.special.SpecialTileLay; import rails.game.state.BooleanState; + import rails.util.LocalText; public class OperatingRound_1835 extends OperatingRound { *************** *** 12,15 **** --- 18,23 ---- private BooleanState needPrussianFormationCall = new BooleanState ("NeedPrussianFormationCall", false); + private BooleanState hasLaidExtraOBBTile + = new BooleanState ("HasLaidExtraOBBTile", false); public OperatingRound_1835 (GameManagerI gameManager) { *************** *** 17,20 **** --- 25,94 ---- } + protected void setSpecialTileLays() { + + /* Special-property tile lays */ + currentSpecialTileLays.clear(); + + if (!operatingCompany.canUseSpecialProperties()) return; + + for (SpecialTileLay stl : getSpecialProperties(SpecialTileLay.class)) { + if (stl.isExtra() || !currentNormalTileLays.isEmpty()) { + + // Exclude the second OBB free tile if the first was laid in this round + if (stl.getLocationNameString().matches("M1(7|9)") + && hasLaidExtraOBBTile.booleanValue()) continue; + + currentSpecialTileLays.add(new LayTile(stl)); + } + } + } + + public boolean layTile(LayTile action) { + + // The extra OBB tiles may not both be laid in the same round + if (action.getSpecialProperty() != null + && action.getSpecialProperty().getLocationNameString().matches("M1(5|7)")) { + if (hasLaidExtraOBBTile.booleanValue()) { + String errMsg = LocalText.getText("InvalidTileLay"); + DisplayBuffer.add(LocalText.getText("CannotLayTileOn", + action.getCompanyName(), + action.getLaidTile().getExternalId(), + action.getChosenHex().getName(), + Bank.format(0), + errMsg )); + return false; + } + } + + boolean result = super.layTile(action); + + if (result && action.getSpecialProperty() != null + && action.getSpecialProperty().getLocationNameString().matches("M1(5|7)")) { + hasLaidExtraOBBTile.set(true); + } + + return result; + } + + public boolean layBaseToken(LayBaseToken action) { + + // No tokens may be laid on the BA home hex before BA has done so + if (action.getChosenHex().getName().equalsIgnoreCase("L6") + && !action.getCompanyName().equalsIgnoreCase(GameManager_1835.BA_ID) + && !gameManager.getCompanyManager().getCompanyByName(GameManager_1835.BA_ID) + .hasLaidHomeBaseTokens()) { + String errMsg = LocalText.getText("NotYetOperated", GameManager_1835.BA_ID); + DisplayBuffer.add(LocalText.getText("CannotLayBaseTokenOn", + action.getCompanyName(), + action.getChosenHex().getName(), + Bank.format(0), + errMsg )); + return false; + + } else { + return super.layBaseToken(action); + } + } + protected void newPhaseChecks() { PhaseI phase = getCurrentPhase(); |
From: Erik V. <ev...@us...> - 2010-04-08 21:25:58
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5369 Modified Files: LocalisedText.properties Log Message: No token lay on L6 before BA has laid home token OBB extra tiles cannot be laid in the same round Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** LocalisedText.properties 2 Apr 2010 20:03:55 -0000 1.125 --- LocalisedText.properties 8 Apr 2010 21:25:51 -0000 1.126 *************** *** 246,249 **** --- 246,250 ---- InvalidStops=Invalid or zero major stops specified InvalidTileColourName=Invalid colour name {1} for tile {0} + InvalidTileLay=Invalid tile lay InvalidTrackEnd=Invalid track end LAYS_FREE_TOKEN_ON={0} lays a free token on {1} |
From: Erik V. <ev...@us...> - 2010-04-08 21:24:10
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv4708/rails/ui/swing/gamespecific/_1835 Modified Files: StatusWindow_1835.java Log Message: Moved hardcoded company IDs to GameManager_1835 Index: StatusWindow_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StatusWindow_1835.java 28 Mar 2010 20:14:20 -0000 1.3 --- StatusWindow_1835.java 8 Apr 2010 21:24:02 -0000 1.4 *************** *** 27,31 **** public void init (GameUIManager gameUIManager) { super.init(gameUIManager); ! prussian = gameUIManager.getGameManager().getCompanyManager().getCompanyByName(StockRound_1835.PR_ID); } --- 27,31 ---- public void init (GameUIManager gameUIManager) { super.init(gameUIManager); ! prussian = gameUIManager.getGameManager().getCompanyManager().getCompanyByName(GameManager_1835.PR_ID); } *************** *** 70,74 **** LocalText.getText("MergeMinorConfirm", getCurrentPlayer().getName(), ! PrussianFormationRound.M2_ID, StockRound_1835.PR_ID), "Yes", "No"); --- 70,74 ---- LocalText.getText("MergeMinorConfirm", getCurrentPlayer().getName(), ! GameManager_1835.M2_ID, GameManager_1835.PR_ID), "Yes", "No"); |
From: Erik V. <ev...@us...> - 2010-04-08 21:23:54
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv4630/rails/game/specific/_1835 Modified Files: GameManager_1835.java PrussianFormationRound.java StockRound_1835.java Log Message: Moved hardcoded company IDs to GameManager_1835 Index: StockRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/StockRound_1835.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** StockRound_1835.java 2 Apr 2010 20:03:55 -0000 1.9 --- StockRound_1835.java 8 Apr 2010 21:23:47 -0000 1.10 *************** *** 14,26 **** public class StockRound_1835 extends StockRound { - public static String BY_ID="Bay"; - public static String SX_ID="Sax"; - public static String BA_ID="Bad"; - public static String HE_ID="Hes"; - public static String WT_ID="Wrt"; - public static String MS_ID="MS"; - public static String OL_ID="Old"; - public static String PR_ID="Pr"; - /** * Constructor with the GameManager, will call super class (StockRound's) Constructor to initialize --- 14,17 ---- *************** *** 113,132 **** // Check for group releases if (sharesInIPO == 0) { ! if (name.equals(SX_ID) && ! ipo.getShare(companyManager.getCompanyByName(BY_ID)) == 0 ! || name.equals(BY_ID) && ! ipo.getShare(companyManager.getCompanyByName(SX_ID)) == 0) { // Group 1 sold out: release Badische ! releaseCompanyShares (companyManager.getCompanyByName(BA_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", BA_ID)); ! } else if (name.equals(BA_ID) || name.equals(WT_ID) || name.equals(HE_ID)) { ! if (ipo.getShare(companyManager.getCompanyByName(BA_ID)) == 0 ! && ipo.getShare(companyManager.getCompanyByName(WT_ID)) == 0 ! && ipo.getShare(companyManager.getCompanyByName(HE_ID)) == 0) { // Group 2 sold out: release MS ! releaseCompanyShares (companyManager.getCompanyByName(MS_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", MS_ID)); } } --- 104,123 ---- // Check for group releases if (sharesInIPO == 0) { ! if (name.equals(GameManager_1835.SX_ID) && ! ipo.getShare(companyManager.getCompanyByName(GameManager_1835.BY_ID)) == 0 ! || name.equals(GameManager_1835.BY_ID) && ! ipo.getShare(companyManager.getCompanyByName(GameManager_1835.SX_ID)) == 0) { // Group 1 sold out: release Badische ! releaseCompanyShares (companyManager.getCompanyByName(GameManager_1835.BA_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", GameManager_1835.BA_ID)); ! } else if (name.equals(GameManager_1835.BA_ID) || name.equals(GameManager_1835.WT_ID) || name.equals(GameManager_1835.HE_ID)) { ! if (ipo.getShare(companyManager.getCompanyByName(GameManager_1835.BA_ID)) == 0 ! && ipo.getShare(companyManager.getCompanyByName(GameManager_1835.WT_ID)) == 0 ! && ipo.getShare(companyManager.getCompanyByName(GameManager_1835.HE_ID)) == 0) { // Group 2 sold out: release MS ! releaseCompanyShares (companyManager.getCompanyByName(GameManager_1835.MS_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", GameManager_1835.MS_ID)); } } *************** *** 137,165 **** * will always be available at the start of SR1. */ ! if (name.equals(BA_ID)) { if (sharesInIPO == 50) { // 50% sold: release Wurttemberg ! releaseCompanyShares (companyManager.getCompanyByName(WT_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", WT_ID)); } else if (sharesInIPO == 80) { // President sold: release four 10% Prussian shares ! gameManager.getCompanyManager().getPublicCompany(PR_ID).setBuyable(true); for (int i=0; i<4; i++) { ! unavailable.getCertOfType(PR_ID+"_10%").moveTo(ipo); } ReportBuffer.add (LocalText.getText("SharesReleased", ! "4 10%", PR_ID)); } ! } else if (name.equals(WT_ID)) { //Wurttembergische if (sharesInIPO == 50) { // 50% sold: release Hessische ! releaseCompanyShares (companyManager.getCompanyByName(HE_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", HE_ID)); } ! } else if (name.equals(MS_ID)) { // Mecklenburg/Schwerin if (sharesInIPO == 40) { // 60% sold: release Oldenburg ! releaseCompanyShares (companyManager.getCompanyByName(OL_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", OL_ID)); } } --- 128,156 ---- * will always be available at the start of SR1. */ ! if (name.equals(GameManager_1835.BA_ID)) { if (sharesInIPO == 50) { // 50% sold: release Wurttemberg ! releaseCompanyShares (companyManager.getCompanyByName(GameManager_1835.WT_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", GameManager_1835.WT_ID)); } else if (sharesInIPO == 80) { // President sold: release four 10% Prussian shares ! gameManager.getCompanyManager().getPublicCompany(GameManager_1835.PR_ID).setBuyable(true); for (int i=0; i<4; i++) { ! unavailable.getCertOfType(GameManager_1835.PR_ID+"_10%").moveTo(ipo); } ReportBuffer.add (LocalText.getText("SharesReleased", ! "4 10%", GameManager_1835.PR_ID)); } ! } else if (name.equals(GameManager_1835.WT_ID)) { //Wurttembergische if (sharesInIPO == 50) { // 50% sold: release Hessische ! releaseCompanyShares (companyManager.getCompanyByName(GameManager_1835.HE_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", GameManager_1835.HE_ID)); } ! } else if (name.equals(GameManager_1835.MS_ID)) { // Mecklenburg/Schwerin if (sharesInIPO == 40) { // 60% sold: release Oldenburg ! releaseCompanyShares (companyManager.getCompanyByName(GameManager_1835.OL_ID)); ReportBuffer.add (LocalText.getText("SharesReleased", ! "All", GameManager_1835.OL_ID)); } } Index: PrussianFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/PrussianFormationRound.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PrussianFormationRound.java 28 Mar 2010 20:14:20 -0000 1.8 --- PrussianFormationRound.java 8 Apr 2010 21:23:47 -0000 1.9 *************** *** 31,37 **** Step step; ! public static String PR_ID = StockRound_1835.PR_ID; ! public static String M2_ID = "M2"; ! public PrussianFormationRound (GameManagerI gameManager) { super (gameManager); --- 31,37 ---- Step step; ! public static String PR_ID = GameManager_1835.PR_ID; ! public static String M2_ID = GameManager_1835.M2_ID; ! public PrussianFormationRound (GameManagerI gameManager) { super (gameManager); *************** *** 188,192 **** errMsg = LocalText.getText("WrongCompany", action.getFoldedCompanyNames(), ! M2_ID); break; } --- 188,192 ---- errMsg = LocalText.getText("WrongCompany", action.getFoldedCompanyNames(), ! GameManager_1835.M2_ID); break; } Index: GameManager_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/GameManager_1835.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GameManager_1835.java 28 Mar 2010 20:14:20 -0000 1.5 --- GameManager_1835.java 8 Apr 2010 21:23:47 -0000 1.6 *************** *** 9,12 **** --- 9,22 ---- private RoundI previousRound = null; private Player prFormStartingPlayer = null; + + public static String M2_ID = "M2"; + public static String PR_ID = "Pr"; + public static String OL_ID = "Old"; + public static String MS_ID = "MS"; + public static String WT_ID = "Wrt"; + public static String HE_ID = "Hes"; + public static String BA_ID = "Bad"; + public static String SX_ID = "Sax"; + public static String BY_ID = "Bay"; public GameManager_1835() { |
From: Erik V. <ev...@us...> - 2010-04-08 21:23:21
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv4462/rails/algorithms Modified Files: NetworkGraphBuilder.java Log Message: Removed erroneous annotation Index: NetworkGraphBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkGraphBuilder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetworkGraphBuilder.java 4 Apr 2010 22:02:53 -0000 1.1 --- NetworkGraphBuilder.java 8 Apr 2010 21:23:14 -0000 1.2 *************** *** 188,192 **** } - @Override public Iterator<NetworkVertex> iterator() { return iterator; --- 188,191 ---- |
From: Erik V. <ev...@us...> - 2010-04-08 21:22:54
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv4362 Modified Files: .classpath Log Message: Added JGraph libs Index: .classpath =================================================================== RCS file: /cvsroot/rails/18xx/.classpath,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** .classpath 28 Mar 2010 20:14:20 -0000 1.15 --- .classpath 8 Apr 2010 21:22:46 -0000 1.16 *************** *** 32,35 **** --- 32,37 ---- <classpathentry path="lib/log4j-1.2/log4j-1.2.14.jar" exported="true" kind="lib"/> <classpathentry path="C:/Java/eclipse521/plugins/org.junit_3.8.2.v20090203-1005/junit.jar" kind="lib"/> + <classpathentry path="lib/jgraph5/jgraph.jar" kind="lib"/> + <classpathentry path="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" kind="lib"/> <classpathentry path="classes" kind="output"/> </classpath> |
From: Stefan F. <ste...@us...> - 2010-04-04 22:46:28
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv26142 Modified Files: build.xml Log Message: Updated build.xml with added jars. Index: build.xml =================================================================== RCS file: /cvsroot/rails/18xx/build.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** build.xml 23 Mar 2010 18:45:19 -0000 1.17 --- build.xml 4 Apr 2010 22:46:20 -0000 1.18 *************** *** 19,22 **** --- 19,24 ---- <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"/> </path> <target depends="clean" name="init"> |
From: Stefan F. <ste...@us...> - 2010-04-04 22:03:03
|
Update of /cvsroot/rails/18xx/rails/game/action In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19412/rails/game/action Modified Files: GameAction.java PossibleActions.java Log Message: Adding the experimental network code. Example graphs are shown under Info on the Map Panel. Index: PossibleActions.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/PossibleActions.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PossibleActions.java 14 Jan 2010 20:57:08 -0000 1.16 --- PossibleActions.java 4 Apr 2010 22:02:53 -0000 1.17 *************** *** 89,93 **** // Save is always allowed if (checkedAction instanceof GameAction ! && ((GameAction)checkedAction).getMode() == GameAction.SAVE) { return true; } --- 89,94 ---- // Save is always allowed if (checkedAction instanceof GameAction ! && (((GameAction)checkedAction).getMode() == GameAction.SAVE ! || ((GameAction)checkedAction).getMode() == GameAction.EXPORT)) { return true; } Index: GameAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/GameAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GameAction.java 4 Jun 2008 19:00:29 -0000 1.4 --- GameAction.java 4 Apr 2010 22:02:53 -0000 1.5 *************** *** 10,17 **** public static final int FORCED_UNDO = 3; public static final int REDO = 4; ! public static final int MAX_MODE = 4; private String[] name = ! new String[] { "Save", "Load", "Undo", "Undo!", "Redo" }; // Server-side settings --- 10,18 ---- public static final int FORCED_UNDO = 3; public static final int REDO = 4; ! public static final int EXPORT = 5; ! public static final int MAX_MODE = 5; private String[] name = ! new String[] { "Save", "Load", "Undo", "Undo!", "Redo", "Export" }; // Server-side settings |
From: Stefan F. <ste...@us...> - 2010-04-04 22:03:01
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19412/rails/game Modified Files: MapManager.java TileI.java GameManager.java Tile.java Log Message: Adding the experimental network code. Example graphs are shown under Info on the Map Panel. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** GameManager.java 28 Mar 2010 20:14:20 -0000 1.97 --- GameManager.java 4 Apr 2010 22:02:53 -0000 1.98 *************** *** 7,10 **** --- 7,11 ---- import java.util.*; + import org.apache.log4j.Logger; import org.apache.log4j.NDC; *************** *** 55,59 **** protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = --- 56,60 ---- protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = *************** *** 656,659 **** --- 657,665 ---- } + /** Stub, can be overridden in subclasses with actual actions */ + public void newPhaseChecks (RoundI round) { + + } + public String getORId () { if (showCompositeORNumber) { *************** *** 768,771 **** --- 774,780 ---- result = true; break; + case GameAction.EXPORT: + result = export(gameAction); + break; } if (result) break; *************** *** 933,936 **** --- 942,978 ---- } + protected boolean export(GameAction exportAction) { + + String filename = exportAction.getFilepath(); + boolean result = false; + + try { + PrintWriter pw = new PrintWriter(filename); + + // write map information + MapHex[][] allHexes =mapManager.getHexes(); + + for (MapHex[] hexRow:allHexes) + for (MapHex hex:hexRow) + if (hex != null) { + pw.println(hex.getName() + "," + hex.getCurrentTile().getExternalId() + "," + + hex.getCurrentTileRotation() + "," + + hex.getOrientationName(hex.getCurrentTileRotation()) + ) ; + } + + pw.close(); + result = true; + + + } catch (IOException e) { + log.error("Save failed", e); + DisplayBuffer.add(LocalText.getText("SaveFailed", e.getMessage())); + } + + return result; + } + + /* (non-Javadoc) * @see rails.game.GameManagerI#finishShareSellingRound() *************** *** 1432,1435 **** --- 1474,1478 ---- return cm; } + } Index: TileI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileI.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TileI.java 28 Mar 2010 17:05:55 -0000 1.17 --- TileI.java 4 Apr 2010 22:02:53 -0000 1.18 *************** *** 34,37 **** --- 34,39 ---- public boolean hasTracks(int sideNumber); + public List<Track> getTracks(); + public List<Track> getTracksPerSide(int sideNumber); Index: MapManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapManager.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MapManager.java 11 Mar 2010 20:38:20 -0000 1.21 --- MapManager.java 4 Apr 2010 22:02:53 -0000 1.22 *************** *** 191,194 **** --- 191,198 ---- return hexes; } + + public List<MapHex> getHexesAsList() { + return new ArrayList<MapHex>(mHexes.values()); + } public int getMinX() { Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Tile.java 28 Mar 2010 17:05:55 -0000 1.37 --- Tile.java 4 Apr 2010 22:02:53 -0000 1.38 *************** *** 425,428 **** --- 425,432 ---- } + public List<Track> getTracks() { + return tracks; + } + public Map<Integer, List<Track>> getTracksPerStationMap() { return tracksPerStation; |
From: Stefan F. <ste...@us...> - 2010-04-04 22:03:01
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19412/rails/algorithms Added Files: NetworkEdge.java NetworkVertex.java NetworkGraphBuilder.java NetworkIterator.java Log Message: Adding the experimental network code. Example graphs are shown under Info on the Map Panel. --- NEW FILE: NetworkVertex.java --- package rails.algorithms; import java.util.HashSet; import java.util.List; import java.util.Set; import rails.game.BaseToken; import rails.game.City; import rails.game.MapHex; import rails.game.PublicCompanyI; import rails.game.Station; import rails.game.TokenI; public final class NetworkVertex implements Comparable<NetworkVertex> { private static enum VertexType { STATION, SIDE, HQ } private final VertexType type; private final MapHex hex; private final Station station; private final int side; private boolean tokenable; private Set<PublicCompanyI> companiesHaveToken; private int tokenSlots; public NetworkVertex(MapHex hex, Station station) { this.type = VertexType.STATION; this.hex = hex; this.station = station; this.side = 0; if (station.getBaseSlots() == 0){ this.tokenable = false; } else { this.tokenable = true; // find tokens List<TokenI> tokens = null; this.tokenSlots = 0; List<City> cities = hex.getCities(); for (City city:cities) { if (station == city.getRelatedStation()) { tokens = city.getTokens(); this.tokenSlots = city.getSlots(); break; } } if (tokens == null) this.companiesHaveToken = null; else { this.companiesHaveToken = new HashSet<PublicCompanyI>(); for (TokenI token:tokens) { if (token instanceof BaseToken) { BaseToken baseToken = (BaseToken)token; this.companiesHaveToken.add(baseToken.getCompany()); } } } } } public NetworkVertex(MapHex hex, int side) { this.type = VertexType.SIDE; this.hex = hex; this.station = null; this.side = (side % 6); this.tokenable = false; this.companiesHaveToken = null; this.tokenSlots = 0; } public NetworkVertex(PublicCompanyI company) { this.type = VertexType.HQ; this.hex = null; this.station = null; this.side = 0; this.tokenable = false; this.companiesHaveToken = null; this.tokenSlots = 0; } public boolean isStation(){ return type == VertexType.STATION; } public boolean isSide(){ return type == VertexType.SIDE; } public boolean isHQ(){ return type == VertexType.HQ; } public MapHex getHex(){ return hex; } public Station getStation(){ return station; } public int getSide(){ return side; } public boolean isFullyTokened(){ return tokenable && companiesHaveToken.size() == tokenSlots; } public boolean hasCompanyToken(PublicCompanyI company) { return !(company == null) && companiesHaveToken.contains(company); } public String printTokens(){ if (!tokenable) return "Not tokenable"; StringBuffer result = new StringBuffer("Tokens:"); for (PublicCompanyI company:companiesHaveToken) result.append(" " + company.getName()); if (isFullyTokened()) result.append(", fully tokened"); return result.toString(); } public String getIdentifier(){ if (isStation()) return hex.getName() + "." + -station.getNumber(); else if (isSide()) return hex.getName() + "." + side; else return "HQ"; } @Override public String toString(){ StringBuffer message = new StringBuffer(); if (isStation()) message.append( hex.getName() + "." + station.getNumber()); else if (isSide()) message.append(hex.getName() + "." + hex.getOrientationName(side)); else message.append("HQ"); if (isFullyTokened()) message.append("/*"); return message.toString(); } public int compareTo(NetworkVertex otherVertex) { return this.getIdentifier().compareTo(otherVertex.getIdentifier()); } } --- NEW FILE: NetworkEdge.java --- package rails.algorithms; public final class NetworkEdge { private final NetworkVertex source; private final NetworkVertex target; private final boolean autoEdge; public NetworkEdge(NetworkVertex source, NetworkVertex target, boolean autoEdge) { this.source = source; this.target = target; this.autoEdge = autoEdge; } public NetworkVertex getSource() { return source; } public NetworkVertex getTarget() { return target; } public boolean isAutoEdge() { return autoEdge; } public String getConnection() { return source + " - >" + target; } @Override // set to "" to faciltate visual graph public String toString() { if (!autoEdge) return "***"; else return ""; } } --- NEW FILE: NetworkIterator.java --- package rails.algorithms; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import org.apache.log4j.Logger; import org.jgrapht.*; import org.jgrapht.traverse.*; import rails.game.PublicCompanyI; public class NetworkIterator extends AbstractGraphIterator<NetworkVertex, NetworkEdge> { /** * Standard vertex visit state enumeration. * Copied from CrossComponentIterator due to visibility for generic definition above */ protected static enum VisitColor { /** * Vertex has not been returned via iterator yet. */ WHITE, /** * Vertex has not been returned via iterator yet, but has to use autoedge */ YELLOW, /** * Vertex has been returned via iterator, but we're * not done with all of its out-edges yet. */ GRAY, /** * Vertex has been returned via iterator, and we're * done with all of its out-edges. */ BLACK } /** * Stores the vertices that have been seen during iteration and * some additional traversal info regarding each vertex. */ private Map<NetworkVertex, VisitColor> seen = new HashMap<NetworkVertex, VisitColor>(); private NetworkVertex startVertex; private final PublicCompanyI company; private final Graph<NetworkVertex, NetworkEdge> graph; /** LIFO stack for DFS */ private List<NetworkVertex> stack = new ArrayList<NetworkVertex>(); protected static Logger log = Logger.getLogger(NetworkIterator.class.getPackage().getName()); public NetworkIterator(Graph<NetworkVertex, NetworkEdge> graph, NetworkVertex startVertex) { this(graph, startVertex, null); } /** * Returns NetworkIterator for specific company */ public NetworkIterator(Graph<NetworkVertex, NetworkEdge> graph, NetworkVertex startVertex, PublicCompanyI company) { super(); if (graph == null) throw new IllegalArgumentException("graph must not be null"); if (!graph.containsVertex(startVertex)) throw new IllegalArgumentException("graph must contain the start vertex"); this.graph = graph; this.startVertex = startVertex; this.company = company; } /** * @return the graph being traversed */ public Graph<NetworkVertex, NetworkEdge> getGraph() { return graph; } /** * @see java.util.Iterator#hasNext() */ public boolean hasNext() { if (startVertex != null) { encounterStartVertex(); } return !isConnectedComponentExhausted(); } /** * @see java.util.Iterator#next() */ public NetworkVertex next() { if (startVertex != null) { encounterStartVertex(); } if (hasNext()) { NetworkVertex nextVertex = provideNextVertex(); VisitColor previousColor = putSeenData(nextVertex , VisitColor.GRAY); addUnseenChildrenOf(nextVertex, previousColor); return nextVertex; } else { throw new NoSuchElementException(); } } /** * Access the data stored for a seen vertex. * * @param vertex a vertex which has already been seen. * * @return data associated with the seen vertex or <code>null</code> if no * data was associated with the vertex. A <code>null</code> return can also * indicate that the vertex was explicitly associated with <code> * null</code>. */ private VisitColor getSeenData(NetworkVertex vertex) { return seen.get(vertex); } /** * Determines whether a vertex has been seen yet by this traversal. * * @param vertex vertex in question * * @return <tt>true</tt> if vertex has already been seen */ private boolean isSeenVertex(NetworkVertex vertex) { return seen.containsKey(vertex); } /** * Stores iterator-dependent data for a vertex that has been seen. * * @param vertex a vertex which has been seen. * @param data data to be associated with the seen vertex. * * @return previous value associated with specified vertex or <code> * null</code> if no data was associated with the vertex. A <code> * null</code> return can also indicate that the vertex was explicitly * associated with <code>null</code>. */ private VisitColor putSeenData(NetworkVertex vertex, VisitColor data) { return seen.put(vertex, data); } /** * Called when a vertex has been finished (meaning is dependent on traversal * represented by subclass). * * @param vertex vertex which has been finished */ private void finishVertex(NetworkVertex vertex) { // do nothing } private void addUnseenChildrenOf(NetworkVertex vertex, VisitColor previousColor) { if (vertex.isFullyTokened() && !vertex.hasCompanyToken(company)) return; for (NetworkEdge edge : graph.edgesOf(vertex)) { if (previousColor == VisitColor.WHITE || edge.isAutoEdge()) { NetworkVertex oppositeV = Graphs.getOppositeVertex(graph, edge, vertex); if (isSeenVertex(oppositeV)) { encounterVertexAgain(oppositeV, edge); } else { encounterVertex(oppositeV, edge); } } } } private void encounterStartVertex() { putSeenData(startVertex, VisitColor.WHITE); stack.add(startVertex); startVertex = null; log.debug("Iterator: Added to stack " + startVertex); } /** copy of standard dfs */ private void encounterVertex(NetworkVertex vertex, NetworkEdge edge) { VisitColor color = VisitColor.WHITE; if (vertex.isSide() && !edge.isAutoEdge()) color = VisitColor.YELLOW; putSeenData(vertex, color); stack.add(vertex); log.debug("Iterator: Added to stack " + vertex + " with color " + color); } /** copy of standard dfs */ private void encounterVertexAgain(NetworkVertex vertex, NetworkEdge edge) { VisitColor color = getSeenData(vertex); if (color != VisitColor.WHITE && color != VisitColor.YELLOW) { // We've already visited this vertex; no need to mess with the // stack (either it's BLACK and not there at all, or it's GRAY // and therefore just a sentinel). return; } int i = stack.indexOf(vertex); // Since we've encountered it before, and it's still WHITE or YELLOW, it // *must* be on the stack. assert (i > -1); stack.remove(i); stack.add(vertex); } /** copy of standard dfs */ private boolean isConnectedComponentExhausted() { while (true) { if (stack.isEmpty()) { return true; } if (peekStack() != null) { // Found a non-sentinel. return false; } // Found a sentinel: pop it, record the finish time, // and then loop to check the rest of the stack. // Pop null we peeked at above. popStack(); // This will pop corresponding vertex to be recorded as finished. recordFinish(); } } /** copy of standard dfs */ private NetworkVertex provideNextVertex() { NetworkVertex v; while (true) { v = popStack(); if (v == null) { // This is a finish-time sentinel we previously pushed. recordFinish(); // Now carry on with another pop until we find a non-sentinel } else { // Got a real vertex to start working on break; } } // Push a sentinel for v onto the stack so that we'll know // when we're done with it. stack.add(v); stack.add(null); return v; } private NetworkVertex popStack() { return stack.remove(stack.size() - 1); } private NetworkVertex peekStack() { return stack.get(stack.size() - 1); } private void recordFinish() { NetworkVertex v = popStack(); putSeenData(v, VisitColor.BLACK); finishVertex(v); } } --- NEW FILE: NetworkGraphBuilder.java --- package rails.algorithms; import java.awt.Dimension; import java.awt.Rectangle; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.swing.JFrame; import javax.swing.JScrollPane; import org.apache.log4j.Logger; import org.jgraph.JGraph; import org.jgrapht.Graph; import org.jgrapht.Graphs; import org.jgrapht.ext.JGraphModelAdapter; import org.jgrapht.graph.SimpleGraph; import org.jgrapht.graph.Subgraph; import com.jgraph.layout.JGraphFacade; import com.jgraph.layout.JGraphLayout; import com.jgraph.layout.organic.JGraphFastOrganicLayout; import rails.game.BaseToken; import rails.game.City; import rails.game.MapHex; import rails.game.PublicCompanyI; import rails.game.Station; import rails.game.TileI; import rails.game.TokenHolder; import rails.game.TokenI; import rails.game.Track; public final class NetworkGraphBuilder implements Iterable<NetworkVertex> { protected static Logger log = Logger.getLogger(NetworkGraphBuilder.class.getPackage().getName()); private SimpleGraph<NetworkVertex, NetworkEdge> mapGraph; private Map<String, NetworkVertex> mapVertexes; private NetworkIterator iterator; public NetworkGraphBuilder() { this.mapGraph = null; } public void generateGraph(List<MapHex> mHexes) { mapGraph = new SimpleGraph<NetworkVertex, NetworkEdge>(NetworkEdge.class); mapVertexes = new HashMap<String, NetworkVertex> (); for (MapHex hex:mHexes) { // get Tile TileI tile = hex.getCurrentTile(); // then get stations List<Station> stations = tile.getStations(); // and add those to the mapGraph for (Station station: stations) { NetworkVertex stationVertex = new NetworkVertex(hex, station); mapGraph.addVertex(stationVertex); mapVertexes.put(stationVertex.getIdentifier(), stationVertex); log.debug("Added " + stationVertex + " / " + stationVertex.printTokens()); } // get tracks per side to add that vertex for (int side=0; side<6; side++) if (tile.getTracksPerSide(side).size() != 0) { NetworkVertex sideVertex = new NetworkVertex(hex, side + hex.getCurrentTileRotation()); mapGraph.addVertex(sideVertex); mapVertexes.put(sideVertex.getIdentifier(), sideVertex); log.debug("Added " + sideVertex); } } // loop over all maps and add tracks for (MapHex hex:mHexes) { // get Tile TileI tile = hex.getCurrentTile(); // get Tracks List<Track> tracks = tile.getTracks(); for (Track track:tracks) { int[] points = track.points(); NetworkVertex startVertex = getVertexRotated(hex, points[0]); NetworkVertex endVertex = getVertexRotated(hex, points[1]); log.debug("Track: " + track); NetworkEdge edge = new NetworkEdge(startVertex, endVertex, false); mapGraph.addEdge(startVertex, endVertex, edge); log.debug("Added edge " + edge.getConnection()); } // and connect to neighbouring hexes (for sides 0-2) for (int side=0; side <= 2; side++) { NetworkVertex vertex = getVertex(hex, side); MapHex neighborHex = hex.getNeighbor(side); if (neighborHex == null) { log.debug("No connection for Hex " + hex.getName() + " at " + hex.getOrientationName(side) + ", No Neighbor"); continue; } NetworkVertex otherVertex = getVertex(neighborHex, side + 3); if (vertex == null && otherVertex == null){ log.debug("Hex " + hex.getName() + " has no track at " + hex.getOrientationName(side)); log.debug("And Hex " + neighborHex.getName() + " has no track at " + neighborHex.getOrientationName(side + 3)); continue; } else if (vertex == null && otherVertex != null) { log.debug("Deadend connection for Hex " + neighborHex.getName() + " at " + neighborHex.getOrientationName(side + 3) + ", NeighborHex " + hex.getName() + " has no track at side " + hex.getOrientationName(side)); vertex = new NetworkVertex(hex, side); mapGraph.addVertex(vertex); mapVertexes.put(vertex.getIdentifier(), vertex); log.debug("Added deadend vertex " + vertex); } else if (otherVertex == null) { log.debug("Deadend connection for Hex " + hex.getName() + " at " + hex.getOrientationName(side) + ", NeighborHex " + neighborHex.getName() + " has no track at side " + neighborHex.getOrientationName(side+3)); otherVertex = new NetworkVertex(neighborHex, side + 3); mapGraph.addVertex(otherVertex); mapVertexes.put(otherVertex.getIdentifier(), otherVertex); log.debug("Added deadend vertex " + otherVertex); } NetworkEdge edge = new NetworkEdge(vertex, otherVertex, true); mapGraph.addEdge(vertex, otherVertex, edge); log.debug("Added edge " + edge.getConnection()); } } } public SimpleGraph<NetworkVertex, NetworkEdge> getMapGraph() { return mapGraph; } public SimpleGraph<NetworkVertex, NetworkEdge> getRailRoadGraph(PublicCompanyI company) { // initialized simple graph SimpleGraph<NetworkVertex, NetworkEdge> graph = new SimpleGraph<NetworkVertex, NetworkEdge>(NetworkEdge.class); // add Company HQ NetworkVertex hqVertex = new NetworkVertex(company); graph.addVertex(hqVertex); // create vertex set for subgraph List<TokenI> tokens = company.getTokens(); Set<NetworkVertex> vertexes = new HashSet<NetworkVertex>(); for (TokenI token:tokens){ if (!(token instanceof BaseToken)) continue; TokenHolder holder = token.getHolder(); if (!(holder instanceof City)) continue; City city = (City)holder; MapHex hex = city.getHolder(); Station station = city.getRelatedStation(); NetworkVertex vertex = getVertex(hex, station); vertexes.add(vertex); // add connection to graph graph.addVertex(vertex); graph.addEdge(vertex, hqVertex, new NetworkEdge(vertex, hqVertex, false)); NetworkIterator iterator = new NetworkIterator(mapGraph, vertex, company); for (;iterator.hasNext();) vertexes.add(iterator.next()); } Subgraph<NetworkVertex, NetworkEdge, SimpleGraph<NetworkVertex, NetworkEdge>> subGraph = new Subgraph<NetworkVertex, NetworkEdge, SimpleGraph<NetworkVertex, NetworkEdge>> (mapGraph, vertexes); // now add all vertexes and edges to the graph Graphs.addGraph(graph, subGraph); return graph; } public void setIteratorStart(MapHex hex, Station station) { iterator = new NetworkIterator(mapGraph, getVertex(hex, station)); } @Override public Iterator<NetworkVertex> iterator() { return iterator; } private NetworkVertex getVertex(MapHex hex, Station station) { return mapVertexes.get(hex.getName() + "." + -station.getNumber()); } private NetworkVertex getVertex(MapHex hex, int side) { if (side >= 0) side = side % 6; return mapVertexes.get(hex.getName() + "." + side); } private NetworkVertex getVertexRotated(MapHex hex, int side) { if (side >= 0) side = (side + hex.getCurrentTileRotation()) % 6; return mapVertexes.get(hex.getName() + "." + side); } public static void optimizeGraph(Graph<NetworkVertex, NetworkEdge> graph) { while (removeVertexes(graph)); } /** remove deadend and vertex with only two edges */ private static boolean removeVertexes(Graph<NetworkVertex, NetworkEdge> graph){ boolean removed = false; for (NetworkVertex vertex:graph.vertexSet()) { if (!vertex.isSide()) continue; if (graph.edgesOf(vertex).size() == 1) { graph.removeVertex(vertex); removed = true; break; } else if (graph.edgesOf(vertex).size() == 2) { // vertex is not necessary // reconnect NetworkEdge[] edges = graph.edgesOf(vertex).toArray(new NetworkEdge[2]); NetworkVertex firstVertex = Graphs.getOppositeVertex(graph, edges[0], vertex); NetworkVertex secondVertex = Graphs.getOppositeVertex(graph, edges[1], vertex); boolean autoEdge = edges[0].isAutoEdge() || edges[1].isAutoEdge(); graph.addEdge(firstVertex, secondVertex, new NetworkEdge(firstVertex, secondVertex, autoEdge)); // remove vertex graph.removeVertex(vertex); removed = true; break; } } return removed; } public static void visualize(Graph<NetworkVertex, NetworkEdge> graph, String title) { // show network graph JGraphModelAdapter<NetworkVertex, NetworkEdge> jGAdapter = new JGraphModelAdapter<NetworkVertex, NetworkEdge>(graph); JGraph jgraph = new JGraph(jGAdapter); List<NetworkVertex> vertexes= new ArrayList<NetworkVertex>(graph.vertexSet()); Object[] rootCell = new Object[1]; rootCell[0] = jGAdapter.getVertexCell(vertexes.get(0)); JGraphFacade facade = new JGraphFacade(jgraph, rootCell); JGraphLayout layout = new JGraphFastOrganicLayout(); layout.run(facade); facade.scale(new Rectangle(1600,1200)); @SuppressWarnings("unchecked") Map nested = facade.createNestedMap(true,true); jgraph.getGraphLayoutCache().edit(nested); jgraph.setScale(0.8); JFrame frame = new JFrame(); frame.setTitle(title + "(V=" + graph.vertexSet().size() + ",E=" + graph.edgeSet().size() + ")"); frame.setSize(new Dimension(800,600)); frame.getContentPane().add(new JScrollPane(jgraph)); frame.pack(); frame.setVisible(true); } } |
From: Stefan F. <ste...@us...> - 2010-04-04 22:03:01
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19412/rails/ui/swing Modified Files: StatusWindow.java GameUIManager.java ORPanel.java Log Message: Adding the experimental network code. Example graphs are shown under Info on the Map Panel. Index: StatusWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StatusWindow.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** StatusWindow.java 28 Mar 2010 20:14:19 -0000 1.41 --- StatusWindow.java 4 Apr 2010 22:02:53 -0000 1.42 *************** *** 35,38 **** --- 35,40 ---- protected static final String SAVE_CMD = "Save"; + protected static final String EXPORT_CMD = "Export"; + protected static final String UNDO_CMD = "Undo"; *************** *** 79,83 **** private JMenuItem menuItem; ! private ActionMenuItem saveItem; private ActionMenuItem undoItem, forcedUndoItem, redoItem, redoItem2; --- 81,85 ---- private JMenuItem menuItem; ! private ActionMenuItem saveItem, exportItem; private ActionMenuItem undoItem, forcedUndoItem, redoItem, redoItem2; *************** *** 110,113 **** --- 112,122 ---- fileMenu.add(saveItem); + exportItem = new ActionMenuItem(LocalText.getText("EXPORT")); + exportItem.setActionCommand(EXPORT_CMD); + exportItem.addActionListener(this); + exportItem.setEnabled(true); + exportItem.setPossibleAction(new GameAction(GameAction.EXPORT)); + fileMenu.add(exportItem); + fileMenu.addSeparator(); *************** *** 575,579 **** gameUIManager.saveGame((GameAction) executedAction); break; ! case GameAction.UNDO: case GameAction.FORCED_UNDO: --- 584,590 ---- gameUIManager.saveGame((GameAction) executedAction); break; ! case GameAction.EXPORT: ! gameUIManager.exportGame((GameAction) executedAction); ! break; case GameAction.UNDO: case GameAction.FORCED_UNDO: Index: GameUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameUIManager.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** GameUIManager.java 14 Mar 2010 13:10:15 -0000 1.44 --- GameUIManager.java 4 Apr 2010 22:02:53 -0000 1.45 *************** *** 603,606 **** --- 603,632 ---- } + public void exportGame(GameAction exportAction) { + JFileChooser jfc = new JFileChooser(); + String filename; + if (providedName != null) + filename = providedName; + else { + filename = saveDirectory + "/" + gameManager.getGameName() + "_" + + saveDateTimeFormat.format(new Date()) + + saveSuffix + ".txt"; + + File proposedFile = new File(filename); + jfc.setSelectedFile(proposedFile); + if (jfc.showSaveDialog(statusWindow) == JFileChooser.APPROVE_OPTION) { + File selectedFile = jfc.getSelectedFile(); + String filepath = selectedFile.getPath(); + saveDirectory = selectedFile.getParent(); + if (!selectedFile.getName().equalsIgnoreCase(proposedFile.getName())) { + providedName = filepath; + } + exportAction.setFilepath(filepath); + processOnServer(exportAction); + } + } + } + + public void saveGame(GameAction saveAction) { Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ORPanel.java 27 Mar 2010 18:44:24 -0000 1.50 --- ORPanel.java 4 Apr 2010 22:02:53 -0000 1.51 *************** *** 10,13 **** --- 10,16 ---- import org.apache.log4j.Logger; + import org.jgrapht.graph.SimpleGraph; + + import rails.algorithms.*; import rails.common.GuiDef; import rails.game.*; *************** *** 34,37 **** --- 37,41 ---- private static final String REDO_CMD = "Redo"; public static final String REM_TILES_CMD = "RemainingTiles"; + private static final String NETWORK_INFO_CMD = "NetworkInfo"; public static final String TAKE_LOANS_CMD = "TakeLoans"; public static final String REPAY_LOANS_CMD = "RepayLoans"; *************** *** 162,165 **** --- 166,170 ---- addTrainsInfo(); addPhasesInfo(); + addNetworkInfo(); specialMenu = new JMenu(LocalText.getText("SPECIAL")); *************** *** 557,560 **** --- 562,605 ---- } + protected void addNetworkInfo() { + CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager(); + + JMenu networkMenu = new JMenu(LocalText.getText("NetworkInfo")); + networkMenu.setEnabled(true); + infoMenu.add(networkMenu); + + JMenuItem item = new JMenuItem("All"); + item.addActionListener(this); + item.setActionCommand(NETWORK_INFO_CMD); + networkMenu.add(item); + + for (PublicCompanyI comp : cm.getAllPublicCompanies()) { + if (!comp.hasFloated() || comp.isClosed()) continue; + item = new JMenuItem(comp.getName()); + item.addActionListener(this); + item.setActionCommand(NETWORK_INFO_CMD); + networkMenu.add(item); + } + } + + protected void executeNetworkInfo(String companyName) { + + MapManager mapManager = orUIManager.getGameUIManager().getGameManager().getMapManager(); + + NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); + nwGraph.generateGraph(mapManager.getHexesAsList()); + SimpleGraph<NetworkVertex, NetworkEdge> graph; + graph = nwGraph.getMapGraph(); + + if (!companyName.equals("All")) { + CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager(); + PublicCompanyI company = cm.getCompanyByName(companyName); + graph = nwGraph.getRailRoadGraph(company); + } + NetworkGraphBuilder.visualize(graph, "Network of " + companyName); + NetworkGraphBuilder.optimizeGraph(graph); + NetworkGraphBuilder.visualize(graph, "Optimized Network of " + companyName); + } + private void appendInfoText (StringBuffer b, String text) { if (text == null || text.length() == 0) return; *************** *** 604,611 **** } else if (source == zoomOut) { orWindow.getMapPanel().zoomOut(); } else { orUIManager.processAction(command, null); } - } --- 649,658 ---- } else if (source == zoomOut) { orWindow.getMapPanel().zoomOut(); + } else if (command == NETWORK_INFO_CMD) { + JMenuItem item = (JMenuItem)actor.getSource(); + executeNetworkInfo(item.getText()); } else { orUIManager.processAction(command, null); } } |
From: Stefan F. <ste...@us...> - 2010-04-04 22:02:45
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19396/rails/algorithms Log Message: Directory /cvsroot/rails/18xx/rails/algorithms added to the repository |
From: Stefan F. <ste...@us...> - 2010-04-04 22:01:35
|
Update of /cvsroot/rails/18xx/lib/jgraph5 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv18861/lib/jgraph5 Added Files: jgraph.jar Log Message: Adding the two graph libraries jars --- NEW FILE: jgraph.jar --- (This appears to be a binary file; contents omitted.) |
From: Stefan F. <ste...@us...> - 2010-04-04 22:01:35
|
Update of /cvsroot/rails/18xx/lib/jgrapht-0.7.3 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv18861/lib/jgrapht-0.7.3 Added Files: jgrapht-jdk1.5.jar Log Message: Adding the two graph libraries jars --- NEW FILE: jgrapht-jdk1.5.jar --- (This appears to be a binary file; contents omitted.) |
From: Stefan F. <ste...@us...> - 2010-04-04 22:01:01
|
Update of /cvsroot/rails/18xx/lib/jgrapht-0.7.3 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv18844/lib/jgrapht-0.7.3 Log Message: Directory /cvsroot/rails/18xx/lib/jgrapht-0.7.3 added to the repository |
From: Stefan F. <ste...@us...> - 2010-04-04 22:01:01
|
Update of /cvsroot/rails/18xx/lib/jgraph5 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv18844/lib/jgraph5 Log Message: Directory /cvsroot/rails/18xx/lib/jgraph5 added to the repository |
From: Erik V. <ev...@us...> - 2010-04-02 20:04:03
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv8876/rails/game Modified Files: StockRound.java Log Message: 1835 Nationalisation Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** StockRound.java 27 Mar 2010 18:27:08 -0000 1.71 --- StockRound.java 2 Apr 2010 20:03:54 -0000 1.72 *************** *** 265,269 **** number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!mayPlayerBuyCompanyShare(currentPlayer, comp, number)) continue; /* Would the player exceed the total certificate limit? */ --- 265,269 ---- number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!checkAgainstHoldLimit(currentPlayer, comp, number)) continue; /* Would the player exceed the total certificate limit? */ *************** *** 296,300 **** cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; if (maxAllowedNumberOfSharesToBuy(currentPlayer, company, certs.get(0).getShare()) < 1) continue; --- 296,300 ---- cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!checkAgainstHoldLimit(currentPlayer, company, 1)) continue; if (maxAllowedNumberOfSharesToBuy(currentPlayer, company, certs.get(0).getShare()) < 1) continue; *************** *** 741,752 **** // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !mayPlayerBuyCompanyShare(currentPlayer, company, shares)) { ! errMsg = ! currentPlayer.getName() ! + LocalText.getText("WouldExceedHoldLimit"); break; } ! price = currentSpace.getPrice(); cost = shares * price / company.getShareUnitsForSharePrice(); --- 741,753 ---- // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !checkAgainstHoldLimit(currentPlayer, company, shares)) { ! errMsg = LocalText.getText("WouldExceedHoldLimit", ! currentPlayer.getName(), ! GameDef.Parm.PLAYER_SHARE_LIMIT.defaultValueAsInt()); break; } ! //price = currentSpace.getPrice(); ! price = getBuyPrice (action, currentSpace); cost = shares * price / company.getShareUnitsForSharePrice(); *************** *** 833,836 **** --- 834,842 ---- } + + /** Allow different price setting in subclasses (i.e. 1835 Nationalisation) */ + protected int getBuyPrice (BuyCertificate action, StockSpaceI currentSpace) { + return currentSpace.getPrice(); + } /** *************** *** 1143,1147 **** } /* Check if the player has room for a share of this company */ ! if (!mayPlayerBuyCompanyShare(player, publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = --- 1149,1153 ---- } /* Check if the player has room for a share of this company */ ! if (!checkAgainstHoldLimit(player, publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = *************** *** 1364,1368 **** for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { if (company.hasStarted() && company.hasStockPrice() ! && !mayPlayerBuyCompanyShare(player, company, 0)) return true; } --- 1370,1374 ---- for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { if (company.hasStarted() && company.hasStockPrice() ! && !checkAgainstHoldLimit(player, company, 0)) return true; } *************** *** 1390,1398 **** * shares of one company that a player may hold (typically 60%). * * @param company The company from which to buy ! * @param number The number of shares (usually 1 but not always so). * @return True if it is allowed. */ ! public boolean mayPlayerBuyCompanyShare(Player player, PublicCompanyI company, int number) { // Check for per-company share limit if (player.getPortfolio().getShare(company) --- 1396,1406 ---- * shares of one company that a player may hold (typically 60%). * + * @param player the buying player * @param company The company from which to buy ! * @param number The number of shares (usually 1 but not always so) * @return True if it is allowed. */ ! public boolean checkAgainstHoldLimit(Player player, PublicCompanyI company, ! int number) { // Check for per-company share limit if (player.getPortfolio().getShare(company) |
From: Erik V. <ev...@us...> - 2010-04-02 20:04:02
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv8876 Modified Files: LocalisedText.properties Log Message: 1835 Nationalisation Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** LocalisedText.properties 28 Mar 2010 20:14:20 -0000 1.124 --- LocalisedText.properties 2 Apr 2010 20:03:55 -0000 1.125 *************** *** 544,548 **** WORTH=Worth WouldExceedCertLimit=Would exceed certificate limit of {0}. ! WouldExceedHoldLimit=Would exceed holding limit of {0}%. WouldExceedTrainLimit=Would exceed train limit of {0} WouldExceedSharesAtPlayers=Number of loans ({0}) would exceed number of shares in player hands ({1}) --- 544,548 ---- WORTH=Worth WouldExceedCertLimit=Would exceed certificate limit of {0}. ! WouldExceedHoldLimit={0} would exceed holding limit of {0}%. WouldExceedTrainLimit=Would exceed train limit of {0} WouldExceedSharesAtPlayers=Number of loans ({0}) would exceed number of shares in player hands ({1}) |
From: Erik V. <ev...@us...> - 2010-04-02 20:04:02
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv8876/rails/ui/swing Modified Files: GridPanel.java GameStatus.java Log Message: 1835 Nationalisation Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** GameStatus.java 21 Mar 2010 17:43:50 -0000 1.45 --- GameStatus.java 2 Apr 2010 20:03:54 -0000 1.46 *************** *** 25,32 **** private static final long serialVersionUID = 1L; ! private static final String BUY_FROM_IPO_CMD = "BuyFromIPO"; ! private static final String BUY_FROM_POOL_CMD = "BuyFromPool"; ! private static final String SELL_CMD = "Sell"; ! private static final String CASH_CORRECT_CMD = "CorrectCash"; protected StatusWindow parent; --- 25,32 ---- private static final long serialVersionUID = 1L; ! protected static final String BUY_FROM_IPO_CMD = "BuyFromIPO"; ! protected static final String BUY_FROM_POOL_CMD = "BuyFromPool"; ! protected static final String SELL_CMD = "Sell"; ! protected static final String CASH_CORRECT_CMD = "CorrectCash"; protected StatusWindow parent; *************** *** 82,88 **** protected int rightCompCaptionXOffset; ! private Caption[] upperPlayerCaption; ! private Caption[] lowerPlayerCaption; ! private Caption treasurySharesCaption; protected Portfolio ipo, pool; --- 82,88 ---- protected int rightCompCaptionXOffset; ! protected Caption[] upperPlayerCaption; ! protected Caption[] lowerPlayerCaption; ! protected Caption treasurySharesCaption; protected Portfolio ipo, pool; *************** *** 516,522 **** dummyButton = new ClickField("", "", "", this, buySellGroup); - } ! public void actionPerformed(ActionEvent actor) { JComponent source = (JComponent) actor.getSource(); --- 516,521 ---- dummyButton = new ClickField("", "", "", this, buySellGroup); } ! public void actionPerformed(ActionEvent actor) { JComponent source = (JComponent) actor.getSource(); *************** *** 772,775 **** --- 771,775 ---- Portfolio holder; int index; + CashHolder owner; List<BuyCertificate> buyableCerts = *************** *** 780,788 **** index = cert.getCompany().getPublicNumber(); holder = bCert.getFromPortfolio(); if (holder == ipo) { setIPOCertButton(index, true, bCert); } else if (holder == pool) { setPoolCertButton(index, true, bCert); ! } else if (compCanHoldOwnShares) { setTreasuryCertButton(index, true, bCert); } --- 780,791 ---- index = cert.getCompany().getPublicNumber(); holder = bCert.getFromPortfolio(); + owner = holder.getOwner(); if (holder == ipo) { setIPOCertButton(index, true, bCert); } else if (holder == pool) { setPoolCertButton(index, true, bCert); ! } else if (owner instanceof Player) { ! setPlayerCertButton(index, ((Player)owner).getIndex(), true, bCert); ! } else if (owner instanceof PublicCompanyI && compCanHoldOwnShares) { setTreasuryCertButton(index, true, bCert); } *************** *** 881,886 **** setPlayerCertButton(i, j, clickable); if (clickable && o != null) { ! if (o instanceof PossibleAction) certPerPlayerButton[i][j].addPossibleAction((PossibleAction) o); } } --- 884,895 ---- setPlayerCertButton(i, j, clickable); if (clickable && o != null) { ! if (o instanceof PossibleAction) { certPerPlayerButton[i][j].addPossibleAction((PossibleAction) o); + if (o instanceof SellShares) { + certPerPlayerButton[i][j].setToolTipText(LocalText.getText("ClickForSell")); + } else if (o instanceof BuyCertificate) { + certPerPlayerButton[i][j].setToolTipText(LocalText.getText("ClickToSelectForBuying")); + } + } } } *************** *** 899,903 **** } ! private void setIPOCertButton(int i, boolean clickable, Object o) { setIPOCertButton(i, clickable); --- 908,912 ---- } ! protected void setIPOCertButton(int i, boolean clickable, Object o) { setIPOCertButton(i, clickable); *************** *** 908,912 **** } ! private void setIPOCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { --- 917,921 ---- } ! protected void setIPOCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { *************** *** 919,923 **** } ! private void setPoolCertButton(int i, boolean clickable, Object o) { setPoolCertButton(i, clickable); --- 928,932 ---- } ! protected void setPoolCertButton(int i, boolean clickable, Object o) { setPoolCertButton(i, clickable); *************** *** 928,932 **** } ! private void setPoolCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { --- 937,941 ---- } ! protected void setPoolCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { *************** *** 939,943 **** } ! private void setTreasuryCertButton(int i, boolean clickable, Object o) { setTreasuryCertButton(i, clickable); --- 948,952 ---- } ! protected void setTreasuryCertButton(int i, boolean clickable, Object o) { setTreasuryCertButton(i, clickable); *************** *** 948,952 **** } ! private void setTreasuryCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { --- 957,961 ---- } ! protected void setTreasuryCertButton(int i, boolean clickable) { boolean visible = rowVisibilityObservers[i].lastValue(); if (clickable) { *************** *** 959,963 **** } ! private void setCompanyCashButton(int i, boolean clickable, PossibleAction action){ boolean visible = rowVisibilityObservers[i].lastValue(); --- 968,972 ---- } ! protected void setCompanyCashButton(int i, boolean clickable, PossibleAction action){ boolean visible = rowVisibilityObservers[i].lastValue(); *************** *** 973,977 **** } ! private void setPlayerCashButton(int i, boolean clickable, PossibleAction action){ if (clickable) { --- 982,986 ---- } ! protected void setPlayerCashButton(int i, boolean clickable, PossibleAction action){ if (clickable) { Index: GridPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GridPanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GridPanel.java 14 Mar 2010 12:26:59 -0000 1.5 --- GridPanel.java 2 Apr 2010 20:03:54 -0000 1.6 *************** *** 128,132 **** } ! class RowVisibility implements ViewObject { private GridPanel parent; --- 128,132 ---- } ! public class RowVisibility implements ViewObject { private GridPanel parent; |
From: Erik V. <ev...@us...> - 2010-04-02 20:04:02
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv8876/rails/game/specific/_1835 Modified Files: StockRound_1835.java Log Message: 1835 Nationalisation Index: StockRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/StockRound_1835.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** StockRound_1835.java 27 Mar 2010 18:27:08 -0000 1.8 --- StockRound_1835.java 2 Apr 2010 20:03:55 -0000 1.9 *************** *** 5,9 **** --- 5,13 ---- package rails.game.specific._1835; + import java.util.ArrayList; + import java.util.List; + import rails.game.*; + import rails.game.action.BuyCertificate; import rails.util.LocalText; *************** *** 29,32 **** --- 33,86 ---- } + /** Add nationalisations */ + protected void setGameSpecificActions() { + if (!mayCurrentPlayerBuyAnything()) return; + if (companyBoughtThisTurnWrapper.getObject() != null) return; + + List<Player> otherPlayers = new ArrayList<Player>(); + Portfolio holder; + CashHolder owner; + Player otherPlayer; + int price; + int cash = currentPlayer.getCash(); + + for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { + if (!company.getTypeName().equalsIgnoreCase("Major")) continue; + if (!company.hasFloated()) continue; + if (company.getPresident() != currentPlayer) continue; + if (currentPlayer.getPortfolio().getShare(company) >= 55) { + otherPlayers.clear(); + for (PublicCertificateI cert : company.getCertificates()) { + holder = (Portfolio)cert.getHolder(); + owner = holder.getOwner(); + if (owner instanceof Player) { + otherPlayer = (Player) owner; + if (!otherPlayers.contains(otherPlayer)) { + price = (int)(1.5 * company.getCurrentPriceModel().getPrice().getPrice()); + if (price <= cash) { + possibleActions.add(new BuyCertificate (cert, holder, + (int)(1.5 * company.getCurrentPriceModel().getPrice().getPrice()), + 1)); + } + otherPlayers.add(otherPlayer); + } + } + } + } + } + } + + public boolean checkAgainstHoldLimit(Player player, PublicCompanyI company, int number) { + return true; + } + + protected int getBuyPrice (BuyCertificate action, StockSpaceI currentSpace) { + int price = currentSpace.getPrice(); + if (action.getFromPortfolio().getOwner() instanceof Player) { + price *= 1.5; + } + return price; + } + /** Share price goes down 1 space for any number of shares sold. */ |
From: Erik V. <ev...@us...> - 2010-04-02 20:04:02
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv8876/data/1835 Modified Files: Game.xml Log Message: 1835 Nationalisation Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/Game.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Game.xml 28 Mar 2010 20:14:20 -0000 1.30 --- Game.xml 2 Apr 2010 20:03:54 -0000 1.31 *************** *** 8,12 **** <GameOption name="UnlimitedTiles" type="toggle" default="no"/> <GameParameters> ! <PlayerShareLimit percentage="60"/> <BankPoolLimit percentage="50"/> <StockRound class="rails.game.specific._1835.StockRound_1835" --- 8,12 ---- <GameOption name="UnlimitedTiles" type="toggle" default="no"/> <GameParameters> ! <PlayerShareLimit percentage="100"/> <BankPoolLimit percentage="50"/> <StockRound class="rails.game.specific._1835.StockRound_1835" |