]> git.mxchange.org Git - simgear.git/commitdiff
Support constant true and false values in conditions.
authorJames Turner <zakalawe@mac.com>
Thu, 27 May 2010 14:19:04 +0000 (15:19 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 27 May 2010 14:19:04 +0000 (15:19 +0100)
simgear/props/condition.cxx

index 20321052271ffaaf69c706bb2b394068fc82c07d..85c539cfe7183e001cb164a32538fe5c8ce4d0e2 100644 (file)
@@ -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;
 }