X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frangecondition.h;h=7d85125b6dae6392be187bf4932bf14b54f57867;hb=f8bce1ce641e84d8271cb16eadb695b039032358;hp=a72fec2d1475db075baffbeb1ed46aa3979480e0;hpb=746329e61ac9f26962af740b0b11dee716803521;p=poefilter.git diff --git a/source/rangecondition.h b/source/rangecondition.h index a72fec2..7d85125 100644 --- a/source/rangecondition.h +++ b/source/rangecondition.h @@ -20,6 +20,7 @@ public: RangeCondition(Type, Type); virtual RangeCondition *clone() const; + virtual bool equals(const Condition &) const; virtual bool can_merge(const Condition &, const CompoundCondition &) const; virtual RangeCondition *merge(const std::vector &, const CompoundCondition &) const; virtual bool is_viable() const { return min<=max; } @@ -71,6 +72,17 @@ struct DropLevelTraits typedef RangeCondition DropLevelCondition; +struct MapTierTraits +{ + typedef unsigned Type; + static unsigned get_min() { return 1; } + static unsigned get_max() { return 17; } + static const char *get_keyword() { return "MapTier"; } +}; + +typedef RangeCondition MapTierCondition; + + struct WidthTraits { typedef unsigned Type; @@ -133,6 +145,16 @@ RangeCondition *RangeCondition::clone() const return new RangeCondition(min, max); } +template +bool RangeCondition::equals(const Condition &other) const +{ + const RangeCondition *other_range = dynamic_cast *>(&other); + if(!other_range) + return false; + + return (min==other_range->min && max==other_range->max); +} + template bool RangeCondition::can_merge(const Condition &other, const CompoundCondition &parent) const {