rails/common/parser/Config.java | 15 ++++++++-------
rails/game/Game.java | 34 ++++++++++++++++++++++++++++++----
rails/ui/swing/ORPanel.java | 4 ++--
rails/util/GameFileIO.java | 2 +-
4 files changed, 41 insertions(+), 14 deletions(-)
New commits:
commit f3a0308761bca73a19bc6e7d4a7bd0e3d72c0e98
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
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;
|