mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r17510) -Fix [FS#3197]: When loading GRFConfigs from ini file, validate them wrt. duplicate GRF IDs.
This commit is contained in:
parent
4c65a04a50
commit
5c59ed2011
@ -1183,6 +1183,20 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
ShowInfoF("ini: ignoring NewGRF '%s': duplicate GRF ID with '%s'", item->name, gc->filename);
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (duplicate) {
|
||||
ClearGRFConfig(&c);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Mark file as static to avoid saving in savegame. */
|
||||
if (is_static) SetBit(c->flags, GCF_STATIC);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user