summaryrefslogtreecommitdiffstats
path: root/src/Settings.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2023-07-08 21:41:27 +0200
committerGitHub <noreply@github.com>2023-07-08 21:41:27 +0200
commita68f48ad526d0843eb451af0be7f119db5ff794e (patch)
tree3c539c9e7de841c6616f532dadb7c8c1ef552d95 /src/Settings.cpp
parentMerge pull request #80 from LaG1924/ftr/better-water (diff)
parentFixed some errors detected by static analysis (diff)
downloadAltCraft-master.tar
AltCraft-master.tar.gz
AltCraft-master.tar.bz2
AltCraft-master.tar.lz
AltCraft-master.tar.xz
AltCraft-master.tar.zst
AltCraft-master.zip
Diffstat (limited to 'src/Settings.cpp')
-rw-r--r--src/Settings.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Settings.cpp b/src/Settings.cpp
index a585752..5287556 100644
--- a/src/Settings.cpp
+++ b/src/Settings.cpp
@@ -23,7 +23,7 @@ void Settings::Load() {
stream >> j;
for (json::iterator it = j.begin(); it != j.end(); ++it) {
- values.insert(std::make_pair(it.key(), it->get<std::string>()));
+ values.try_emplace(it.key(), it->get<std::string>());
}
LOG(INFO) << "Loaded " << values.size() << " settings";
}
@@ -47,7 +47,7 @@ void Settings::Save() {
std::string Settings::Read(const std::string &key, const std::string &defaultValue) {
auto it = values.find(key);
if (it == values.end()) {
- values.insert(std::make_pair(key, defaultValue));
+ values.try_emplace(key, defaultValue);
it = values.find(key);
}
return it->second;