瀏覽代碼

vcmi: add a Not bonus selector.

It will allow us to form complex selector logics with full boolean
operator.
Konstantin 2 年之前
父節點
當前提交
ee90400d66
共有 1 個文件被更改,包括 6 次插入0 次删除
  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);