summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-01-29 19:50:01 +0000
committerDarkvater <Darkvater@openttd.org>2006-01-29 19:50:01 +0000
commit21684a66fec8d77d805f37f722c6a157adcd9c64 (patch)
tree3cd9ee02b59f764fe1a1137cf7128768b4211e32
parent38b9d233af6f80952094f6976957e07e96c4c26c (diff)
downloadopenttd-21684a66fec8d77d805f37f722c6a157adcd9c64.tar.xz
(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.
-rw-r--r--settings.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/settings.c b/settings.c
index ef0b2ed4a..babfd94a4 100644
--- a/settings.c
+++ b/settings.c
@@ -305,10 +305,10 @@ static bool ini_save(const char *filename, IniFile *ini)
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 @@ static void SaveList(IniFile *ini, const char *grpname, char **list, int len)
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;