(svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it
This commit is contained in:
@@ -301,14 +301,14 @@ static void ResetSignalHandlers()
|
||||
static const GRFIdentifier *GetOverriddenIdentifier(const GRFConfig *c)
|
||||
{
|
||||
const LoggedAction *la = &_gamelog_action[_gamelog_actions - 1];
|
||||
if (la->at != GLAT_LOAD) return c;
|
||||
if (la->at != GLAT_LOAD) return &c->ident;
|
||||
|
||||
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;
|
||||
if (lc->ct == GLCT_GRFCOMPAT && lc->grfcompat.grfid == c->ident.grfid) return &lc->grfcompat;
|
||||
}
|
||||
|
||||
return c;
|
||||
return &c->ident;
|
||||
}
|
||||
|
||||
/** Was the saveload crash because of missing NewGRFs? */
|
||||
@@ -354,13 +354,13 @@ static void CDECL HandleSavegameLoadCrash(int signum)
|
||||
const GRFIdentifier *replaced = GetOverriddenIdentifier(c);
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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);
|
||||
_saveload_crash_with_missing_newgrfs = true;
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
|
||||
static const SaveLoad _grfconfig_desc[] = {
|
||||
SLE_STR(GRFConfig, filename, SLE_STR, 0x40),
|
||||
SLE_VAR(GRFConfig, grfid, SLE_UINT32),
|
||||
SLE_ARR(GRFConfig, md5sum, SLE_UINT8, 16),
|
||||
SLE_VAR(GRFConfig, ident.grfid, SLE_UINT32),
|
||||
SLE_ARR(GRFConfig, ident.md5sum, SLE_UINT8, 16),
|
||||
SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80),
|
||||
SLE_VAR(GRFConfig, num_params, SLE_UINT8),
|
||||
SLE_CONDVAR(GRFConfig, windows_paletted, SLE_BOOL, 101, SL_MAX_VERSION),
|
||||
|
@@ -1520,11 +1520,11 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
|
||||
|
||||
if (ReadByte(ls) == 1) {
|
||||
GRFConfig *c = CallocT<GRFConfig>(1);
|
||||
c->grfid = grfid;
|
||||
c->ident.grfid = grfid;
|
||||
c->filename = strdup("TTDP game, no information");
|
||||
|
||||
AppendToGRFConfigList(&_grfconfig, c);
|
||||
DEBUG(oldloader, 3, "TTDPatch game using GRF file with GRFID %0X", BSWAP32(c->grfid));
|
||||
DEBUG(oldloader, 3, "TTDPatch game using GRF file with GRFID %0X", BSWAP32(c->ident.grfid));
|
||||
}
|
||||
len -= 5;
|
||||
};
|
||||
|
Reference in New Issue
Block a user