rails/game/GameManager.java | 13 +++++++------
rails/ui/swing/GameSetupWindow.java | 3 ++-
2 files changed, 9 insertions(+), 7 deletions(-)
New commits:
commit ee46d990d508904fc6a542f20f8b4c30c53f4203
Author: frederickweld <fre...@gm...>
Date: Tue Dec 27 19:41:21 2011 +0100
Fixed retrieval of default game options (if options pane was not opened)
Game options have to be read from GamesList.xml and not from the
respective game's Games.xml GameOption tags.
Before the fix, this was not the case if the options pane had not been
opened (which is the moment at which the GamesList's default options
were loaded).
This fix also solves Bug 3448429, as the reported missing 18EU route
calculation was due to inconsistent defaulting between GamesList
(default=suggest) and Games (default=deactivate). Now, the defaults
are always taken from GamesList.
diff --git a/rails/ui/swing/GameSetupWindow.java b/rails/ui/swing/GameSetupWindow.java
index 3f282b1..d9652ec 100644
--- a/rails/ui/swing/GameSetupWindow.java
+++ b/rails/ui/swing/GameSetupWindow.java
@@ -477,10 +477,11 @@ public class GameSetupWindow extends JDialog implements ActionListener {
log.info("Game option " + option.getName() + " set to " + value);
}
} else {
- // No options selected: take the defaults
GameOption option;
String value;
+ // No options selected: take the defaults (from the games list!)
+ availableOptions = this.getSelectedGameInfo().getOptions();
for (int i = 0; i < availableOptions.size(); i++) {
option = availableOptions.get(i);
value = option.getDefaultValue();
commit 9d832d70a9f91944f1e1d8fba124f97c00f097cd
Author: frederickweld <fre...@gm...>
Date: Tue Dec 27 17:48:19 2011 +0100
Fixed autosave functionality (handling of 18xx_autosave.xxx files)
Target design is that
(1) new temp file (.tmp) is created
(2) former autosave (.rails) becomes the backup autosave (.rails.bak)
(3) temp file (.tmp) becomes the new autosave (.rails)
Prior to the fix, the implementation did not process step (2) correctly,
as backup autosaves were never dropped. This meant that autosave resulted
in an error message and three files in the autosave folder (.tmp , .rails ,
.rails.bak). That's why autosave had never worked for me (and I doubt that
it could have worked for others).
diff --git a/rails/game/GameManager.java b/rails/game/GameManager.java
index 486b24a..8046968 100644
--- a/rails/game/GameManager.java
+++ b/rails/game/GameManager.java
@@ -1102,7 +1102,7 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
// rename the temp file to the recover file
File recoveryFile = null;
- boolean result;
+ boolean result = false;
try {
log.debug("Created temporary recovery file, path = " + tempFile.getPath());
// check if previous save file exists
@@ -1111,11 +1111,12 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
if (recoveryFile.exists()) {
log.debug("Potential recovery filePath = " + recoveryFile.getPath());
File backupFile = new File(filePath + ".bak");
- if (recoveryFile.renameTo(backupFile)) {
- result = tempFile.renameTo(recoveryFile);
- } else {
- result = backupFile.renameTo(recoveryFile);
- }
+ //delete backup file if existing
+ if (backupFile.exists()) backupFile.delete();
+ //old recovery file becomes new backup file
+ recoveryFile.renameTo(backupFile);
+ //temp file becomes new recoveryFile
+ result = tempFile.renameTo(recoveryFile);
} else {
log.debug("Tries to rename temporary file");
result = tempFile.renameTo(recoveryFile);
|