summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-09-12 14:40:26 +0000
committerfrosch <frosch@openttd.org>2009-09-12 14:40:26 +0000
commit5c59ed2011905207bcd939a282513775d284dbd8 (patch)
treead4845a07bbce3559ae32ef0219ef6df819e3755
parent4c65a04a50660eaffd684efd05ab530ea5e3e3b8 (diff)
downloadopenttd-5c59ed2011905207bcd939a282513775d284dbd8.tar.xz
(svn r17510) -Fix [FS#3197]: When loading GRFConfigs from ini file, validate them wrt. duplicate GRF IDs.
-rw-r--r--src/settings.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 0e6a94aac..312045a59 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -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);