summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-02-05 20:22:01 +0000
committerrubidium <rubidium@openttd.org>2010-02-05 20:22:01 +0000
commit64ead0b513b103f04d98606a3819b8afceab1830 (patch)
treeb5b065288dddec5843798aa5a49d11496de34619 /src
parenta126db6ea4e9e5ca418b5a49b8e3fae8fbbd8ab9 (diff)
downloadopenttd-64ead0b513b103f04d98606a3819b8afceab1830.tar.xz
(svn r19022) -Fix (r18770): loading old (0.1-ish) savegames failed
Diffstat (limited to 'src')
-rw-r--r--src/saveload/saveload.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index e41213556..2a457921b 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1916,7 +1916,17 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
fseek(_sl.fh, pos, SEEK_SET);
_sl_version = 0;
_sl_minor_version = 0;
- fmt = _saveload_formats + 1; // LZO
+
+ /* Try to find the LZO savegame format; it uses 'OTTD' as tag. */
+ fmt = _saveload_formats;
+ for (;;) {
+ if (fmt == endof(_saveload_formats)) {
+ /* Who removed LZO support? Bad bad boy! */
+ NOT_REACHED();
+ }
+ if (fmt->tag == TO_BE32X('OTTD')) break;
+ fmt++;
+ }
break;
}