summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index ef1aaa1b6..505638e94 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -414,6 +414,7 @@ static const void *StringToVal(const SettingDescBase *desc, const char *orig_str
return desc->def;
}
+ case SDT_STDSTRING:
case SDT_STRING: return orig_str;
case SDT_INTLIST: return str;
default: break;
@@ -565,6 +566,22 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
}
break;
+ case SDT_STDSTRING:
+ switch (GetVarMemType(sld->conv)) {
+ case SLE_VAR_STR:
+ case SLE_VAR_STRQ:
+ if (p != nullptr) {
+ reinterpret_cast<std::string *>(ptr)->assign((const char *)p);
+ } else {
+ reinterpret_cast<std::string *>(ptr)->clear();
+ }
+ break;
+
+ default: NOT_REACHED();
+ }
+
+ break;
+
case SDT_INTLIST: {
if (!LoadIntList((const char*)p, ptr, sld->length, GetVarMemType(sld->conv))) {
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY);
@@ -701,6 +718,22 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
}
break;
+ case SDT_STDSTRING:
+ switch (GetVarMemType(sld->conv)) {
+ case SLE_VAR_STR: strecpy(buf, reinterpret_cast<std::string *>(ptr)->c_str(), lastof(buf)); break;
+
+ case SLE_VAR_STRQ:
+ if (reinterpret_cast<std::string *>(ptr)->empty()) {
+ buf[0] = '\0';
+ } else {
+ seprintf(buf, lastof(buf), "\"%s\"", reinterpret_cast<std::string *>(ptr)->c_str());
+ }
+ break;
+
+ default: NOT_REACHED();
+ }
+ break;
+
case SDT_INTLIST:
MakeIntList(buf, lastof(buf), ptr, sld->length, sld->conv);
break;