mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Remove settings properly (#7676)
This commit is contained in:
parent
18a8fbf465
commit
a29bc8e8ba
2 changed files with 12 additions and 7 deletions
|
@ -225,9 +225,13 @@ bool Settings::updateConfigObject(std::istream &is, std::ostream &os,
|
|||
case SPE_KVPAIR:
|
||||
it = m_settings.find(name);
|
||||
if (it != m_settings.end() &&
|
||||
(it->second.is_group || it->second.value != value)) {
|
||||
(it->second.is_group || it->second.value != value)) {
|
||||
printEntry(os, name, it->second, tab_depth);
|
||||
was_modified = true;
|
||||
} else if (it == m_settings.end()) {
|
||||
// Remove by skipping
|
||||
was_modified = true;
|
||||
break;
|
||||
} else {
|
||||
os << line << "\n";
|
||||
if (event == SPE_MULTILINE)
|
||||
|
@ -242,6 +246,10 @@ bool Settings::updateConfigObject(std::istream &is, std::ostream &os,
|
|||
sanity_check(it->second.group != NULL);
|
||||
was_modified |= it->second.group->updateConfigObject(is, os,
|
||||
"}", tab_depth + 1);
|
||||
} else if (it == m_settings.end()) {
|
||||
// Remove by skipping
|
||||
was_modified = true;
|
||||
break;
|
||||
} else {
|
||||
printEntry(os, name, it->second, tab_depth);
|
||||
was_modified = true;
|
||||
|
@ -901,6 +909,8 @@ bool Settings::remove(const std::string &name)
|
|||
if (it != m_settings.end()) {
|
||||
delete it->second.group;
|
||||
m_settings.erase(it);
|
||||
|
||||
doCallbacks(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue