1
0
Fork 0

(svn r20818) -Fix [FS#3791]: make the crash-on-saveload message clearer and more correct

release/1.1
rubidium 2010-09-16 21:13:16 +00:00
parent 68f9bc5726
commit 5b733f88a8
1 changed files with 35 additions and 25 deletions

View File

@ -336,18 +336,25 @@ static void CDECL HandleSavegameLoadCrash(int signum)
char buffer[8192]; char buffer[8192];
char *p = buffer; char *p = buffer;
p += seprintf(p, lastof(buffer), "Loading your savegame caused OpenTTD to crash.\n");
for (const GRFConfig *c = _grfconfig; !_saveload_crash_with_missing_newgrfs && c != NULL; c = c->next) {
_saveload_crash_with_missing_newgrfs = HasBit(c->flags, GCF_COMPATIBLE) || c->status == GCS_NOT_FOUND;
}
if (_saveload_crash_with_missing_newgrfs) {
p += seprintf(p, lastof(buffer), p += seprintf(p, lastof(buffer),
"Loading your savegame caused OpenTTD to crash.\n" "This is most likely caused by a missing NewGRF or a NewGRF that\n"
"This is most likely caused by a missing NewGRF or a NewGRF that has been\n" "has been loaded as replacement for a missing NewGRF. OpenTTD\n"
"loaded as replacement for a missing NewGRF. OpenTTD cannot easily\n" "cannot easily determine whether a replacement NewGRF is of a newer\n"
"determine whether a replacement NewGRF is of a newer or older version.\n" "or older version.\n"
"It will load a NewGRF with the same GRF ID as the missing NewGRF. This\n" "It will load a NewGRF with the same GRF ID as the missing NewGRF.\n"
"means that if the author makes incompatible NewGRFs with the same GRF ID\n" "This means that if the author makes incompatible NewGRFs with the\n"
"OpenTTD cannot magically do the right thing. In most cases OpenTTD will\n" "same GRF ID OpenTTD cannot magically do the right thing. In most\n"
"load the savegame and not crash, but this is an exception.\n" "cases OpenTTD will load the savegame and not crash, but this is an\n"
"Please load the savegame with the appropriate NewGRFs. When loading a\n" "exception.\n"
"savegame still crashes when all NewGRFs are found you should file a\n" "Please load the savegame with the appropriate NewGRFs installed.\n"
"bug report. The missing NewGRFs are:\n"); "The missing/compatible NewGRFs are:\n");
for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) { for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
if (HasBit(c->flags, GCF_COMPATIBLE)) { if (HasBit(c->flags, GCF_COMPATIBLE)) {
@ -355,15 +362,18 @@ static void CDECL HandleSavegameLoadCrash(int signum)
char buf[40]; char buf[40];
md5sumToString(buf, lastof(buf), replaced->md5sum); 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->ident.grfid), buf, c->filename); p += seprintf(p, lastof(buffer), "NewGRF %08X (checksum %s) not found.\n Loaded NewGRF \"%s\" with same GRF ID instead.\n", BSWAP32(c->ident.grfid), buf, c->filename);
_saveload_crash_with_missing_newgrfs = true;
} }
if (c->status == GCS_NOT_FOUND) { if (c->status == GCS_NOT_FOUND) {
char buf[40]; char buf[40];
md5sumToString(buf, lastof(buf), c->ident.md5sum); md5sumToString(buf, lastof(buf), c->ident.md5sum);
p += seprintf(p, lastof(buffer), "NewGRF %08X (%s) not found; checksum %s.\n", BSWAP32(c->ident.grfid), c->filename, buf); p += seprintf(p, lastof(buffer), "NewGRF %08X (%s) not found; checksum %s.\n", BSWAP32(c->ident.grfid), c->filename, buf);
_saveload_crash_with_missing_newgrfs = true;
} }
} }
} else {
p += seprintf(p, lastof(buffer),
"This is probably caused by a corruption in the savegame.\n"
"Please file a bug report and attach this savegame.\n");
}
ShowInfo(buffer); ShowInfo(buffer);