Changeset - r13006:b3401a43d0a8
[Not reviewed]
master
0 1 0
frosch - 15 years ago 2009-09-12 14:40:26
frosch@openttd.org
(svn r17510) -Fix [FS#3197]: When loading GRFConfigs from ini file, validate them wrt. duplicate GRF IDs.
1 file changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/settings.cpp
Show inline comments
 
@@ -1183,6 +1183,20 @@ static GRFConfig *GRFLoadConfig(IniFile 
 
			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);
 

	
0 comments (0 inline, 0 general)