Changeset - r7571:7ef9317d5f93
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-09-13 18:26:18
truelight@openttd.org
(svn r11096) -Fix: when 2 different GRF-files had the same name (e.g.: ""), the double-entry checker didn't always work correctly, resulting in multiple entries of the same grf in the list
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_config.cpp
Show inline comments
 
@@ -315,9 +315,14 @@ static uint ScanPath(const char *path, i
 
					/* Insert file into list at a position determined by its
 
					 * name, so the list is sorted as we go along */
 
					GRFConfig **pd, *d;
 
					bool stop = false;
 
					for (pd = &_all_grfs; (d = *pd) != NULL; pd = &d->next) {
 
						if (c->grfid == d->grfid && memcmp(c->md5sum, d->md5sum, sizeof(c->md5sum)) == 0) added = false;
 
						if (strcasecmp(c->name, d->name) <= 0) break;
 
						/* Because there can be multiple grfs with the same name, make sure we checked all grfs with the same name,
 
						*  before inserting the entry. So insert a new grf at the end of all grfs with the same name, instead of
 
						*  just after the first with the same name. Avoids doubles in the list. */
 
						if (strcasecmp(c->name, d->name) <= 0) stop = true;
 
						else if (stop) break;
 
					}
 
					if (added) {
 
						c->next = d;
0 comments (0 inline, 0 general)