mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Replaced Plugin hasher with std specialisation.
This commit is contained in:
@@ -108,7 +108,7 @@ namespace loot {
|
||||
in.close();
|
||||
|
||||
if (metadataList["plugins"])
|
||||
plugins = metadataList["plugins"].as< unordered_set<Plugin, plugin_hash> >();
|
||||
plugins = metadataList["plugins"].as< unordered_set<Plugin> >();
|
||||
if (metadataList["globals"])
|
||||
messages = metadataList["globals"].as< list<Message> >();
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ namespace loot {
|
||||
|
||||
bool operator == (const MetadataList& rhs) const; //Compares content.
|
||||
|
||||
std::unordered_set<Plugin, plugin_hash> plugins;
|
||||
std::unordered_set<Plugin> plugins;
|
||||
std::list<Message> messages;
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -431,7 +431,7 @@ namespace loot {
|
||||
try {
|
||||
this->MetadataList::Load(game.MasterlistPath());
|
||||
|
||||
unordered_set<Plugin, plugin_hash> tempSet;
|
||||
unordered_set<Plugin> tempSet;
|
||||
for (auto &plugin : plugins) {
|
||||
tempSet.insert(Plugin(plugin).EvalAllConditions(game, language));
|
||||
}
|
||||
|
||||
@@ -798,12 +798,6 @@ namespace loot {
|
||||
return boost::filesystem::exists(game.DataPath() / (name.substr(0, name.length() - 3) + "bsa"));
|
||||
}
|
||||
|
||||
size_t plugin_hash::operator () (const Plugin& p) const {
|
||||
size_t seed = 0;
|
||||
boost::hash_combine(seed, boost::locale::to_lower(p.Name()));
|
||||
return seed;
|
||||
}
|
||||
|
||||
bool operator == (const File& lhs, const Plugin& rhs) {
|
||||
return boost::iequals(lhs.Name(), rhs.Name());
|
||||
}
|
||||
|
||||
+11
-5
@@ -32,6 +32,8 @@
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
|
||||
namespace loot {
|
||||
|
||||
const unsigned int max_priority = 1000000;
|
||||
@@ -243,11 +245,6 @@ namespace loot {
|
||||
size_t numOverrideRecords;
|
||||
};
|
||||
|
||||
struct plugin_hash : std::unary_function<Plugin, size_t> {
|
||||
size_t operator () (const Plugin& p) const;
|
||||
};
|
||||
|
||||
|
||||
bool operator == (const File& lhs, const Plugin& rhs);
|
||||
|
||||
bool operator == (const Plugin& lhs, const File& rhs);
|
||||
@@ -257,4 +254,13 @@ namespace loot {
|
||||
bool IsPlugin(const std::string& file);
|
||||
}
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash < loot::Plugin > {
|
||||
size_t operator() (const loot::Plugin& plugin) {
|
||||
return hash<string>()(boost::locale::to_lower(plugin.Name()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user