(svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it

This commit is contained in:
yexo
2010-02-25 20:05:31 +00:00
parent 4377b5fd44
commit a9c8dbc0a0
15 changed files with 75 additions and 74 deletions

View File

@@ -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);