(svn r20259) -Add: allow NewGRFs to specify their version and use that to hide old NewGRFs / to choose the newest when loading compatible NewGRFs

This commit is contained in:
rubidium
2010-07-31 14:40:50 +00:00
parent f4c46dd701
commit a777266426
7 changed files with 55 additions and 7 deletions

View File

@@ -39,6 +39,7 @@ GRFConfig::GRFConfig(const char *filename) :
*/
GRFConfig::GRFConfig(const GRFConfig &config) :
ident(config.ident),
version(config.version),
flags(config.flags & ~GCF_COPY),
status(config.status),
grf_bugs(config.grf_bugs),
@@ -579,11 +580,14 @@ void ScanNewGRFFiles()
*/
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum)
{
const GRFConfig *best = NULL;
for (const GRFConfig *c = _all_grfs; c != NULL; c = c->next) {
if (c->ident.HasGrfIdentifier(grfid, md5sum)) return c;
if (!c->ident.HasGrfIdentifier(grfid, md5sum)) continue;
if (md5sum != NULL) return c;
if (best == NULL || c->version > best->version) best = c;
}
return NULL;
return best;
}
#ifdef ENABLE_NETWORK