GameConfigLoader: Fix blank keys for variable sections

This commit is contained in:
MerryMage 2017-05-13 14:27:16 +01:00
parent 460459fb7d
commit dd9e622155
1 changed files with 4 additions and 4 deletions

View File

@ -196,7 +196,7 @@ static ConfigLocation MapINIToRealLocation(const std::string& section, const std
// Certain sections like 'Speedhacks' has keys that are variable
it = ini_to_location.find({section, ""});
if (it != ini_to_location.end())
return it->second;
return {it->second.system, it->second.section, key};
// Attempt to load it as a configuration option
// It will be in the format of '<System>.<Section>'
@ -230,11 +230,11 @@ static std::pair<std::string, std::string> GetINILocationFromConfig(const Config
// Try again, but this time with an empty key
// Certain sections like 'Speedhacks' have keys that are variable
it = std::find_if(ini_to_location.begin(), ini_to_location.end(), [&location](const auto& entry) {
return std::tie(entry.second.system, entry.second.key) ==
std::tie(location.system, location.key);
return std::tie(entry.second.system, entry.second.section) ==
std::tie(location.system, location.section);
});
if (it != ini_to_location.end())
return it->first;
return {it->first.first, location.key};
WARN_LOG(CORE, "Unknown option: %s.%s", location.section.c_str(), location.key.c_str());
return {"", ""};