(svn r9561) -Fix (r9561): loading the newgrfs in openttd.cfg was broken.
authorrubidium
Wed, 04 Apr 2007 12:43:43 +0000
changeset 6425 cfbb09c70593
parent 6424 d410d4c31d15
child 6426 dcfdb9b5991b
(svn r9561) -Fix (r9561): loading the newgrfs in openttd.cfg was broken.
Note: as the 'full' path is stored of the newgrfs, the newgrfs in the old cfgs are not made default (you have to set them again).
src/newgrf_config.cpp
src/settings.cpp
--- a/src/newgrf_config.cpp	Wed Apr 04 12:03:10 2007 +0000
+++ b/src/newgrf_config.cpp	Wed Apr 04 12:43:43 2007 +0000
@@ -64,6 +64,10 @@
 		return false;
 	}
 
+	if (config->filename == NULL) {
+		config->filename = strdup(strrchr(config->full_path, PATHSEPCHAR) + 1);
+	}
+
 	/* Find and load the Action 8 information */
 	/* 62 is the last file slot before sample.cat.
 	 * Should perhaps be some "don't care" value */
@@ -305,7 +309,6 @@
 
 			GRFConfig *c = CallocT<GRFConfig>(1);
 			c->full_path = strdup(filename);
-			c->filename = strdup(strrchr(filename, PATHSEPCHAR) + 1);
 
 			bool added = true;
 			if (FillGRFDetails(c, false)) {
--- a/src/settings.cpp	Wed Apr 04 12:03:10 2007 +0000
+++ b/src/settings.cpp	Wed Apr 04 12:43:43 2007 +0000
@@ -1576,7 +1576,7 @@
 
 	for (item = group->item; item != NULL; item = item->next) {
 		GRFConfig *c = CallocT<GRFConfig>(1);
-		c->filename = strdup(item->name);
+		c->full_path = strdup(item->name);
 
 		/* Parse parameters */
 		if (*item->value != '\0') {
@@ -1653,7 +1653,7 @@
 		char params[512];
 		GRFBuildParamList(params, c, lastof(params));
 
-		*item = ini_item_alloc(group, c->filename, strlen(c->filename));
+		*item = ini_item_alloc(group, c->full_path, strlen(c->full_path));
 		(*item)->value = (char*)pool_strdup(&ini->pool, params, strlen(params));
 		item = &(*item)->next;
 	}