summaryrefslogtreecommitdiffstats
path: root/src/OverridesSettingsRepository.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2016-04-19 00:04:13 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2016-04-19 00:04:13 +0200
commite0e3f396f2c6861242a1b076d07c73da55d40160 (patch)
tree0f4b0ab0299fb0f150c149e5f3d146a6f42b7960 /src/OverridesSettingsRepository.cpp
parentMerge pull request #3148 from LogicParrot/pathFinderFix (diff)
downloadcuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar.gz
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar.bz2
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar.lz
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar.xz
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.tar.zst
cuberite-e0e3f396f2c6861242a1b076d07c73da55d40160.zip
Diffstat (limited to '')
-rw-r--r--src/OverridesSettingsRepository.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/OverridesSettingsRepository.cpp b/src/OverridesSettingsRepository.cpp
index 9e85abce6..607f7c5d0 100644
--- a/src/OverridesSettingsRepository.cpp
+++ b/src/OverridesSettingsRepository.cpp
@@ -108,30 +108,24 @@ 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 (auto mainpair : main)
{
- if (overridesIndex >= overrides.size())
- {
- ret.push_back(pair);
- continue;
- }
- if (pair.first == overrides[overridesIndex].first)
+ bool found = false;
+ for (const auto & overridepair : overrides)
{
- continue;
+ if (overridepair.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;
}