summaryrefslogtreecommitdiff
path: root/src/ini.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-25 15:15:41 +0000
committerrubidium <rubidium@openttd.org>2008-08-25 15:15:41 +0000
commit621a9b647afce6a9d8172bea6c8f781f5151bb29 (patch)
treee0c81bcd849d7f96b671cd698a6d2c6331595c75 /src/ini.cpp
parent262ddecfc56b31e1b59457ecacc0267517088a3f (diff)
downloadopenttd-621a9b647afce6a9d8172bea6c8f781f5151bb29.tar.xz
(svn r14167) -Fix: items in some ini-groups got duplicated on save.
Diffstat (limited to 'src/ini.cpp')
-rw-r--r--src/ini.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ini.cpp b/src/ini.cpp
index c72addd65..7c1786a74 100644
--- a/src/ini.cpp
+++ b/src/ini.cpp
@@ -19,14 +19,6 @@ IniItem::IniItem(IniGroup *parent, const char *name, size_t len) : next(NULL), v
parent->last_item = &this->next;
}
-IniItem::IniItem(IniGroup *parent, const char *name, const char *value) : next(NULL), comment(NULL)
-{
- this->name = strdup(name);
- this->value = strdup(value);
- *parent->last_item = this;
- parent->last_item = &this->next;
-}
-
IniItem::~IniItem()
{
free(this->name);
@@ -36,6 +28,12 @@ IniItem::~IniItem()
delete this->next;
}
+void IniItem::SetValue(const char *value)
+{
+ free(this->value);
+ this->value = strdup(value);
+}
+
IniGroup::IniGroup(IniFile *parent, const char *name, size_t len) : next(NULL), type(IGT_VARIABLES), item(NULL), comment(NULL)
{
if (len == 0) len = strlen(name);