Fixed the FormID overlap being calculated wrongly because ordered containers are required for set_intersection, and fixed a typo causing every plugin to want to load after everything else.

This commit is contained in:
WrinklyNinja
2013-05-11 21:51:47 +01:00
parent 75e0f0e98d
commit ed23abd12c
2 changed files with 8 additions and 25 deletions
+5 -7
View File
@@ -30,8 +30,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <fstream>
using namespace std;
namespace boss {
@@ -536,13 +534,13 @@ namespace boss {
return !(*this < rhs);
}
boost::unordered_set<FormID,FormID_hash> Plugin::FormIDs() const {
std::set<FormID> Plugin::FormIDs() const {
return formIDs;
}
boost::unordered_set<FormID,FormID_hash> Plugin::OverlapFormIDs(const Plugin& plugin) const {
boost::unordered_set<FormID,FormID_hash> otherFormIDs = plugin.FormIDs();
boost::unordered_set<FormID,FormID_hash> overlap;
std::set<FormID> Plugin::OverlapFormIDs(const Plugin& plugin) const {
set<FormID> otherFormIDs = plugin.FormIDs();
set<FormID> overlap;
set_intersection(formIDs.begin(), formIDs.end(), otherFormIDs.begin(), otherFormIDs.end(), inserter(overlap, overlap.begin()));
@@ -568,7 +566,7 @@ namespace boss {
}
if (find(requirements.begin(), requirements.end(), plugin) != requirements.end())
return true;
if (find(loadAfter.begin(), loadAfter.end(), plugin) != requirements.end())
if (find(loadAfter.begin(), loadAfter.end(), plugin) != loadAfter.end())
return true;
return false;
}
+3 -18
View File
@@ -31,8 +31,6 @@
#include <list>
#include <set>
#include <boost/unordered_set.hpp>
namespace boss {
@@ -59,19 +57,6 @@ namespace boss {
uint32_t id;
};
struct FormID_hash
: std::unary_function<FormID, std::size_t>
{
std::size_t operator()(FormID const& p) const
{
std::size_t seed = 0;
boost::hash_combine(seed, p.Plugin());
boost::hash_combine(seed, p.Id());
return seed;
}
};
class ConditionalData {
public:
ConditionalData();
@@ -158,7 +143,7 @@ namespace boss {
std::list<Message> Messages() const;
std::set<Tag> Tags() const;
boost::unordered_set<FormID,FormID_hash> FormIDs() const;
std::set<FormID> FormIDs() const;
std::vector<std::string> Masters() const;
bool IsMaster() const; //Checks master bit flag.
std::string Version() const;
@@ -187,7 +172,7 @@ namespace boss {
bool operator >= (const Plugin& rhs) const;
//Load ordering functions.
boost::unordered_set<FormID,FormID_hash> OverlapFormIDs(const Plugin& plugin) const;
std::set<FormID> OverlapFormIDs(const Plugin& plugin) const;
bool MustLoadAfter(const Plugin& plugin) const; //Checks masters, reqs and loadAfter.
//Validity checks.
@@ -203,7 +188,7 @@ namespace boss {
std::set<Tag> tags;
std::vector<std::string> masters;
boost::unordered_set<FormID,FormID_hash> formIDs;
std::set<FormID> formIDs;
std::string version; //Obtained from description field.
bool isMaster;
};