]> git.tdb.fi Git - poefilter.git/commitdiff
Allow categories to use other categories as conditions
authorMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2018 15:55:47 +0000 (18:55 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2018 15:55:47 +0000 (18:55 +0300)
source/category.cpp
source/category.h

index bb2484dca021cbe11e52953ccf3f1c10ef65dbe7..fb12fec0ddfd25fa0dc14996b80e780af62507ae 100644 (file)
@@ -59,6 +59,7 @@ Category::Loader::Loader(Category &c, const PoeFilter &p, CompoundCondition *n):
 {
        add("and", &Loader::and_);
        add("base_type", &Loader::condition<BaseTypeCondition>);
+       add("category", &Loader::category);
        add("class", &Loader::condition<ClassCondition>);
        add_range<DropLevelCondition>("drop_level");
        add_range<HeightCondition>("height");
@@ -106,6 +107,12 @@ void Category::Loader::and_()
        add_condition(cond.release());
 }
 
+void Category::Loader::category(const string &name)
+{
+       const Category &categ = poe.get_category(name);
+       add_condition(categ.condition->clone());
+}
+
 template<typename T>
 void Category::Loader::condition(typename T::Type value)
 {
index da4c252bed5437b129064076f49d479b1f0afcc5..2fb30840321e35de03b4ebece9e933c282e4c754 100644 (file)
@@ -34,6 +34,8 @@ public:
        private:
                void and_();
 
+               void category(const std::string &);
+
                template<typename T>
                void condition(typename T::Type);