From 6151bc1714e16e55116fc69930d365921b43f1b7 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Thu, 18 May 2017 13:53:52 +0100 Subject: [PATCH] Config: Extract layer search order to header --- Source/Core/Common/Config/Enums.h | 8 ++++++++ Source/Core/Common/Config/Section.cpp | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Core/Common/Config/Enums.h b/Source/Core/Common/Config/Enums.h index d5f866ff1e..95718d0ca7 100644 --- a/Source/Core/Common/Config/Enums.h +++ b/Source/Core/Common/Config/Enums.h @@ -4,6 +4,8 @@ #pragma once +#include + namespace Config { enum class LayerType @@ -29,4 +31,10 @@ enum class System Debugger, UI, }; + +constexpr std::array SEARCH_ORDER{{ + // Skip the meta layer + LayerType::CurrentRun, LayerType::CommandLine, LayerType::Movie, LayerType::Netplay, + LayerType::LocalGame, LayerType::GlobalGame, LayerType::Base, +}}; } diff --git a/Source/Core/Common/Config/Section.cpp b/Source/Core/Common/Config/Section.cpp index 5c7f52eb63..ac6741416a 100644 --- a/Source/Core/Common/Config/Section.cpp +++ b/Source/Core/Common/Config/Section.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include #include #include #include @@ -254,13 +253,7 @@ bool RecursiveSection::Exists(const std::string& key) const bool RecursiveSection::Get(const std::string& key, std::string* value, const std::string& default_value) const { - static constexpr std::array search_order = {{ - // Skip the meta layer - LayerType::CurrentRun, LayerType::CommandLine, LayerType::Movie, LayerType::Netplay, - LayerType::LocalGame, LayerType::GlobalGame, LayerType::Base, - }}; - - for (auto layer_id : search_order) + for (auto layer_id : SEARCH_ORDER) { auto layers_it = Config::GetLayers()->find(layer_id); if (layers_it == Config::GetLayers()->end())