From: Mikko Rasa Date: Wed, 15 Aug 2018 15:55:47 +0000 (+0300) Subject: Allow categories to use other categories as conditions X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=62b3368537301dd6bb6033d87000099c7adfff80;p=poefilter.git Allow categories to use other categories as conditions --- diff --git a/source/category.cpp b/source/category.cpp index bb2484d..fb12fec 100644 --- a/source/category.cpp +++ b/source/category.cpp @@ -59,6 +59,7 @@ Category::Loader::Loader(Category &c, const PoeFilter &p, CompoundCondition *n): { add("and", &Loader::and_); add("base_type", &Loader::condition); + add("category", &Loader::category); add("class", &Loader::condition); add_range("drop_level"); add_range("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 void Category::Loader::condition(typename T::Type value) { diff --git a/source/category.h b/source/category.h index da4c252..2fb3084 100644 --- a/source/category.h +++ b/source/category.h @@ -34,6 +34,8 @@ public: private: void and_(); + void category(const std::string &); + template void condition(typename T::Type);