mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Conflicts filter is now case-insensitive.
Also fixed lowercasing for non-ASCII strings. Not that it really matters because they don't then get displayed to the UI, but it might conceivably cause other problems.
This commit is contained in:
@@ -447,14 +447,14 @@ namespace loot {
|
||||
|
||||
activePlugins.clear();
|
||||
for (size_t i=0; i < pluginArrSize; ++i) {
|
||||
activePlugins.insert(boost::to_lower_copy(string(pluginArr[i])));
|
||||
activePlugins.insert(boost::locale::to_lower(string(pluginArr[i])));
|
||||
}
|
||||
|
||||
lo_destroy_handle(gh);
|
||||
}
|
||||
|
||||
bool Game::IsActive(const std::string& plugin) const {
|
||||
return activePlugins.find(boost::to_lower_copy(plugin)) != activePlugins.end();
|
||||
return activePlugins.find(boost::locale::to_lower(plugin)) != activePlugins.end();
|
||||
}
|
||||
|
||||
void Game::GetLoadOrder(std::list<std::string>& loadOrder) const {
|
||||
@@ -679,7 +679,8 @@ namespace loot {
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Found plugin: " << pluginPair.first;
|
||||
|
||||
auto plugin = plugins.emplace(pluginPair.first, Plugin(pluginPair.first));
|
||||
//Insert the lowercased name as a key for case-insensitive matching.
|
||||
auto plugin = plugins.emplace(boost::locale::to_lower(pluginPair.first), Plugin(pluginPair.first));
|
||||
|
||||
if (pluginPair.second > meanFileSize) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Creating individual loading thread for: " << pluginPair.first;
|
||||
|
||||
@@ -114,20 +114,6 @@ namespace loot {
|
||||
plugins.push_back(graph[vertex]);
|
||||
}
|
||||
return plugins;
|
||||
|
||||
|
||||
//Now sort exist plugins list according to order in tempPlugins.
|
||||
/*plugins.sort([tempPlugins](const Plugin& first, const Plugin& second){
|
||||
//Find both plugins, and compare distances from beginning.
|
||||
auto fIt = find(tempPlugins.begin(), tempPlugins.end(), first);
|
||||
auto sIt = find(tempPlugins.begin(), tempPlugins.end(), second);
|
||||
|
||||
if (fIt == tempPlugins.end() || sIt == tempPlugins.end())
|
||||
return false;
|
||||
|
||||
return distance(tempPlugins.begin(), fIt) < distance(tempPlugins.begin(), sIt);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
void CheckForCycles(const PluginGraph& graph) {
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace loot {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Evaluating condition: " << _condition;
|
||||
|
||||
unordered_map<std::string, bool>::const_iterator it = game.conditionCache.find(boost::to_lower_copy(_condition));
|
||||
unordered_map<std::string, bool>::const_iterator it = game.conditionCache.find(boost::locale::to_lower(_condition));
|
||||
if (it != game.conditionCache.end())
|
||||
return it->second;
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace loot {
|
||||
throw loot::error(loot::error::condition_eval_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\".")) % _condition).str());
|
||||
}
|
||||
|
||||
game.conditionCache.emplace(boost::to_lower_copy(_condition), eval);
|
||||
game.conditionCache.emplace(boost::locale::to_lower(_condition), eval);
|
||||
|
||||
return eval;
|
||||
}
|
||||
@@ -611,15 +611,15 @@ namespace loot {
|
||||
|
||||
//First need to get plugin's CRC.
|
||||
uint32_t crc = 0;
|
||||
unordered_map<std::string,uint32_t>::iterator it = game.crcCache.find(boost::to_lower_copy(name));
|
||||
unordered_map<std::string, uint32_t>::iterator it = game.crcCache.find(boost::locale::to_lower(name));
|
||||
if (it != game.crcCache.end())
|
||||
crc = it->second;
|
||||
else if (boost::filesystem::exists(game.DataPath() / name)) {
|
||||
crc = GetCrc32(game.DataPath() / name);
|
||||
game.crcCache.emplace(boost::to_lower_copy(name), crc);
|
||||
game.crcCache.emplace(boost::locale::to_lower(name), crc);
|
||||
} else if (boost::filesystem::exists(game.DataPath() / (name + ".ghost"))) {
|
||||
crc = GetCrc32(game.DataPath() / (name + ".ghost"));
|
||||
game.crcCache.emplace(boost::to_lower_copy(name), crc);
|
||||
game.crcCache.emplace(boost::locale::to_lower(name), crc);
|
||||
} else
|
||||
_dirtyInfo.clear();
|
||||
|
||||
|
||||
+9
-9
@@ -247,7 +247,7 @@ namespace loot {
|
||||
const string pluginName = req["args"][0].as<string>();
|
||||
BOOST_LOG_TRIVIAL(debug) << "Searching for plugins that conflict with " << pluginName;
|
||||
|
||||
auto pluginIt = g_app_state.CurrentGame().plugins.find(pluginName);
|
||||
auto pluginIt = g_app_state.CurrentGame().plugins.find(boost::locale::to_lower(pluginName));
|
||||
|
||||
// Checking for FormID overlap will only work if the plugins have been loaded, so check if
|
||||
// the first plugin has any FormIDs in memory, and if not load all plugins.
|
||||
@@ -258,8 +258,8 @@ namespace loot {
|
||||
if (pluginIt != g_app_state.CurrentGame().plugins.end()) {
|
||||
for (const auto& pluginPair : g_app_state.CurrentGame().plugins) {
|
||||
if (pluginIt->second.DoFormIDsOverlap(pluginPair.second)) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Found conflicting plugin: " << pluginPair.first;
|
||||
conflictingPlugins.emplace(pluginPair.first, pluginPair.second.Crc());
|
||||
BOOST_LOG_TRIVIAL(debug) << "Found conflicting plugin: " << pluginPair.second.Name();
|
||||
conflictingPlugins.emplace(pluginPair.second.Name(), pluginPair.second.Crc());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ namespace loot {
|
||||
list<string> loadOrder;
|
||||
g_app_state.CurrentGame().GetLoadOrder(loadOrder);
|
||||
for (const auto &pluginName : loadOrder) {
|
||||
const auto pos = g_app_state.CurrentGame().plugins.find(pluginName);
|
||||
const auto pos = g_app_state.CurrentGame().plugins.find(boost::locale::to_lower(pluginName));
|
||||
|
||||
if (pos != g_app_state.CurrentGame().plugins.end())
|
||||
installed.push_back(pos->second);
|
||||
@@ -657,7 +657,7 @@ namespace loot {
|
||||
|
||||
for (const auto& pluginPair : g_app_state.CurrentGame().plugins) {
|
||||
Plugin mlistPlugin(pluginPair.second);
|
||||
mlistPlugin.MergeMetadata(g_app_state.CurrentGame().masterlist.FindPlugin(pluginPair.first));
|
||||
mlistPlugin.MergeMetadata(g_app_state.CurrentGame().masterlist.FindPlugin(pluginPair.second.Name()));
|
||||
|
||||
YAML::Node pluginNode;
|
||||
if (!mlistPlugin.HasNameOnly()) {
|
||||
@@ -672,7 +672,7 @@ namespace loot {
|
||||
|
||||
// Now merge masterlist and userlist metadata and evaluate,
|
||||
// putting any resulting metadata into the base of the pluginNode.
|
||||
YAML::Node derivedNode = GenerateDerivedMetadata(pluginPair.first);
|
||||
YAML::Node derivedNode = GenerateDerivedMetadata(pluginPair.second.Name());
|
||||
|
||||
for (auto it = derivedNode.begin(); it != derivedNode.end(); ++it) {
|
||||
const string key = it->first.as<string>();
|
||||
@@ -751,11 +751,11 @@ namespace loot {
|
||||
YAML::Node Handler::GenerateDerivedMetadata(const std::string& pluginName) {
|
||||
|
||||
// Now rederive the displayed metadata from the masterlist and userlist.
|
||||
auto pluginIt = g_app_state.CurrentGame().plugins.find(pluginName);
|
||||
auto pluginIt = g_app_state.CurrentGame().plugins.find(boost::locale::to_lower(pluginName));
|
||||
if (pluginIt != g_app_state.CurrentGame().plugins.end()) {
|
||||
|
||||
const Plugin master = g_app_state.CurrentGame().masterlist.FindPlugin(pluginIt->first);
|
||||
const Plugin user = g_app_state.CurrentGame().userlist.FindPlugin(pluginIt->first);
|
||||
const Plugin master = g_app_state.CurrentGame().masterlist.FindPlugin(pluginIt->second.Name());
|
||||
const Plugin user = g_app_state.CurrentGame().userlist.FindPlugin(pluginIt->second.Name());
|
||||
|
||||
return this->GenerateDerivedMetadata(pluginIt->second, master, user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user