summaryrefslogtreecommitdiff
path: root/settings.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-04-20 22:09:49 +0000
committerDarkvater <darkvater@openttd.org>2006-04-20 22:09:49 +0000
commit9febcd5ef8ac128e3d6583b231865bd1df9bbd8a (patch)
treebc07788cb02835aa5efb2f5cfdd92c2bdb738efe /settings.c
parentac763288277bb2ae7fc25a2f61018e337d18c86d (diff)
downloadopenttd-9febcd5ef8ac128e3d6583b231865bd1df9bbd8a.tar.xz
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Diffstat (limited to 'settings.c')
-rw-r--r--settings.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/settings.c b/settings.c
index b5aec9818..5dbc11fbf 100644
--- a/settings.c
+++ b/settings.c
@@ -233,12 +233,6 @@ static IniFile *ini_load(const char *filename)
comment_size = 0;
}
- // for list items, the name and value are the same:
- if (group->type == IGT_LIST) {
- item->value = item->name;
- continue;
- }
-
// find start of parameter
while (*t == '=' || *t == ' ' || *t == '\t') t++;
@@ -315,11 +309,14 @@ static bool ini_save(const char *filename, IniFile *ini)
if (group->comment) fputs(group->comment, f);
fprintf(f, "[%s]\n", group->name);
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 : "");
- else
- fprintf(f, "%s = %s\n", item->name, item->value ? item->value : "");
+ assert(item->value != NULL);
+ if (item->comment != NULL) fputs(item->comment, f);
+
+ //*Don't give an equal sign to list items that don't have a parameter */
+ if (group->type == IGT_LIST && *item->value == '\0') {
+ fprintf(f, "%s\n", item->name);
+ } else
+ fprintf(f, "%s = %s\n", item->name, item->value);
}
}
if (ini->comment) fputs(ini->comment, f);