From: James Turner Date: Thu, 27 May 2010 14:19:04 +0000 (+0100) Subject: Support constant true and false values in conditions. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b4b9d3a4b7bf0d80e971551be81f7d8196919157;p=simgear.git Support constant true and false values in conditions. --- diff --git a/simgear/props/condition.cxx b/simgear/props/condition.cxx index 20321052..85c539cf 100644 --- a/simgear/props/condition.cxx +++ b/simgear/props/condition.cxx @@ -41,6 +41,18 @@ private: SGConstPropertyNode_ptr _node; }; +/** + * Condition with constant value + * + */ +class SGConstantCondition : public SGCondition +{ +public: + SGConstantCondition (bool v) : _value(v) { ; } + virtual bool test () const { return _value; } +private: + bool _value; +}; /** * Condition for a 'not' operator. @@ -529,6 +541,10 @@ readCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) false); else if (name == "not-equals") return readComparison(prop_root, node, SGComparisonCondition::EQUALS, true); + else if (name == "false") + return new SGConstantCondition(false); + else if (name == "true") + return new SGConstantCondition(true); else return 0; }