summaryrefslogtreecommitdiffstats
path: root/src/OverridesSettingsRepository.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2016-04-13 08:05:11 +0200
committerAlexander Harkness <me@bearbin.net>2016-04-13 08:05:11 +0200
commit8447e4e333b075cf9f26e5be081ff4797b4aef6b (patch)
treefd7d5a8d3205de6643a5ad61e211dc6194ce56b6 /src/OverridesSettingsRepository.cpp
parentMerge pull request #3133 from LogicParrot/readme10 (diff)
parentFixed port override code. (diff)
downloadcuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar.gz
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar.bz2
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar.lz
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar.xz
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.tar.zst
cuberite-8447e4e333b075cf9f26e5be081ff4797b4aef6b.zip
Diffstat (limited to 'src/OverridesSettingsRepository.cpp')
-rw-r--r--src/OverridesSettingsRepository.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/OverridesSettingsRepository.cpp b/src/OverridesSettingsRepository.cpp
index 9e85abce6..f3db96a5c 100644
--- a/src/OverridesSettingsRepository.cpp
+++ b/src/OverridesSettingsRepository.cpp
@@ -108,31 +108,26 @@ std::vector<std::pair<AString, AString>> cOverridesSettingsRepository::GetValues
{
auto overrides = m_Overrides->GetValues(a_keyName);
auto main = m_Main->GetValues(a_keyName);
- std::sort(overrides.begin(), overrides.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
- std::sort(main.begin(), main.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
- std::vector<std::pair<AString, AString>> ret;
+ auto ret = overrides;
-
- size_t overridesIndex = 0;
- for (auto pair : main)
+ for (const auto & mainpair : main)
{
- if (overridesIndex >= overrides.size())
- {
- ret.push_back(pair);
- continue;
- }
- if (pair.first == overrides[overridesIndex].first)
+ bool found = false;
+ for (const auto & returnpair : ret)
{
- continue;
+ if (returnpair.first == mainpair.first)
+ {
+ found = true;
+ break;
+ }
}
- while (pair.first > overrides[overridesIndex].first)
+ if (found == false)
{
- ret.push_back(overrides[overridesIndex]);
- overridesIndex++;
+ ret.push_back(mainpair);
}
- ret.push_back(pair);
}
+
return ret;
}
@@ -270,4 +265,3 @@ bool cOverridesSettingsRepository::Flush()
{
return m_Overrides->Flush() && m_Main->Flush();
}
-