diff options
author | peter1138 <peter1138@openttd.org> | 2009-01-14 20:23:45 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-01-14 20:23:45 +0000 |
commit | c4c32692dfd65d6535e98e7d9660f4403059553c (patch) | |
tree | cdf9f0d4d99c9240cbc6d417f5fd088ede12fd29 /src/settings.cpp | |
parent | 61093eb2115bf22ca7e417af4e9048f60d2b47af (diff) | |
download | openttd-c4c32692dfd65d6535e98e7d9660f4403059553c.tar.xz |
(svn r15085) -Fix (r14164): Clearing a settings group did not delete old items nor reset the last_item pointer, causing lists to not be saved unless they started blank.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index e38e01598..9f0a8925c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -639,7 +639,7 @@ static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list if (proc == NULL && list == NULL) return; if (group == NULL) return; - group->item = NULL; + group->Clear(); for (i = 0; i != len; i++) { entry = (proc != NULL) ? proc(NULL, i) : list[i]; @@ -1720,11 +1720,9 @@ static void NewsDisplaySaveConfig(IniFile *ini, const char *grpname) static void AISaveConfig(IniFile *ini, const char *grpname) { IniGroup *group = ini->GetGroup(grpname); - IniItem **item; if (group == NULL) return; - group->item = NULL; - item = &group->item; + group->Clear(); for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { AIConfig *config = AIConfig::GetConfig(c, true); @@ -1739,9 +1737,8 @@ static void AISaveConfig(IniFile *ini, const char *grpname) name = "none"; } - *item = new IniItem(group, name); - (*item)->value = strdup(value); - item = &(*item)->next; + IniItem *item = new IniItem(group, name, strlen(name)); + item->SetValue(value); } } |