summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 1fa4ac528..ea54ab348 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -169,9 +169,8 @@ void Settings::writeLines(std::ostream &os, u32 tab_depth) const
{
MutexAutoLock lock(m_mutex);
- for (SettingEntries::const_iterator it = m_settings.begin();
- it != m_settings.end(); ++it)
- printEntry(os, it->first, it->second, tab_depth);
+ for (const auto &setting_it : m_settings)
+ printEntry(os, setting_it.first, setting_it.second, tab_depth);
}
@@ -323,7 +322,7 @@ bool Settings::parseCommandLine(int argc, char *argv[],
ValueType type = n->second.type;
- std::string value = "";
+ std::string value;
if (type == VALUETYPE_FLAG) {
value = "true";
@@ -506,7 +505,7 @@ bool Settings::getNoiseParamsFromValue(const std::string &name,
np.persist = stof(f.next(","));
std::string optional_params = f.next("");
- if (optional_params != "")
+ if (!optional_params.empty())
np.lacunarity = stof(optional_params);
return true;
@@ -549,9 +548,8 @@ bool Settings::exists(const std::string &name) const
std::vector<std::string> Settings::getNames() const
{
std::vector<std::string> names;
- for (SettingEntries::const_iterator i = m_settings.begin();
- i != m_settings.end(); ++i) {
- names.push_back(i->first);
+ for (const auto &settings_it : m_settings) {
+ names.push_back(settings_it.first);
}
return names;
}
@@ -861,9 +859,9 @@ bool Settings::remove(const std::string &name)
delete it->second.group;
m_settings.erase(it);
return true;
- } else {
- return false;
}
+
+ return false;
}
@@ -887,8 +885,7 @@ void Settings::updateValue(const Settings &other, const std::string &name)
MutexAutoLock lock(m_mutex);
try {
- std::string val = other.get(name);
- m_settings[name] = val;
+ m_settings[name] = other.get(name);
} catch (SettingNotFoundException &e) {
}
}
@@ -965,7 +962,7 @@ void Settings::registerChangedCallback(const std::string &name,
SettingsChangedCallback cbf, void *userdata)
{
MutexAutoLock lock(m_callback_mutex);
- m_callbacks[name].push_back(std::make_pair(cbf, userdata));
+ m_callbacks[name].emplace_back(cbf, userdata);
}
void Settings::deregisterChangedCallback(const std::string &name,