(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
authorDarkvater
Sun, 29 Jan 2006 19:50:01 +0000
changeset 2919 5a867896b255
parent 2918 5da18f3f3ea3
child 2920 a582cd504686
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
settings.c
--- a/settings.c	Sun Jan 29 19:49:15 2006 +0000
+++ b/settings.c	Sun Jan 29 19:50:01 2006 +0000
@@ -305,10 +305,10 @@
 	f = fopen(filename, "w");
 	if (f == NULL) return false;
 
-	for(group = ini->group; group; group = group->next) {
+	for (group = ini->group; group != NULL; group = group->next) {
 		if (group->comment) fputs(group->comment, f);
 		fprintf(f, "[%s]\n", group->name);
-		for(item = group->item; item; item = item->next) {
+		for (item = group->item; item != NULL; item = item->next) {
 			if (item->comment) fputs(item->comment, f);
 			if(group->type==IGT_LIST)
 				fprintf(f, "%s\n", item->value ? item->value : "");
@@ -1057,8 +1057,9 @@
 	int i;
 	bool first = true;
 
-	if (!group)
-		return;
+	if (group == NULL) return;
+	group->item = NULL;
+
 	for (i = 0; i != len; i++) {
 		if (list[i] == NULL || list[i][0] == '\0') continue;