From: Mikko Rasa Date: Wed, 15 Aug 2018 00:05:58 +0000 (+0300) Subject: Use implicit instead of explicit category ordering X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=affc72bbd6ef9bcf2c5f94553a53582d42d40cc2;p=poefilter.git Use implicit instead of explicit category ordering Categories from wildcards now appear in the output filter in the same order as they were defined in the source. This feels more intuitive than manually assigning arbitrary numbers. I may add new relative ordering statements in the future if a use case arises. --- diff --git a/source/category.cpp b/source/category.cpp index 4ceed18..bb2484d 100644 --- a/source/category.cpp +++ b/source/category.cpp @@ -8,12 +8,17 @@ using namespace std; using namespace Msp; -Category::Category(const string &n): - name(n), +Category::Category(): condition(0), order(0) { } +Category::Category(const string &n, unsigned o): + name(n), + condition(0), + order(o) +{ } + Category::Category(const Category &other): name(other.name), condition(other.condition ? other.condition->clone() : 0), @@ -62,7 +67,6 @@ Category::Loader::Loader(Category &c, const PoeFilter &p, CompoundCondition *n): add_range("linked_sockets"); add_range("sockets"); add("or", &Loader::or_); - add("order", &Category::order); add_range("quality"); add_range("rarity"); add_range("width"); diff --git a/source/category.h b/source/category.h index dd47191..da4c252 100644 --- a/source/category.h +++ b/source/category.h @@ -57,7 +57,8 @@ private: Appearance appearance; public: - Category(const std::string & = std::string()); + Category(); + Category(const std::string &, unsigned); Category(const Category &); Category &operator=(const Category &); ~Category(); diff --git a/source/poefilter.cpp b/source/poefilter.cpp index b6fc147..b90afc5 100644 --- a/source/poefilter.cpp +++ b/source/poefilter.cpp @@ -57,7 +57,7 @@ PoeFilter::Loader::Loader(PoeFilter &f): void PoeFilter::Loader::category(const string &name) { - Category cat(name); + Category cat(name, obj.categories.size()); load_sub(cat, obj); obj.categories[name] = cat; }