/* * BonusSelector.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * * License: GNU General Public License v2.0 or later * Full text of license available in license.txt file, in main folder * */ #include "StdInc.h" #include "BonusSelector.h" VCMI_LIB_NAMESPACE_BEGIN namespace Selector { DLL_LINKAGE const CSelectFieldEqual & type() { static const CSelectFieldEqual stype(&Bonus::type); return stype; } DLL_LINKAGE const CSelectFieldEqual & subtype() { static const CSelectFieldEqual ssubtype(&Bonus::subtype); return ssubtype; } DLL_LINKAGE const CSelectFieldEqual & info() { static const CSelectFieldEqual sinfo(&Bonus::additionalInfo); return sinfo; } DLL_LINKAGE const CSelectFieldEqual & sourceType() { static const CSelectFieldEqual ssourceType(&Bonus::source); return ssourceType; } DLL_LINKAGE const CSelectFieldEqual & targetSourceType() { static const CSelectFieldEqual ssourceType(&Bonus::targetSourceType); return ssourceType; } DLL_LINKAGE const CSelectFieldEqual & effectRange() { static const CSelectFieldEqual seffectRange(&Bonus::effectRange); return seffectRange; } DLL_LINKAGE CWillLastTurns turns(int turns) { return CWillLastTurns(turns); } DLL_LINKAGE CWillLastDays days(int days) { return CWillLastDays(days); } CSelector DLL_LINKAGE typeSubtype(BonusType Type, BonusSubtypeID Subtype) { return type()(Type).And(subtype()(Subtype)); } CSelector DLL_LINKAGE typeSubtypeInfo(BonusType type, BonusSubtypeID subtype, const CAddInfo & info) { return CSelectFieldEqual(&Bonus::type)(type) .And(CSelectFieldEqual(&Bonus::subtype)(subtype)) .And(CSelectFieldEqual(&Bonus::additionalInfo)(info)); } CSelector DLL_LINKAGE source(BonusSource source, BonusSourceID sourceID) { return CSelectFieldEqual(&Bonus::source)(source) .And(CSelectFieldEqual(&Bonus::sid)(sourceID)); } CSelector DLL_LINKAGE sourceTypeSel(BonusSource source) { return CSelectFieldEqual(&Bonus::source)(source); } CSelector DLL_LINKAGE valueType(BonusValueType valType) { return CSelectFieldEqual(&Bonus::valType)(valType); } CSelector DLL_LINKAGE typeSubtypeValueType(BonusType Type, BonusSubtypeID Subtype, BonusValueType valType) { return type()(Type) .And(subtype()(Subtype)) .And(valueType(valType)); } DLL_LINKAGE CSelector all([](const Bonus * b){return true;}); DLL_LINKAGE CSelector none([](const Bonus * b){return false;}); } VCMI_LIB_NAMESPACE_END