]> git.tdb.fi Git - poefilter.git/commitdiff
Use implicit instead of explicit category ordering
authorMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2018 00:05:58 +0000 (03:05 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2018 00:05:58 +0000 (03:05 +0300)
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.

source/category.cpp
source/category.h
source/poefilter.cpp

index 4ceed1883df32f7e971bd8dcb594795f64fa831c..bb2484dca021cbe11e52953ccf3f1c10ef65dbe7 100644 (file)
@@ -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<LinkedSocketsCondition>("linked_sockets");
        add_range<SocketsCondition>("sockets");
        add("or", &Loader::or_);
-       add("order", &Category::order);
        add_range<QualityCondition>("quality");
        add_range<RarityCondition>("rarity");
        add_range<WidthCondition>("width");
index dd47191e7bcd9d88a0aa59bceceb3e1e43bd52f7..da4c252bed5437b129064076f49d479b1f0afcc5 100644 (file)
@@ -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();
index b6fc1475a1f96fc093234d1c0e1a4f71d5524547..b90afc59d1b3f97c3567e0ce139eed2a90ff33d1 100644 (file)
@@ -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;
 }