mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
* Code modernization: src/p*, src/q*, src/r*, src/s* (partial) * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Spelling: vertice -> vertex
This commit is contained in:
parent
1992db1395
commit
7528986e44
28 changed files with 363 additions and 443 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue