summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-16 19:08:33 +0000
committerrubidium <rubidium@openttd.org>2010-01-16 19:08:33 +0000
commit251ffaa000b66821ba3133db154336ab847f57b9 (patch)
tree7ee50b7519244f92e5e07c207f9266c4f9407bbe /src/saveload
parent7e7ec4f25043e7218b6b40f5be42c71a3abc3a12 (diff)
downloadopenttd-251ffaa000b66821ba3133db154336ab847f57b9.tar.xz
(svn r18831) -Change [FS#3537]: do not go into the crashlog handler in case loading a savegame misses with missing NewGRFs. This way the load game crash handler gets better visibility and the user is instructed to find the missing NewGRFs before filing a bug report
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp15
-rw-r--r--src/saveload/saveload.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 0a4c44a45..72c0635d0 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -311,6 +311,19 @@ static const GRFIdentifier *GetOverriddenIdentifier(const GRFConfig *c)
return c;
}
+/** Was the saveload crash because of missing NewGRFs? */
+static bool _saveload_crash_with_missing_newgrfs = false;
+
+/**
+ * Did loading the savegame cause a crash? If so,
+ * were NewGRFs missing?
+ * @return when the saveload crashed due to missing NewGRFs.
+ */
+bool SaveloadCrashWithMissingNewGRFs()
+{
+ return _saveload_crash_with_missing_newgrfs;
+}
+
/**
* Signal handler used to give a user a more useful report for crashes during
* the savegame loading process; especially when there's problems with the
@@ -342,11 +355,13 @@ static void CDECL HandleSavegameLoadCrash(int signum)
char buf[40];
md5sumToString(buf, lastof(buf), replaced->md5sum);
p += seprintf(p, lastof(buffer), "NewGRF %08X (checksum %s) not found.\n Loaded NewGRF \"%s\" with same GRF ID instead.\n", BSWAP32(c->grfid), buf, c->filename);
+ _saveload_crash_with_missing_newgrfs = true;
}
if (c->status == GCS_NOT_FOUND) {
char buf[40];
md5sumToString(buf, lastof(buf), c->md5sum);
p += seprintf(p, lastof(buffer), "NewGRF %08X (%s) not found; checksum %s.\n", BSWAP32(c->grfid), c->filename, buf);
+ _saveload_crash_with_missing_newgrfs = true;
}
}
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 91ccf3404..b5218456c 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -324,6 +324,8 @@ void SlArray(void *array, size_t length, VarType conv);
void SlObject(void *object, const SaveLoad *sld);
bool SlObjectMember(void *object, const SaveLoad *sld);
+bool SaveloadCrashWithMissingNewGRFs();
+
extern char _savegame_format[8];
#endif /* SAVELOAD_H */