summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-25 20:05:31 +0000
committeryexo <yexo@openttd.org>2010-02-25 20:05:31 +0000
commita9c8dbc0a0e1f1fc4434cf0c83ff658ab8d9e3d9 (patch)
treebe44c4af53164b9307d95a0021c276ec2b57f41c /src/saveload
parent4377b5fd44f5267f89f565e46cdb3646cf322a93 (diff)
downloadopenttd-a9c8dbc0a0e1f1fc4434cf0c83ff658ab8d9e3d9.tar.xz
(svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp12
-rw-r--r--src/saveload/newgrf_sl.cpp4
-rw-r--r--src/saveload/oldloader_sl.cpp4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index f918e9972..e4c3e865a 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -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;
}
}
diff --git a/src/saveload/newgrf_sl.cpp b/src/saveload/newgrf_sl.cpp
index e49bf975b..9209be7b8 100644
--- a/src/saveload/newgrf_sl.cpp
+++ b/src/saveload/newgrf_sl.cpp
@@ -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),
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index d358fc35e..004c98ff6 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -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;
};