Explorar o código

vcmi: add a Not bonus selector.

It will allow us to form complex selector logics with full boolean
operator.
Konstantin %!s(int64=2) %!d(string=hai) anos
pai
achega
ee90400d66
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      lib/HeroBonus.h

+ 6 - 0
lib/HeroBonus.h

@@ -59,6 +59,12 @@ public:
 		return [thisCopy, rhs](const Bonus *b) mutable { return thisCopy(b) || rhs(b); };
 	}
 
+	CSelector Not() const
+	{
+		auto thisCopy = *this;
+		return [thisCopy](const Bonus *b) mutable { return !thisCopy(b); };
+	}
+
 	bool operator()(const Bonus *b) const
 	{
 		return TBase::operator()(b);