From: Stefan F. <ste...@us...> - 2012-01-30 10:50:40
|
.classpath | 25 LocalisedText.properties | 9 build.xml | 301 - buildRails.xml | 159 buildinfo.xml | 16 data/1835/CompanyManager.xml | 5 data/1870/TileSet.xml | 2 data/18AL/18AL_Map_gamekit.svg | 1435 ++++++ data/18AL/Map.xml | 1 data/18AL/TileSet.xml | 2 data/18Kaas/TileSet.xml | 2 data/Properties.xml | 2 dev/null |binary rails.bat | 3 rails.sh | 3 rails/common/parser/Config.java | 15 rails/game/Game.java | 31 rails/game/MapHex.java | 2 rails/game/MapManager.java | 2 rails/game/OperatingRound.java | 31 rails/game/Portfolio.java | 62 rails/game/PublicCompany.java | 6 rails/game/ShareSellingRound.java | 51 rails/game/StockRound.java | 117 rails/game/TreasuryShareRound.java | 77 rails/game/action/SellShares.java | 71 rails/game/model/ShareModel.java | 31 rails/game/model/ViewUpdate.java | 2 rails/game/specific/_1835/PrussianFormationRound.java | 18 rails/game/specific/_1835/StockRound_1835.java | 92 rails/game/specific/_1856/CGRFormationRound.java | 64 rails/ui/swing/GameStatus.java | 45 rails/ui/swing/ORPanel.java | 4 rails/ui/swing/elements/Field.java | 26 rails/ui/swing/hexmap/HexMapImage.java | 7 rails/util/GameFileIO.java | 225 test/SVGApplication.java | 105 test/SVGOffscreenLoader.java | 192 test/data/real/18EU_A.report | 4197 +++++++++--------- test/data/real/18GA_A.report | 1532 +----- test/data/test/1830_SellFullPresCert.rails |binary test/data/test/1830_SellFullPresCert.report | 267 + test/data/test/1830_SellHalfPresCert.rails |binary test/data/test/1830_SellHalfPresCert.report | 267 + test/data/test/1835_NatDoubleShare.rails |binary test/data/test/1835_NatDoubleShare.report | 884 +++ test/data/test/1835_NatSingleShare.rails |binary test/data/test/1835_NatSingleShare.report | 77 test/data/test/1835_PRHasTwoExcessTrains.rails |binary test/data/test/1835_PRHasTwoExcessTrains.report | 1141 ++++ test/data/test/1835_SwapPresForDoubleShare.rails |binary test/data/test/1835_SwapPresForDoubleShare.report | 77 version.number | 5 53 files changed, 7593 insertions(+), 4095 deletions(-) New commits: commit a689df92f8e36e14427fe7c5d95b9f9adb0c9152 Author: Stefan Frey <ste...@we...> Date: Wed Nov 30 22:44:14 2011 +0100 additional commit for 1.5.4: fixed issue with the develop flag and removed calibrate from menu (cherry picked from commit f3a0308761bca73a19bc6e7d4a7bd0e3d72c0e98) diff --git a/rails/common/parser/Config.java b/rails/common/parser/Config.java index 63308d1..c7f64ed 100644 --- a/rails/common/parser/Config.java +++ b/rails/common/parser/Config.java @@ -438,17 +438,18 @@ public final class Config { propertiesLoaded = true; } - /* Load version number as resource */ + /* Load version number and develop flag */ Properties versionNumber = new Properties(); loadPropertyFile(versionNumber, "version.number", true); + String version = versionNumber.getProperty("version"); - String develop = versionNumber.getProperty("develop"); if (Util.hasValue("version")) { - if (Util.hasValue(develop)) { - Game.version = version + "+"; - } else { - Game.version = version; - } + Game.setVersion(version); + } + + String develop = versionNumber.getProperty("develop"); + if (Util.hasValue(develop)) { + Game.setDevelop(develop != ""); } } diff --git a/rails/game/Game.java b/rails/game/Game.java index a24cbc5..de85c55 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,11 +14,37 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - // the correct version number is set during initialLoad in Config class - public static String version = "unknown"; - - public static String develop = "@DEVELOP@"; + // the correct version number and develop status + // is set during initialLoad in Config class + private static String version = "unknown"; + private static boolean develop = false; + public static void setVersion(String version) { + Game.version = version; + } + + public static String getVersion() { + return version; + } + + public static String getFullVersion() { + if (develop) { + return version + "+"; + } else { + return version; + } + } + + public static void setDevelop(boolean develop) { + Game.develop = develop; + } + + public static boolean getDevelop() { + return develop; + } + + // in the following the Game objects are defined + /** The component Manager */ protected GameManager gameManager; protected CompanyManagerI companyManager; diff --git a/rails/ui/swing/ORPanel.java b/rails/ui/swing/ORPanel.java index 8b6383c..0eaba7e 100644 --- a/rails/ui/swing/ORPanel.java +++ b/rails/ui/swing/ORPanel.java @@ -213,7 +213,7 @@ implements ActionListener, KeyListener, RevenueListener { zoomMenu.add(zoomOut); calibrateMap = new JMenuItem("CalibrateMap"); calibrateMap.addActionListener(this); - calibrateMap.setEnabled(true); + calibrateMap.setEnabled(Game.getDevelop()); zoomMenu.add(calibrateMap); menuBar.add(zoomMenu); @@ -599,7 +599,7 @@ implements ActionListener, KeyListener, RevenueListener { if (networkInfoMenu != null) infoMenu.remove(networkInfoMenu); networkInfoMenu = createNetworkInfo(); if (networkInfoMenu == null) return; - networkInfoMenu.setEnabled(true); + networkInfoMenu.setEnabled(Game.getDevelop()); infoMenu.add(networkInfoMenu); } diff --git a/rails/util/GameFileIO.java b/rails/util/GameFileIO.java index 628ba98..ec682df 100644 --- a/rails/util/GameFileIO.java +++ b/rails/util/GameFileIO.java @@ -240,7 +240,7 @@ public class GameFileIO { * sets the meta data required for a game save */ public void initSave(Long saveFileVersionID, String gameName, Map<String, String> gameOptions, List<String> playerNames) { - gameData.meta.version = Game.version+" "+BuildInfo.buildDate; + gameData.meta.version = Game.getFullVersion() +" "+BuildInfo.buildDate; gameData.meta.date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); gameData.meta.fileVersionID = saveFileVersionID; gameData.meta.gameName = gameName; commit 465f0034fed34180798c814a06dd2f4331ea27d1 Author: Stefan Frey <ste...@we...> Date: Wed Nov 30 13:16:24 2011 +0100 prepared release 1.5.4 (cherry picked from commit c400dd6d4270b8eb484f64d8e473faa1bf13213e) diff --git a/version.number b/version.number index b52774a..26b5665 100644 --- a/version.number +++ b/version.number @@ -1,5 +1,5 @@ #Property file that contains version number and the develop indicator -version=1.5.3 +version=1.5.4 # the following string "@DEVELOP@ is replaced by an empty string in the release version # this is done automatically by ant develop=@DEVELOP@ \ No newline at end of file commit 7be27cb6adbd294b0b022e14d7a7fb355797cd83 Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 16:34:12 2011 +0100 Further additions to get working build (cherry picked from commit afa0b856fe9eb2940de45b24d0eb29d0c03abf6c) diff --git a/.classpath b/.classpath index 25b28ed..d69b9b9 100644 --- a/.classpath +++ b/.classpath @@ -5,12 +5,25 @@ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2/log4j-1.2.14.jar"/> <classpathentry exported="true" kind="lib" path="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> <classpathentry exported="true" kind="lib" path="lib/jgraph5/jgraph.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/batik.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-bridge.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-dom.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-ext.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-gvt.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-util.jar"/> <classpathentry kind="lib" path="lib/junit-4.8.2/junit.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-transcoder.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-dom.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-swing.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-bridge.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xml-apis.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-ext.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-gui-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-awt-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-css.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-gvt.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-parser.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-script.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-svg-dom.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-xml.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/js.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xerces_2_5_0.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xml-apis-ext.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-anim.jar"/> <classpathentry kind="output" path="classes"/> </classpath> diff --git a/build.xml b/build.xml index 107fde2..2943231 100644 --- a/build.xml +++ b/build.xml @@ -16,17 +16,32 @@ <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> <pathelement location="lib/jgraph5/jgraph.jar"/> - <pathelement location="lib/batik-1.7/batik.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/junit-4.8.2/junit.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-transcoder.jar"/> <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-swing.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/batik-1.7/lib/xml-apis.jar"/> <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gui-util.jar"/> <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> - <pathelement location="lib/junit-4.8.2/junit.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-awt-util.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-css.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-parser.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-script.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-svg-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-xml.jar"/> + <pathelement location="lib/batik-1.7/lib/js.jar"/> + <pathelement location="lib/batik-1.7/lib/xerces_2_5_0.jar"/> + <pathelement location="lib/batik-1.7/lib/xml-apis-ext.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-anim.jar"/> </path> <target name="init"> <mkdir dir="classes"/> + <!-- this is added --> <copy includeemptydirs="false" todir="classes"> + <filterset refid="developFilter"/> <fileset dir="."> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> diff --git a/buildRails.xml b/buildRails.xml index 142d350..3185488 100644 --- a/buildRails.xml +++ b/buildRails.xml @@ -1,7 +1,13 @@ <?eclipse.ant.import ?> <!-- Extensions to the automatic ant file created by eclipse --> <project basedir="." default="build" name="Rails"> - + + <!-- Sourceforge properties --> + <property name="sf.uri" value="frs.sourceforge.net:/home/frs/project/r/ra/rails/"/> + <property name="sf.filedir" value="Rails/"/> + <property name="sf.user" value="stefanfrey"/> + <!-- Password is asked for --> + <!-- Define a property for the version number --> <property file="version.number"/> @@ -9,13 +15,14 @@ <filterset id="versionFilter"> <filter token="VERSION" value="${version}"/> </filterset> - + <!-- Define a filter to substitute develop tag to version number --> + <filterset id="developFilter"> + <filter token="DEVELOP" value=""/> + </filterset> + <!-- Clean the current release --> <target name="clean-release"> - <delete> - <fileset dir="jar"/> - <fileset dir="rails-${version}"/> - </delete> + <delete dir="rails-${version}"/> </target> <!-- Target that creates the release jar @@ -23,7 +30,6 @@ <target name="build-release" depends="clean-release,clean,build"> <mkdir dir="jar"/> <copy includeemptydirs="false" todir="jar"> - <filterset refid="versionFilter"/> <fileset dir="classes"> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> @@ -33,7 +39,6 @@ <exclude name="18xx.log"/> <exclude name="build.xml"/> <exclude name="buildinfo.xml"/> - <exclude name="user.profiles"/> <exclude name="manifest"/> <exclude name="doc/*"/> <exclude name="html/*"/> @@ -42,7 +47,6 @@ <exclude name="rails-*-${version}/**"/> <exclude name="rails.bat"/> <exclude name="rails.sh"/> - <exclude name="version.number"/> <exclude name=".project"/> <exclude name=".classpath"/> <exclude name=".git/**"/> @@ -54,36 +58,102 @@ </fileset> </copy> <mkdir dir="rails-${version}"/> + <copy includeemptydirs="false" todir="rails-${version}/lib"> + <fileset dir="./lib"> + <include name="log4j-1.2/log4j-1.2.14.jar" /> + <include name="jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + <include name="jgraph5/jgraph.jar" /> + <include name="junit-4.8.2/junit.jar" /> + <include name="batik-1.7/lib/batik-transcoder.jar" /> + <include name="batik-1.7/lib/batik-dom.jar" /> + <include name="batik-1.7/lib/batik-swing.jar" /> + <include name="batik-1.7/lib/batik-bridge.jar" /> + <include name="batik-1.7/lib/xml-apis.jar" /> + <include name="batik-1.7/lib/batik-ext.jar" /> + <include name="batik-1.7/lib/batik-gui-util.jar" /> + <include name="batik-1.7/lib/batik-util.jar" /> + <include name="batik-1.7/lib/batik-awt-util.jar" /> + <include name="batik-1.7/lib/batik-css.jar" /> + <include name="batik-1.7/lib/batik-gvt.jar" /> + <include name="batik-1.7/lib/batik-parser.jar" /> + <include name="batik-1.7/lib/batik-script.jar" /> + <include name="batik-1.7/lib/batik-svg-dom.jar" /> + <include name="batik-1.7/lib/batik-xml.jar" /> + <include name="batik-1.7/lib/js.jar" /> + <include name="batik-1.7/lib/xerces_2_5_0.jar" /> + <include name="batik-1.7/lib/xml-apis-ext.jar" /> + <include name="batik-1.7/lib/batik-anim.jar" /> + </fileset> + </copy> <copy includeemptydirs="false" todir="rails-${version}"> - <filterset refid="versionFilter"/> - <fileset dir="."> + <filterset refid="versionFilter"/> + <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> + <!-- adds executable flags to rails.sh --> + <chmod file="rails-${version}/rails.sh" perm="ugo+rx"/> + <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 + <attribute name="Class-Path" value=" ./LocalisedText.properties - ./lib/log4j-1.2/log4j-1.2.14.jar - ./lib/batik-1.7/batik.jar - ./lib/batik-1.7/lib/batik-util.jar - ./lib/batik-1.7/lib/batik-dom.jar - ./lib/batik-1.7/lib/batik-bridge.jar - ./lib/batik-1.7/lib/batik-ext.jar - ./lib/batik-1.7/lib/batik-gvt.jar - ./lib/jgraph5/jgraph.jar - ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + ./log4j.properties + ./lib/log4j-1.2/log4j-1.2.14.jar + ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar + ./lib/jgraph5/jgraph.jar + ./lib/junit-4.8.2/junit.jar + ./lib/batik-1.7/lib/batik-transcoder.jar + ./lib/batik-1.7/lib/batik-dom.jar + ./lib/batik-1.7/lib/batik-swing.jar + ./lib/batik-1.7/lib/batik-bridge.jar + ./lib/batik-1.7/lib/xml-apis.jar + ./lib/batik-1.7/lib/batik-ext.jar + ./lib/batik-1.7/lib/batik-gui-util.jar + ./lib/batik-1.7/lib/batik-util.jar + ./lib/batik-1.7/lib/batik-awt-util.jar + ./lib/batik-1.7/lib/batik-css.jar + ./lib/batik-1.7/lib/batik-gvt.jar + ./lib/batik-1.7/lib/batik-parser.jar + ./lib/batik-1.7/lib/batik-script.jar + ./lib/batik-1.7/lib/batik-svg-dom.jar + ./lib/batik-1.7/lib/batik-xml.jar + ./lib/batik-1.7/lib/js.jar + ./lib/batik-1.7/lib/xerces_2_5_0.jar + ./lib/batik-1.7/lib/xml-apis-ext.jar + ./lib/batik-1.7/lib/batik-anim.jar"/> </manifest> - </jar> - </target> - + </jar> + <delete dir="jar"/> + <tar destfile="../rails-${version}.tar.gz" compression="gzip"> + <!-- adds executable flags to rails.sh, has to be done again for the tar (see above) --> + <tarfileset dir="." filemode="755"> + <include name="rails-${version}/rails.sh"/> + </tarfileset> + <tarfileset dir="."> + <include name="rails-${version}/**"/> + <exclude name="rails-${version}/rails.sh"/> + </tarfileset> + </tar> + <zip destfile="../rails-${version}.zip" basedir="." includes="rails-${version}/**"/> + </target> + <target name="publish-release"> + <exec executable="rsync" dir=".." failonerror="true"> + <arg value="-avP"/> + <arg value="-e"/> + <arg value="ssh"/> + <arg value="rails-${version}.zip"/> + <arg value="rails-${version}.tar.gz"/> + <arg value="${sf.user},rails@${sf.uri}${sf.filedir}${version}/"/> + </exec> + <exec executable="scp" dir="../rails-${version}" failonerror="true"> + <arg value="Readme.txt"/> + <arg value="${sf.user},rails@${sf.uri}${sf.filedir}${version}/"/> + </exec> + </target> </project> \ No newline at end of file diff --git a/rails/common/parser/Config.java b/rails/common/parser/Config.java index b1895e7..63308d1 100644 --- a/rails/common/parser/Config.java +++ b/rails/common/parser/Config.java @@ -16,6 +16,7 @@ import java.util.Properties; import org.apache.log4j.Logger; +import rails.game.Game; import rails.game.GameManager; import rails.util.Util; @@ -436,6 +437,19 @@ public final class Config { loadProfile(selectedProfile); propertiesLoaded = true; } + + /* Load version number as resource */ + Properties versionNumber = new Properties(); + loadPropertyFile(versionNumber, "version.number", true); + String version = versionNumber.getProperty("version"); + String develop = versionNumber.getProperty("develop"); + if (Util.hasValue("version")) { + if (Util.hasValue(develop)) { + Game.version = version + "+"; + } else { + Game.version = version; + } + } } diff --git a/rails/game/Game.java b/rails/game/Game.java index 250e6b4..a24cbc5 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,7 +14,10 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - public static final String version = "@VERSION@"; + // the correct version number is set during initialLoad in Config class + public static String version = "unknown"; + + public static String develop = "@DEVELOP@"; /** The component Manager */ protected GameManager gameManager; diff --git a/test/SVGApplication.java b/test/SVGApplication.java deleted file mode 100644 index 8b583ec..0000000 --- a/test/SVGApplication.java +++ /dev/null @@ -1,105 +0,0 @@ -package test; - -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import javax.swing.*; - -import org.apache.batik.swing.JSVGCanvas; -import org.apache.batik.swing.gvt.GVTTreeRendererAdapter; -import org.apache.batik.swing.gvt.GVTTreeRendererEvent; -import org.apache.batik.swing.svg.SVGDocumentLoaderAdapter; -import org.apache.batik.swing.svg.SVGDocumentLoaderEvent; -import org.apache.batik.swing.svg.GVTTreeBuilderAdapter; -import org.apache.batik.swing.svg.GVTTreeBuilderEvent; - -public class SVGApplication { - - public static void main(String[] args) { - JFrame f = new JFrame("Batik"); - SVGApplication app = new SVGApplication(f); - f.getContentPane().add(app.createComponents()); - - f.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - f.setSize(400, 400); - f.setVisible(true); - } - - JFrame frame; - JButton button = new JButton("Load..."); - JLabel label = new JLabel(); - JSVGCanvas svgCanvas = new JSVGCanvas(); - - public SVGApplication(JFrame f) { - frame = f; - } - - public JComponent createComponents() { - final JPanel panel = new JPanel(new BorderLayout()); - - JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); - p.add(button); - p.add(label); - - panel.add("North", p); - panel.add("Center", svgCanvas); - - // Set the button action. - button.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent ae) { - JFileChooser fc = new JFileChooser("."); - int choice = fc.showOpenDialog(panel); - if (choice == JFileChooser.APPROVE_OPTION) { - File f = fc.getSelectedFile(); - try { - svgCanvas.setURI(f.toURL().toString()); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - }); - - // Set the JSVGCanvas listeners. - svgCanvas.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() { - - public void documentLoadingStarted(SVGDocumentLoaderEvent e) { - label.setText("Document Loading..."); - } - - public void documentLoadingCompleted(SVGDocumentLoaderEvent e) { - label.setText("Document Loaded."); - } - }); - - svgCanvas.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() { - - public void gvtBuildStarted(GVTTreeBuilderEvent e) { - label.setText("Build Started..."); - } - - public void gvtBuildCompleted(GVTTreeBuilderEvent e) { - label.setText("Build Done."); - frame.pack(); - } - }); - - svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() { - - public void gvtRenderingPrepare(GVTTreeRendererEvent e) { - label.setText("Rendering Started..."); - } - - public void gvtRenderingCompleted(GVTTreeRendererEvent e) { - label.setText(""); - } - }); - - return panel; - } -} diff --git a/test/SVGOffscreenLoader.java b/test/SVGOffscreenLoader.java deleted file mode 100644 index 5426d5f..0000000 --- a/test/SVGOffscreenLoader.java +++ /dev/null @@ -1,192 +0,0 @@ -package test; - -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.io.*; -import java.util.List; - -import org.apache.batik.bridge.*; -import org.apache.batik.dom.svg.SAXSVGDocumentFactory; -import org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam; -import org.apache.batik.ext.awt.image.codec.png.PNGImageEncoder; -import org.apache.batik.gvt.*; -import org.apache.batik.gvt.renderer.*; -import org.apache.batik.util.RunnableQueue; -import org.apache.batik.util.XMLResourceDescriptor; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class SVGOffscreenLoader { - - static final String SVGNS = "http://www.w3.org/2000/svg"; - - Document document; - UserAgentAdapter userAgent; - GVTBuilder builder; - BridgeContext ctx; - ImageRenderer renderer; - AffineTransform curTxf; - UpdateManager manager; - GraphicsNode gvtRoot; - int DISPLAY_WIDTH = 1280; - int DISPLAY_HEIGHT = 1024; - - public SVGOffscreenLoader(Document doc) { - userAgent = new UserAgentAdapter(); - ctx = new BridgeContext(userAgent); - builder = new GVTBuilder(); - document = doc; - } - - public void init() { - GraphicsNode gvtRoot = null; - - try { - ctx.setDynamicState(BridgeContext.DYNAMIC); - gvtRoot = builder.build(ctx, document); - } catch (BridgeException e) { - e.printStackTrace(); - System.exit(1); - } - - ImageRendererFactory rendererFactory; - rendererFactory = new ConcreteImageRendererFactory(); - renderer = rendererFactory.createDynamicImageRenderer(); - renderer.setDoubleBuffered(false); - - float docWidth = (float) ctx.getDocumentSize().getWidth(); - float docHeight = (float) ctx.getDocumentSize().getHeight(); - - float xscale = DISPLAY_WIDTH / docWidth; - float yscale = DISPLAY_HEIGHT / docHeight; - float scale = Math.min(xscale, yscale); - - AffineTransform px = AffineTransform.getScaleInstance(scale, scale); - - double tx = -0 + (DISPLAY_WIDTH / scale - docWidth) / 2; - double ty = -0 + (DISPLAY_WIDTH / scale - docHeight) / 2; - px.translate(tx, ty); - CanvasGraphicsNode cgn = getGraphicsNode(gvtRoot); - if (cgn != null) { - cgn.setViewingTransform(px); - curTxf = new AffineTransform(); - } else { - curTxf = px; - } - manager = new UpdateManager(ctx, gvtRoot, document); - // 'setMinRepaintTime' was added to SVN. This isn't - // essential but prevents 'frame skipping' (useful - // for "recording" content, not needed for live display). - // manager.setMinRepaintTime(-1); - - try { - manager.dispatchSVGLoadEvent(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - - renderer.updateOffScreen(DISPLAY_WIDTH, DISPLAY_HEIGHT); - renderer.setTree(gvtRoot); - renderer.setTransform(curTxf); - renderer.clearOffScreen(); - renderer.repaint(new Rectangle(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT)); - manager.addUpdateManagerListener(new UpdateManagerAdapter() { - - @Override - public void updateCompleted(UpdateManagerEvent e) { - render(e.getImage()); - } - - @Override - public void managerSuspended(UpdateManagerEvent e) { - // Make sure pending updates are completed. - System.exit(0); - } - }); - manager.manageUpdates(renderer); - this.gvtRoot = gvtRoot; - } - - private CanvasGraphicsNode getGraphicsNode(GraphicsNode gn) { - if (!(gn instanceof CompositeGraphicsNode)) return null; - CompositeGraphicsNode cgn = (CompositeGraphicsNode) gn; - List<?> children = cgn.getChildren(); - if (children.size() == 0) return null; - gn = (GraphicsNode) children.get(0); - if (!(gn instanceof CanvasGraphicsNode)) return null; - return (CanvasGraphicsNode) gn; - - } - - int imgCount = 1; - - public void render(java.awt.image.BufferedImage img) { - // paint the image or stream the image to the client display - try { - String file = "frame." + (imgCount++) + ".png"; - System.err.println("Output: " + file); - OutputStream os = new FileOutputStream(file); - - PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); - PNGImageEncoder pngEncoder = new PNGImageEncoder(os, params); - pngEncoder.encode(img); - os.flush(); - } catch (IOException ioe) { - ioe.printStackTrace(); - } - } - - /** - * @param args - */ - public static void main(String[] args) { - /* - * if (args.length < 1) { System.out.println("You must provide - * background SVG file"); System.exit(1); } - */ - String docStr = "tiles/svg/tile-901.svg"; - - String xmlParser = XMLResourceDescriptor.getXMLParserClassName(); - SAXSVGDocumentFactory df; - df = new SAXSVGDocumentFactory(xmlParser); - Document doc = null; - SVGOffscreenLoader render = null; - Element r = null; - try { - File f = new File(docStr); - doc = df.createSVGDocument(f.toURL().toString()); - r = doc.createElementNS(SVGNS, "rect"); - r.setAttributeNS(null, "x", "100"); - r.setAttributeNS(null, "y", "200"); - r.setAttributeNS(null, "width", "200"); - r.setAttributeNS(null, "height", "150"); - r.setAttributeNS(null, "fill", "crimson"); - r.setAttributeNS(null, "stroke", "gold"); - r.setAttributeNS(null, "stroke-width", "3"); - doc.getDocumentElement().appendChild(r); - render = new SVGOffscreenLoader(doc); - render.init(); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.exit(0); - } - - final Element rect = r; - - RunnableQueue rq = render.manager.getUpdateRunnableQueue(); - for (int i = 1; i < 10; i++) { - final int x = 100 + (i * 10); - try { - rq.invokeAndWait(new Runnable() { - - public void run() { - rect.setAttributeNS(null, "x", "" + x); - } - }); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - render.manager.suspend(); - } -} diff --git a/tools/lib/jarbundler-2.1.0.jar b/tools/lib/jarbundler-2.1.0.jar deleted file mode 100644 index 5127987..0000000 Binary files a/tools/lib/jarbundler-2.1.0.jar and /dev/null differ diff --git a/version.number b/version.number index 72b919f..b52774a 100644 --- a/version.number +++ b/version.number @@ -1,2 +1,5 @@ -#Property file that contains only the version number -version=1.5.3+ \ No newline at end of file +#Property file that contains version number and the develop indicator +version=1.5.3 +# the following string "@DEVELOP@ is replaced by an empty string in the release version +# this is done automatically by ant +develop=@DEVELOP@ \ No newline at end of file commit 65ea6b36afb28670781bb27dc40030d69f0df297 Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 13:37:11 2011 +0100 Updated ant build files to increase automation diff --git a/build.xml b/build.xml index 3900603..107fde2 100644 --- a/build.xml +++ b/build.xml @@ -1,180 +1,112 @@ <?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.5.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.7/batik.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> - <pathelement location="lib/jgraph5/jgraph.jar"/> - <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> - <pathelement location="lib/junit-4.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="test/**"/> - <exclude name="tiles/*.*"/> - <exclude name="18xx.log"/> - <exclude name="build.xml"/> - <exclude name="buildinfo.xml"/> - <exclude name="user.profiles"/> - <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=".git/**"/> - <exclude name=".gitignore"/> - <exclude name="Rails-format.xml"/> - <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.7/batik.jar - ./lib/batik-1.7/lib/batik-util.jar - ./lib/batik-1.7/lib/batik-dom.jar - ./lib/batik-1.7/lib/batik-bridge.jar - ./lib/batik-1.7/lib/batik-ext.jar - ./lib/batik-1.7/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> - + 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="Rails"> + <property environment="env"/> + <property name="junit.output.dir" value="junit"/> + <property name="debuglevel" value="source,lines,vars"/> + <property name="target" value="1.5"/> + <property name="source" value="1.5"/> + <import file="buildRails.xml"/> + <path id="Rails.classpath"> + <pathelement location="classes"/> + <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> + <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> + <pathelement location="lib/jgraph5/jgraph.jar"/> + <pathelement location="lib/batik-1.7/batik.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> + <pathelement location="lib/junit-4.8.2/junit.jar"/> + </path> + <target name="init"> + <mkdir dir="classes"/> + <copy includeemptydirs="false" todir="classes"> + <fileset dir="."> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/junit-4.8.2"/> + <exclude name="lib/log4j-1.2/"/> + <exclude name="lib/log4j-1.2/"/> + </fileset> + </copy> + </target> + <target name="clean"> + <delete dir="classes"/> + </target> + <target depends="clean" name="cleanall"/> + <target depends="build-subprojects,build-project" 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" includeantruntime="false" source="${source}" target="${target}"> + <src path="."/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/junit-4.8.2"/> + <exclude name="lib/log4j-1.2/"/> + <exclude name="lib/log4j-1.2/"/> + <classpath refid="Rails.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="TestGameBuilder (1)"> + <java classname="test.TestGameBuilder" failonerror="true" fork="yes"> + <classpath refid="Rails.classpath"/> + </java> + </target> + <target name="RunGame"> + <java classname="rails.util.RunGame" failonerror="true" fork="yes"> + <jvmarg line="-DRevenueCalculation=suggest -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"/> + <classpath refid="Rails.classpath"/> + </java> + </target> + <target name="TestGameBuilder"> + <mkdir dir="${junit.output.dir}"/> + <junit fork="yes" printsummary="withOutAndErr"> + <formatter type="xml"/> + <test name="test.TestGameBuilder" todir="${junit.output.dir}"/> + <classpath refid="Rails.classpath"/> + </junit> + </target> + <target name="junitreport"> + <junitreport todir="${junit.output.dir}"> + <fileset dir="${junit.output.dir}"> + <include name="TEST-*.xml"/> + </fileset> + <report format="frames" todir="${junit.output.dir}"/> + </junitreport> + </target> </project> diff --git a/buildRails.xml b/buildRails.xml new file mode 100644 index 0000000..142d350 --- /dev/null +++ b/buildRails.xml @@ -0,0 +1,89 @@ +<?eclipse.ant.import ?> + <!-- Extensions to the automatic ant file created by eclipse --> +<project basedir="." default="build" name="Rails"> + + <!-- Define a property for the version number --> + <property file="version.number"/> + + <!-- Define a filter to substitute version number --> + <filterset id="versionFilter"> + <filter token="VERSION" value="${version}"/> + </filterset> + + <!-- Clean the current release --> + <target name="clean-release"> + <delete> + <fileset dir="jar"/> + <fileset dir="rails-${version}"/> + </delete> + </target> + + <!-- Target that creates the release jar + this is legacy code --> + <target name="build-release" depends="clean-release,clean,build"> + <mkdir dir="jar"/> + <copy includeemptydirs="false" todir="jar"> + <filterset refid="versionFilter"/> + <fileset dir="classes"> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="rails/test/*"/> + <exclude name="test/**"/> + <exclude name="tiles/*.*"/> + <exclude name="18xx.log"/> + <exclude name="build.xml"/> + <exclude name="buildinfo.xml"/> + <exclude name="user.profiles"/> + <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="version.number"/> + <exclude name=".project"/> + <exclude name=".classpath"/> + <exclude name=".git/**"/> + <exclude name=".gitignore"/> + <exclude name="Rails-format.xml"/> + <exclude name="**/CVS/*"/> + <exclude name="**/.settings/*"/> + <exclude name="**/rails-${version}.jar"/> + </fileset> + </copy> + <mkdir dir="rails-${version}"/> + <copy includeemptydirs="false" todir="rails-${version}"> + <filterset refid="versionFilter"/> + <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.7/batik.jar + ./lib/batik-1.7/lib/batik-util.jar + ./lib/batik-1.7/lib/batik-dom.jar + ./lib/batik-1.7/lib/batik-bridge.jar + ./lib/batik-1.7/lib/batik-ext.jar + ./lib/batik-1.7/lib/batik-gvt.jar + ./lib/jgraph5/jgraph.jar + ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + </manifest> + </jar> + </target> + +</project> \ No newline at end of file diff --git a/buildinfo.xml b/buildinfo.xml deleted file mode 100644 index 6c1fb15..0000000 --- a/buildinfo.xml +++ /dev/null @@ -1,16 +0,0 @@ -<!-- Generate a java class with the current svn revision number --> -<project name="buildinfo " default="makeBuildInfo" basedir="."> - <target name="makeBuildInfo" description="Create a BuildInfo source"> - <tstamp> - <format property="TODAY" pattern="yyyy-MM-dd"/> - </tstamp> - <!-- the source code of the java class --> - <echo file="${basedir}/rails/util/BuildInfo.java"> -package rails.util; - -public class BuildInfo { - public static final String buildDate = "${TODAY}"; -} -</echo> - </target> -</project> \ No newline at end of file diff --git a/rails.bat b/rails.bat index a314500..515bc30 100644 --- a/rails.bat +++ b/rails.bat @@ -1,2 +1 @@ - -java -jar rails-1.5.3.jar %1 \ No newline at end of file +java -jar rails-@VERSION@.jar %1 diff --git a/rails.sh b/rails.sh index ec6c136..91b8bbd 100644 --- a/rails.sh +++ b/rails.sh @@ -1,3 +1,2 @@ #!/bin/bash - -java -jar ./rails-1.5.3.jar $1 \ No newline at end of file +java -jar ./rails-@VERSION@.jar $1 diff --git a/rails/game/Game.java b/rails/game/Game.java index 2ca9752..250e6b4 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,7 +14,7 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - public static final String version = "1.5.3"; + public static final String version = "@VERSION@"; /** The component Manager */ protected GameManager gameManager; diff --git a/version.number b/version.number new file mode 100644 index 0000000..72b919f --- /dev/null +++ b/version.number @@ -0,0 +1,2 @@ +#Property file that contains only the version number +version=1.5.3+ \ No newline at end of file commit e393b4f6911123f70a977d35e9e22718afd82887 Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 11:42:11 2011 +0100 Fixed reference in properties file for the setLocale method as the class was moved previously(cherry picked from commit 760a9358b8a2e9e16e0b7542c5df9a1c64e188d5) diff --git a/data/Properties.xml b/data/Properties.xml index b54129b..eb95d4c 100644 --- a/data/Properties.xml +++ b/data/Properties.xml @@ -4,7 +4,7 @@ <Properties> <Section name="General"> <Property name="locale" type="LIST" values="en_US,te_ST" - initClass="rails.util.LocalText" initMethod="setLocale" + initClass="rails.common.LocalText" initMethod="setLocale" initParameter="yes" /> <Property name="default_game" type="STRING" /> <Property name="default_players" type="STRING" /> commit ab859d02322c58ecfeb24b607fd14f50d39d7f26 Author: Stefan Frey <ste...@we...> Date: Fri Nov 25 15:15:47 2011 +0100 Fixed bug that prevented loading MapImage from jar(cherry picked from commit 572d4fa812f40923634d460a94236d4d94b5a453) diff --git a/rails/game/MapManager.java b/rails/game/MapManager.java index dd85c46..f45dd10 100644 --- a/rails/game/MapManager.java +++ b/rails/game/MapManager.java @@ -245,7 +245,7 @@ public class MapManager implements ConfigurableComponentI { if (!rails.util.Util.hasValue(rootDirectory)) { rootDirectory = "data"; } - mapImageFilepath = rootDirectory + "/" + mapImageFilename; + mapImageFilepath = "/" + rootDirectory + "/" + mapImageFilename; } for (String hexName : mHexes.keySet()) { diff --git a/rails/ui/swing/hexmap/HexMapImage.java b/rails/ui/swing/hexmap/HexMapImage.java index e360245..a1435e6 100644 --- a/rails/ui/swing/hexmap/HexMapImage.java +++ b/rails/ui/swing/hexmap/HexMapImage.java @@ -67,9 +67,10 @@ public final class HexMapImage extends JSVGCanvas { private void loadMap() { try { - File imageFile = new File (mapManager.getMapImageFilepath()); - setURI(imageFile.toURI().toString()); - log.debug("ImageFile="+ imageFile.getName()); +// File imageFile = new File (mapManager.getMapImageFilepath()); +// setURI(imageFile.toURI().toString()); +// log.debug("ImageFile="+ imageFile.getName()); + setURI(getClass().getResource(mapManager.getMapImageFilepath()).toString()); } catch (Exception e) { log.error ("Cannot load map image file " + mapManager.getMapImageFilepath(), e); } commit e4c179c4deee4e2db6a10deb5ecd23b820412c3b Author: Erik Vos <eri...@xs...> Date: Fri Nov 25 11:06:41 2011 +0100 Interrupted load now reports action count. Three test cases refreshed again.(cherry picked from commit a638a2bd036c47a706c0545859310cecfd135b79) diff --git a/LocalisedText.properties b/LocalisedText.properties index 5d32604..ac33c51 100644 --- a/LocalisedText.properties +++ b/LocalisedText.properties @@ -362,7 +362,7 @@ LoadFailed=Load failed.\n\Reason = {0}\n\To improve Rails please submit save fil LoadGame=Load Game LoadRecentGame=Load Recent LOAD=Load -LoadInterrupted=Load interrupted at this point, you can continue play from here.\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li... +LoadInterrupted=Load interrupted at action {0}, you can continue play from here.\n\To improve Rails please submit save file to Rails user list at \n\ rai...@li... LoansNotAllowed={0} may not take any loans Major=Major MAP=Map diff --git a/rails/util/GameFileIO.java b/rails/util/GameFileIO.java index 59f0142..628ba98 100644 --- a/rails/util/GameFileIO.java +++ b/rails/util/GameFileIO.java @@ -1,29 +1,15 @@ package rails.util; -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; +import java.io.*; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; +import java.util.*; import org.apache.log4j.Logger; import rails.common.DisplayBuffer; import rails.common.LocalText; import rails.common.parser.ConfigurationException; -import rails.game.Game; -import rails.game.GameManager; -import rails.game.GameManagerI; -import rails.game.ReportBuffer; +import rails.game.*; import rails.game.action.PossibleAction; /** @@ -36,7 +22,7 @@ public class GameFileIO { protected static Logger log = Logger.getLogger(Game.class.getPackage().getName()); - + private GameData gameData = new GameData(); // fields for data load @@ -44,26 +30,26 @@ public class GameFileIO { private Game loadedGame = null; private boolean dataLoadDone = false; private boolean initialized = false; - + // fields for data save private boolean initSave = false; public String getGameDataAsText() { return gameData.metaDataAsText() + gameData.gameOptionsAsText() + gameData.playerNamesAsText(); } - + public Game getGame() { return loadedGame; } - + public List<PossibleAction> getActions() { return gameData.actions; } - + public void setActions(List<PossibleAction> actions) { gameData.actions = actions; } - + public SortedMap<Integer, String> getComments() { return gameData.userComments; } @@ -71,12 +57,12 @@ public class GameFileIO { public void setComments(SortedMap<Integer, String> comments) { gameData.userComments = comments; } - + @SuppressWarnings("unchecked") public void loadGameData(String filepath) { dataLoadDone = true; - + log.info("Loading game from file " + filepath); String filename = filepath.replaceAll(".*[/\\\\]", ""); @@ -93,7 +79,7 @@ public class GameFileIO { // Allow for older saved file versions. gameData.meta.version = "pre-1.0.7"; } - + log.info("Reading Rails " + gameData.meta.version +" saved file "+filename); if (object instanceof String) { @@ -106,30 +92,30 @@ public class GameFileIO { gameData.meta.fileVersionID = (Long) object; log.debug("Saved versionID="+gameData.meta.fileVersionID+" (object="+object+")"); long GMsaveFileVersionID = GameManager.saveFileVersionID; - + if (gameData.meta.fileVersionID != GMsaveFileVersionID) { throw new Exception("Save version " + gameData.meta.fileVersionID - + " is incompatible with current version " - + GMsaveFileVersionID); + + " is incompatible with current version " + + GMsaveFileVersionID); } // read name of saved game gameData.meta.gameName = (String) ois.readObject(); log.debug("Saved game="+ gameData.meta.gameName); - + // read selected game options and player names gameData.gameOptions = (Map<String, String>) ois.readObject(); log.debug("Selected game options = " + gameData.gameOptions); gameData.playerNames = (List<String>) ois.readObject(); log.debug("Player names = " + gameData.playerNames); - + } catch (Exception e) { dataLoadDone = false; log.fatal("Load failed", e); DisplayBuffer.add(LocalText.getText("LoadFailed", e.getMessage())); } } - + public Game initGame() throws ConfigurationException { // check if initial load was done @@ -152,105 +138,108 @@ public class GameFileIO { return loadedGame; } - - + + @SuppressWarnings("unchecked") public boolean loadActionsAndComments() throws ConfigurationException { if (!dataLoadDone) { throw new ConfigurationException("No game was loaded"); } - // Read game actions into gameData.listOfActions - try { - // read next object in stream - Object actionObject = null; - while (true) { // Single-pass loop. - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - // Allow saved file at start of game (with no actions). - break; - - } - if (actionObject instanceof List) { - // Until Rails 1.3: one List of PossibleAction - gameData.actions = (List<PossibleAction>) actionObject; - } else if (actionObject instanceof PossibleAction) { - gameData.actions = new ArrayList<PossibleAction>(); - // Since Rails 1.3.1: separate PossibleActionsObjects - while (actionObject instanceof PossibleAction) { - gameData.actions.add((PossibleAction)actionObject); - try { - actionObject = ois.readObject(); - } catch (EOFException e) { - break; - } - } - } - break; - } - /** + // Read game actions into gameData.listOfActions + try { + // read next object in stream + Object actionObject = null; + while (true) { // Single-pass loop. + try { + actionObject = ois.readObject(); + } catch (EOFException e) { + // Allow saved file at start of game (with no actions). + break; + + } + if (actionObject instan... [truncated message content] |