Mercurial > hg > openttd
changeset 13016:5e09e2402b65 draft
(svn r17510) -Fix [FS#3197]: When loading GRFConfigs from ini file, validate them wrt. duplicate GRF IDs.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 12 Sep 2009 14:40:26 +0000 |
parents | 29efbe666d4a |
children | ab07d6d87608 |
files | src/settings.cpp |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/settings.cpp +++ b/src/settings.cpp @@ -1183,6 +1183,20 @@ 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);