summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;
}