summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gamelog.cpp22
-rw-r--r--src/network/core/udp.cpp4
-rw-r--r--src/network/network_client.cpp10
-rw-r--r--src/network/network_gamelist.cpp4
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/network/network_server.cpp2
-rw-r--r--src/network/network_udp.cpp18
-rw-r--r--src/newgrf.cpp12
-rw-r--r--src/newgrf_config.cpp36
-rw-r--r--src/newgrf_config.h3
-rw-r--r--src/newgrf_gui.cpp14
-rw-r--r--src/saveload/afterload.cpp12
-rw-r--r--src/saveload/newgrf_sl.cpp4
-rw-r--r--src/saveload/oldloader_sl.cpp4
-rw-r--r--src/settings.cpp2
15 files changed, 75 insertions, 74 deletions
diff --git a/src/gamelog.cpp b/src/gamelog.cpp
index d87bffb84..83d1ba112 100644
--- a/src/gamelog.cpp
+++ b/src/gamelog.cpp
@@ -643,10 +643,10 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
const GRFConfig *og = ol->grf[o];
const GRFConfig *ng = nl->grf[n];
- if (og->grfid != ng->grfid) {
+ if (og->ident.grfid != ng->ident.grfid) {
uint oi, ni;
for (oi = 0; oi < ol->n; oi++) {
- if (ol->grf[oi]->grfid == nl->grf[n]->grfid) break;
+ if (ol->grf[oi]->ident.grfid == nl->grf[n]->ident.grfid) break;
}
if (oi < o) {
/* GRF was moved, this change has been logged already */
@@ -659,7 +659,7 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
continue;
}
for (ni = 0; ni < nl->n; ni++) {
- if (nl->grf[ni]->grfid == ol->grf[o]->grfid) break;
+ if (nl->grf[ni]->ident.grfid == ol->grf[o]->ident.grfid) break;
}
if (ni < n) {
/* GRF was moved, this change has been logged already */
@@ -668,7 +668,7 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
}
if (ni == nl->n) {
/* GRF couldn't be found in the NEW list, GRF was REMOVED */
- GamelogGRFRemove(ol->grf[o++]->grfid);
+ GamelogGRFRemove(ol->grf[o++]->ident.grfid);
continue;
}
@@ -682,18 +682,18 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
if (ni >= oi) { // prefer the one that is moved further
/* GRF was moved down */
- GamelogGRFMove(ol->grf[o++]->grfid, ni);
+ GamelogGRFMove(ol->grf[o++]->ident.grfid, ni);
} else {
- GamelogGRFMove(nl->grf[n++]->grfid, -(int)oi);
+ GamelogGRFMove(nl->grf[n++]->ident.grfid, -(int)oi);
}
} else {
- if (memcmp(og->md5sum, ng->md5sum, sizeof(og->md5sum)) != 0) {
+ if (memcmp(og->ident.md5sum, ng->ident.md5sum, sizeof(og->ident.md5sum)) != 0) {
/* md5sum changed, probably loading 'compatible' GRF */
- GamelogGRFCompatible(nl->grf[n]);
+ GamelogGRFCompatible(&nl->grf[n]->ident);
}
if (og->num_params != ng->num_params || memcmp(og->param, ng->param, og->num_params * sizeof(og->param[0])) != 0) {
- GamelogGRFParameters(ol->grf[o]->grfid);
+ GamelogGRFParameters(ol->grf[o]->ident.grfid);
}
o++;
@@ -701,8 +701,8 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
}
}
- while (o < ol->n) GamelogGRFRemove(ol->grf[o++]->grfid); // remaining GRFs were removed ...
- while (n < nl->n) GamelogGRFAdd (nl->grf[n++]); // ... or added
+ while (o < ol->n) GamelogGRFRemove(ol->grf[o++]->ident.grfid); // remaining GRFs were removed ...
+ while (n < nl->n) GamelogGRFAdd (nl->grf[n++]); // ... or added
free(ol);
free(nl);
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index e855bdfcf..4bf0c1e30 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -181,7 +181,7 @@ void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameI
/* Send actual GRF Identifications */
for (c = info->grfconfig; c != NULL; c = c->next) {
- if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, c);
+ if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, &c->ident);
}
}
@@ -239,7 +239,7 @@ void NetworkUDPSocketHandler::Recv_NetworkGameInfo(Packet *p, NetworkGameInfo *i
for (i = 0; i < num_grfs; i++) {
GRFConfig *c = CallocT<GRFConfig>(1);
- this->Recv_GRFIdentifier(p, c);
+ this->Recv_GRFIdentifier(p, &c->ident);
this->HandleIncomingNetworkGameInfoGRFConfig(c);
/* Append GRFConfig to the list */
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index f20bafab7..d5007ef9a 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -512,15 +512,15 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHECK_NEWGRFS)
/* Check all GRFs */
for (; grf_count > 0; grf_count--) {
GRFConfig c;
- MY_CLIENT->Recv_GRFIdentifier(p, &c);
+ MY_CLIENT->Recv_GRFIdentifier(p, &c.ident);
/* Check whether we know this GRF */
- const GRFConfig *f = FindGRFConfig(c.grfid, c.md5sum);
+ const GRFConfig *f = FindGRFConfig(c.ident.grfid, c.ident.md5sum);
if (f == NULL) {
/* We do not know this GRF, bail out of initialization */
- char buf[sizeof(c.md5sum) * 2 + 1];
- md5sumToString(buf, lastof(buf), c.md5sum);
- DEBUG(grf, 0, "NewGRF %08X not found; checksum %s", BSWAP32(c.grfid), buf);
+ char buf[sizeof(c.ident.md5sum) * 2 + 1];
+ md5sumToString(buf, lastof(buf), c.ident.md5sum);
+ DEBUG(grf, 0, "NewGRF %08X not found; checksum %s", BSWAP32(c.ident.grfid), buf);
ret = NETWORK_RECV_STATUS_NEWGRF_MISMATCH;
}
}
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index 62fbc822b..61efe3b79 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -172,12 +172,12 @@ void NetworkAfterNewGRFScan()
for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) {
assert(HasBit(c->flags, GCF_COPY));
- const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
+ const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
if (f == NULL) {
/* Don't know the GRF, so mark game incompatible and the (possibly)
* already resolved name for this GRF (another server has sent the
* name of the GRF already */
- c->name = FindUnknownGRFName(c->grfid, c->md5sum, true);
+ c->name = FindUnknownGRFName(c->ident.grfid, c->ident.md5sum, true);
c->status = GCS_NOT_FOUND;
/* If we miss a file, we're obviously incompatible */
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index b15113243..d9f4b7184 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -797,7 +797,7 @@ public:
for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) {
if (c->status != GCS_NOT_FOUND) continue;
- const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
+ const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
if (f == NULL) {
missing_grfs = true;
continue;
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index c090d176d..94c2911f2 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -202,7 +202,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHECK_NEWGRFS)(NetworkClientSocket *
p->Send_uint8 (grf_count);
for (c = _grfconfig; c != NULL; c = c->next) {
- if (!HasBit(c->flags, GCF_STATIC)) cs->Send_GRFIdentifier(p, c);
+ if (!HasBit(c->flags, GCF_STATIC)) cs->Send_GRFIdentifier(p, &c->ident);
}
cs->Send_Packet(p);
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 2197da8d4..2f613fade 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -180,16 +180,16 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
GRFConfig c;
const GRFConfig *f;
- this->Recv_GRFIdentifier(p, &c);
+ this->Recv_GRFIdentifier(p, &c.ident);
/* Find the matching GRF file */
- f = FindGRFConfig(c.grfid, c.md5sum);
+ f = FindGRFConfig(c.ident.grfid, c.ident.md5sum);
if (f == NULL) continue; // The GRF is unknown to this server
/* If the reply might exceed the size of the packet, only reply
* the current list and do not send the other data.
* The name could be an empty string, if so take the filename. */
- packet_len += sizeof(c.grfid) + sizeof(c.md5sum) +
+ packet_len += sizeof(c.ident.grfid) + sizeof(c.ident.md5sum) +
min(strlen((!StrEmpty(f->name)) ? f->name : f->filename) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply
break;
@@ -207,7 +207,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
/* The name could be an empty string, if so take the filename */
strecpy(name, (!StrEmpty(in_reply[i]->name)) ? in_reply[i]->name : in_reply[i]->filename, lastof(name));
- this->Send_GRFIdentifier(&packet, in_reply[i]);
+ this->Send_GRFIdentifier(&packet, &in_reply[i]->ident);
packet.Send_string(name);
}
@@ -268,7 +268,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_RESPONSE)
packet.Send_uint8(in_request_count);
for (i = 0; i < in_request_count; i++) {
- this->Send_GRFIdentifier(&packet, in_request[i]);
+ this->Send_GRFIdentifier(&packet, &in_request[i]->ident);
}
this->SendPacket(&packet, &item->address);
@@ -343,7 +343,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS)
char name[NETWORK_GRF_NAME_LENGTH];
GRFConfig c;
- this->Recv_GRFIdentifier(p, &c);
+ this->Recv_GRFIdentifier(p, &c.ident);
p->Recv_string(name, sizeof(name));
/* An empty name is not possible under normal circumstances
@@ -353,7 +353,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS)
/* Finds the fake GRFConfig for the just read GRF ID and MD5sum tuple.
* If it exists and not resolved yet, then name of the fake GRF is
* overwritten with the name from the reply. */
- unknown_name = FindUnknownGRFName(c.grfid, c.md5sum, false);
+ unknown_name = FindUnknownGRFName(c.ident.grfid, c.ident.md5sum, false);
if (unknown_name != NULL && strcmp(unknown_name, UNKNOWN_GRF_NAME_PLACEHOLDER) == 0) {
ttd_strlcpy(unknown_name, name, NETWORK_GRF_NAME_LENGTH);
}
@@ -363,12 +363,12 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS)
void ClientNetworkUDPSocketHandler::HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config)
{
/* Find the matching GRF file */
- const GRFConfig *f = FindGRFConfig(config->grfid, config->md5sum);
+ const GRFConfig *f = FindGRFConfig(config->ident.grfid, config->ident.md5sum);
if (f == NULL) {
/* Don't know the GRF, so mark game incompatible and the (possibly)
* already resolved name for this GRF (another server has sent the
* name of the GRF already */
- config->name = FindUnknownGRFName(config->grfid, config->md5sum, true);
+ config->name = FindUnknownGRFName(config->ident.grfid, config->ident.md5sum, true);
config->status = GCS_NOT_FOUND;
} else {
config->filename = f->filename;
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 194670ec5..c3e0de903 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4258,7 +4258,7 @@ static void CfgApply(ByteReader *buf)
return;
}
- GRFLocation location(_cur_grfconfig->grfid, _nfo_line + 1);
+ GRFLocation location(_cur_grfconfig->ident.grfid, _nfo_line + 1);
GRFLineToSpriteOverride::iterator it = _grf_line_to_action6_sprite_override.find(location);
if (it != _grf_line_to_action6_sprite_override.end()) {
free(preload_sprite);
@@ -4336,7 +4336,7 @@ static void DisableStaticNewGRFInfluencingNonStaticNewGRFs(GRFConfig *c)
c->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC);
c->error->data = strdup(_cur_grfconfig->name);
- ClearTemporaryNewGRFData(GetFileByGRFID(c->grfid));
+ ClearTemporaryNewGRFData(GetFileByGRFID(c->ident.grfid));
}
/* Action 0x07
@@ -4510,7 +4510,7 @@ static void ScanInfo(ByteReader *buf)
buf->ReadByte();
uint32 grfid = buf->ReadDWord();
- _cur_grfconfig->grfid = grfid;
+ _cur_grfconfig->ident.grfid = grfid;
/* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */
if (GB(grfid, 24, 8) == 0xFF) SetBit(_cur_grfconfig->flags, GCF_SYSTEM);
@@ -5177,7 +5177,7 @@ static void SafeGRFInhibit(ByteReader *buf)
uint32 grfid = buf->ReadDWord();
/* GRF is unsafe it if tries to deactivate other GRFs */
- if (grfid != _cur_grfconfig->grfid) {
+ if (grfid != _cur_grfconfig->ident.grfid) {
SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
/* Skip remainder of GRF */
@@ -6304,7 +6304,7 @@ static void DecodeSpecialSprite(byte *buf, uint num, GrfLoadingStage stage)
/* 0x13 */ { NULL, NULL, NULL, NULL, NULL, TranslateGRFStrings, },
};
- GRFLocation location(_cur_grfconfig->grfid, _nfo_line);
+ GRFLocation location(_cur_grfconfig->ident.grfid, _nfo_line);
GRFLineToSpriteOverride::iterator it = _grf_line_to_action6_sprite_override.find(location);
if (it == _grf_line_to_action6_sprite_override.end()) {
@@ -6722,7 +6722,7 @@ void LoadNewGRF(uint load_index, uint file_index)
SetBit(c->flags, GCF_RESERVED);
} else if (stage == GLS_ACTIVATION) {
ClrBit(c->flags, GCF_RESERVED);
- assert(GetFileByGRFID(c->grfid) == _cur_grffile);
+ assert(GetFileByGRFID(c->ident.grfid) == _cur_grffile);
ClearTemporaryNewGRFData(_cur_grffile);
BuildCargoTranslationMap();
DEBUG(sprite, 2, "LoadNewGRF: Currently %i sprites are loaded", _cur_spriteid);
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 167668424..31e51d9af 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -69,7 +69,7 @@ static bool CalcGRFMD5Sum(GRFConfig *config)
size -= len;
checksum.Append(buffer, len);
}
- checksum.Finish(config->md5sum);
+ checksum.Finish(config->ident.md5sum);
FioFCloseFile(f);
@@ -89,7 +89,7 @@ bool FillGRFDetails(GRFConfig *config, bool is_static)
LoadNewGRFFile(config, CONFIG_SLOT, GLS_FILESCAN);
/* Skip if the grfid is 0 (not read) or 0xFFFFFFFF (ttdp system grf) */
- if (config->grfid == 0 || config->grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false;
+ if (config->ident.grfid == 0 || config->ident.grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false;
if (is_static) {
/* Perform a 'safety scan' for static GRFs */
@@ -200,7 +200,7 @@ static void RemoveDuplicatesFromGRFConfigList(GRFConfig *list)
if (list == NULL) return;
for (prev = list, cur = list->next; cur != NULL; prev = cur, cur = cur->next) {
- if (cur->grfid != list->grfid) continue;
+ if (cur->ident.grfid != list->ident.grfid) continue;
prev->next = cur->next;
ClearGRFConfig(&cur);
@@ -257,35 +257,35 @@ GRFListCompatibility IsGoodGRFConfigList()
GRFListCompatibility res = GLC_ALL_GOOD;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
- const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
+ const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
if (f == NULL) {
char buf[256];
/* If we have not found the exactly matching GRF try to find one with the
* same grfid, as it most likely is compatible */
- f = FindGRFConfig(c->grfid);
+ f = FindGRFConfig(c->ident.grfid);
if (f != NULL) {
- md5sumToString(buf, lastof(buf), c->md5sum);
- DEBUG(grf, 1, "NewGRF %08X (%s) not found; checksum %s. Compatibility mode on", BSWAP32(c->grfid), c->filename, buf);
+ md5sumToString(buf, lastof(buf), c->ident.md5sum);
+ DEBUG(grf, 1, "NewGRF %08X (%s) not found; checksum %s. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, buf);
SetBit(c->flags, GCF_COMPATIBLE);
/* Non-found has precedence over compatibility load */
if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;
- GamelogGRFCompatible(f);
+ GamelogGRFCompatible(&f->ident);
goto compatible_grf;
}
/* No compatible grf was found, mark it as disabled */
- md5sumToString(buf, lastof(buf), c->md5sum);
- DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->grfid), c->filename, buf);
+ md5sumToString(buf, lastof(buf), c->ident.md5sum);
+ DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->ident.grfid), c->filename, buf);
- GamelogGRFRemove(c->grfid);
+ GamelogGRFRemove(c->ident.grfid);
c->status = GCS_NOT_FOUND;
res = GLC_NOT_FOUND;
} else {
compatible_grf:
- DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->grfid), f->filename);
+ DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->ident.grfid), f->filename);
/* The filename could be the filename as in the savegame. As we need
* to load the GRF here, we need the correct filename, so overwrite that
* in any case and set the name and info when it is not set already.
@@ -294,7 +294,7 @@ compatible_grf:
if (!HasBit(c->flags, GCF_COPY)) {
free(c->filename);
c->filename = strdup(f->filename);
- memcpy(c->md5sum, f->md5sum, sizeof(c->md5sum));
+ memcpy(c->ident.md5sum, f->ident.md5sum, sizeof(c->ident.md5sum));
if (c->name == NULL && f->name != NULL) c->name = strdup(f->name);
if (c->info == NULL && f->info != NULL) c->info = strdup(f->info);
c->error = NULL;
@@ -333,7 +333,7 @@ bool GRFFileScanner::AddFile(const char *filename, size_t basepath_length)
GRFConfig **pd, *d;
bool stop = false;
for (pd = &_all_grfs; (d = *pd) != NULL; pd = &d->next) {
- if (c->grfid == d->grfid && memcmp(c->md5sum, d->md5sum, sizeof(c->md5sum)) == 0) added = false;
+ if (c->ident.grfid == d->ident.grfid && memcmp(c->ident.md5sum, d->ident.md5sum, sizeof(c->ident.md5sum)) == 0) added = false;
/* Because there can be multiple grfs with the same name, make sure we checked all grfs with the same name,
* before inserting the entry. So insert a new grf at the end of all grfs with the same name, instead of
* just after the first with the same name. Avoids doubles in the list. */
@@ -419,10 +419,10 @@ void ScanNewGRFFiles()
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum)
{
for (const GRFConfig *c = _all_grfs; c != NULL; c = c->next) {
- if (c->grfid == grfid) {
+ if (c->ident.grfid == grfid) {
if (md5sum == NULL) return c;
- if (memcmp(md5sum, c->md5sum, sizeof(c->md5sum)) == 0) return c;
+ if (memcmp(md5sum, c->ident.md5sum, sizeof(c->ident.md5sum)) == 0) return c;
}
}
@@ -486,7 +486,7 @@ GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask)
GRFConfig *c;
for (c = _grfconfig; c != NULL; c = c->next) {
- if ((c->grfid & mask) == (grfid & mask)) return c;
+ if ((c->ident.grfid & mask) == (grfid & mask)) return c;
}
return NULL;
@@ -517,5 +517,5 @@ static const uint32 OPENTTD_GRAPHICS_BASE_GRF_ID = BSWAP32(0xFF4F5400);
*/
bool GRFConfig::IsOpenTTDBaseGRF() const
{
- return (this->grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID;
+ return (this->ident.grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID;
}
diff --git a/src/newgrf_config.h b/src/newgrf_config.h
index fe3eab37e..ec587cc1e 100644
--- a/src/newgrf_config.h
+++ b/src/newgrf_config.h
@@ -69,7 +69,8 @@ struct GRFError : ZeroedMemoryAllocator {
};
/** Information about GRF, used in the game and (part of it) in savegames */
-struct GRFConfig : public GRFIdentifier {
+struct GRFConfig {
+ GRFIdentifier ident; ///< grfid and md5sum to uniquely identify newgrfs
char *filename; ///< Filename - either with or without full path
char *name; ///< NOSAVE: GRF name (Action 0x08)
char *info; ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 23fafad3c..ce7792405 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -100,12 +100,12 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint right, uint
}
/* Prepare and draw GRF ID */
- snprintf(buff, lengthof(buff), "%08X", BSWAP32(c->grfid));
+ snprintf(buff, lengthof(buff), "%08X", BSWAP32(c->ident.grfid));
SetDParamStr(0, buff);
y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_GRF_ID);
/* Prepare and draw MD5 sum */
- md5sumToString(buff, lastof(buff), c->md5sum);
+ md5sumToString(buff, lastof(buff), c->ident.md5sum);
SetDParamStr(0, buff);
y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_MD5SUM);
@@ -369,7 +369,7 @@ public:
/* Find last entry in the list, checking for duplicate grfid on the way */
for (list = this->list; *list != NULL; list = &(*list)->next) {
- if ((*list)->grfid == src->grfid) {
+ if ((*list)->ident.grfid == src->ident.grfid) {
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
return;
}
@@ -862,9 +862,9 @@ struct NewGRFWindow : public Window {
ci->type = CONTENT_TYPE_NEWGRF;
ci->state = ContentInfo::DOES_NOT_EXIST;
ttd_strlcpy(ci->name, c->name != NULL ? c->name : c->filename, lengthof(ci->name));
- ci->unique_id = BSWAP32(c->grfid);
- memcpy(ci->md5sum, c->md5sum, sizeof(ci->md5sum));
- if (HasBit(c->flags, GCF_COMPATIBLE)) GamelogGetOriginalGRFMD5Checksum(c->grfid, ci->md5sum);
+ ci->unique_id = BSWAP32(c->ident.grfid);
+ memcpy(ci->md5sum, c->ident.md5sum, sizeof(ci->md5sum));
+ if (HasBit(c->flags, GCF_COMPATIBLE)) GamelogGetOriginalGRFMD5Checksum(c->ident.grfid, ci->md5sum);
*cv.Append() = ci;
}
ShowNetworkContentListWindow(cv.Length() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF);
@@ -943,7 +943,7 @@ struct NewGRFWindow : public Window {
for (GRFConfig *c = this->list; c != NULL; c = c->next) {
if (c->status != GCS_NOT_FOUND) continue;
- const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
+ const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
if (f == NULL) continue;
free(c->filename);
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;
};
diff --git a/src/settings.cpp b/src/settings.cpp
index 901860848..998cf547f 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1224,7 +1224,7 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
/* Check for duplicate GRFID (will also check for duplicate filenames) */
bool duplicate = false;
for (const GRFConfig *gc = first; gc != NULL; gc = gc->next) {
- if (gc->grfid == c->grfid) {
+ if (gc->ident.grfid == c->ident.grfid) {
ShowInfoF("ini: ignoring NewGRF '%s': duplicate GRF ID with '%s'", item->name, gc->filename);
duplicate = true;
break;