X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcategory.cpp;h=e697aeefac209d456bb2ac30d6f8bb1474d75e55;hb=HEAD;hp=bb2484dca021cbe11e52953ccf3f1c10ef65dbe7;hpb=affc72bbd6ef9bcf2c5f94553a53582d42d40cc2;p=poefilter.git diff --git a/source/category.cpp b/source/category.cpp index bb2484d..e697aee 100644 --- a/source/category.cpp +++ b/source/category.cpp @@ -47,7 +47,15 @@ void Category::create_statements(list &st) const st.push_back(FilterStatement()); if(condition) - condition->add_lines(st); + { + Condition *flat = condition->flatten(); + if(flat) + { + flat->add_lines(st); + delete flat; + } + // TODO handle the case of the entire condition being non-viable + } } @@ -59,12 +67,14 @@ 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"); add_range("item_level"); add("linked_colors", &Loader::linked_colors); add_range("linked_sockets"); + add_range("map_tier"); add_range("sockets"); add("or", &Loader::or_); add_range("quality"); @@ -106,6 +116,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) {