diff options
author | rubidium <rubidium@openttd.org> | 2009-08-22 20:20:20 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-08-22 20:20:20 +0000 |
commit | 31a6ce56432f31a973d9adbf60c76f01d8dc4a9a (patch) | |
tree | 53409a8b9d8f587d2656b01ffd46ed4dc8a04ba2 | |
parent | f74b7d4ebd4b327a882542c0d30119abeeb019cf (diff) | |
download | openttd-31a6ce56432f31a973d9adbf60c76f01d8dc4a9a.tar.xz |
(svn r17267) -Change [FS#3139]: mention the MD5 checksum of the original NewGRF in the "saveload failed horribly"-error message and make it more clear that the filename is of the current NewGRF
-rw-r--r-- | src/saveload/afterload.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index de5916370..2730e17d9 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -18,6 +18,7 @@ #include "../train.h" #include "../string_func.h" #include "../gamelog.h" +#include "../gamelog_internal.h" #include "../network/network.h" #include "../gfxinit.h" #include "../functions.h" @@ -275,6 +276,24 @@ static void ResetSignalHandlers() } /** + * Try to find the overridden GRF identifier of the given GRF. + * @param c the GRF to get the 'previous' version of. + * @return the GRF identifier or \a c if none could be found. + */ +static const GRFIdentifier *GetOverriddenIdentifier(const GRFConfig *c) +{ + const LoggedAction *la = &_gamelog_action[_gamelog_actions - 1]; + if (la->at != GLAT_LOAD) return c; + + const LoggedChange *lcend = &la->change[la->changes]; + for (const LoggedChange *lc = la->change; lc != lcend; lc++) { + if (lc->ct == GLCT_GRFCOMPAT && lc->grfcompat.grfid == c->grfid) return &lc->grfcompat; + } + + return c; +} + +/** * 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 * NewGRFs that are required by the savegame. @@ -299,16 +318,17 @@ static void CDECL HandleSavegameLoadCrash(int signum) "savegame still crashes when all NewGRFs are found you should file a\n" "bug report. The missing NewGRFs are:\n"); - for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) { + for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) { if (HasBit(c->flags, GCF_COMPATIBLE)) { + const GRFIdentifier *replaced = GetOverriddenIdentifier(c); char buf[40]; - md5sumToString(buf, lastof(buf), c->md5sum); - p += seprintf(p, lastof(buffer), "NewGRF %08X (%s) not found; checksum %s. Tried another NewGRF with same GRF ID\n", BSWAP32(c->grfid), c->filename, buf); + 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); } 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); + p += seprintf(p, lastof(buffer), "NewGRF %08X (%s) not found; checksum %s.\n", BSWAP32(c->grfid), c->filename, buf); } } |