(svn r8105) -Codechange: Change FindGRFConfig so that if md5sum parameter is omitted (or NULL)

only a check for GRFID is done and not on md5sum as well. Remove blanksum in the function as it's obsoleted
replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
Darkvater 18 years ago
parent ae41162322
commit 3f168daee1

@ -312,15 +312,13 @@ void ScanNewGRFFiles(void)
} }
/* Find a NewGRF in the scanned list */ /* Find a NewGRF in the scanned list, if md5sum is NULL, we don't care about it*/
const GRFConfig *FindGRFConfig(uint32 grfid, uint8 *md5sum) const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum)
{ {
GRFConfig *c; for (const GRFConfig *c = _all_grfs; c != NULL; c = c->next) {
static const uint8 blanksum[sizeof(c->md5sum)] = { 0 };
for (c = _all_grfs; c != NULL; c = c->next) {
if (c->grfid == grfid) { if (c->grfid == grfid) {
if (memcmp(blanksum, c->md5sum, sizeof(c->md5sum)) == 0) CalcGRFMD5Sum(c); if (md5sum == NULL) return c;
if (memcmp(md5sum, c->md5sum, sizeof(c->md5sum)) == 0) return c; if (memcmp(md5sum, c->md5sum, sizeof(c->md5sum)) == 0) return c;
} }
} }

@ -41,7 +41,7 @@ extern GRFConfig *_grfconfig_newgame;
extern GRFConfig *_grfconfig_static; extern GRFConfig *_grfconfig_static;
void ScanNewGRFFiles(void); void ScanNewGRFFiles(void);
const GRFConfig *FindGRFConfig(uint32 grfid, uint8 *md5sum); const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
GRFConfig *GetGRFConfig(uint32 grfid); GRFConfig *GetGRFConfig(uint32 grfid);
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src); GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src);
void AppendStaticGRFConfigs(GRFConfig **dst); void AppendStaticGRFConfigs(GRFConfig **dst);

Loading…
Cancel
Save