]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/condition.cxx
Modified Files:
[simgear.git] / simgear / props / condition.cxx
index b1314af421c7c0bab77fa357ce71e6a442e98c69..54f5324f57af658cd0a501426399618c76753cf8 100644 (file)
 
 // #include STL_IOSTREAM
 
-#include <simgear/misc/exception.hxx>
+#include <simgear/structure/exception.hxx>
 
 #include "props.hxx"
-
 #include "condition.hxx"
 
 SG_USING_STD(istream);
@@ -66,7 +65,6 @@ SGNotCondition::SGNotCondition (SGCondition * condition)
 
 SGNotCondition::~SGNotCondition ()
 {
-  delete _condition;
 }
 
 bool
@@ -87,8 +85,6 @@ SGAndCondition::SGAndCondition ()
 
 SGAndCondition::~SGAndCondition ()
 {
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
 }
 
 bool
@@ -120,8 +116,6 @@ SGOrCondition::SGOrCondition ()
 
 SGOrCondition::~SGOrCondition ()
 {
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
 }
 
 bool
@@ -220,7 +214,7 @@ doComparison (const SGPropertyNode * left, const SGPropertyNode *right)
     break;
   }
   }
-  throw sg_exception("Unrecognized node type");
+  throw sg_exception("condition: unrecognized node type in comparison");
   return 0;
 }
 
@@ -236,7 +230,6 @@ SGComparisonCondition::SGComparisonCondition (Type type, bool reverse)
 
 SGComparisonCondition::~SGComparisonCondition ()
 {
-  delete _right_value;
 }
 
 bool
@@ -268,7 +261,6 @@ void
 SGComparisonCondition::setRightProperty( SGPropertyNode *prop_root,
                                          const char * propname )
 {
-  delete _right_value;
   _right_value = 0;
   _right_property = prop_root->getNode(propname, true);
 }
@@ -277,7 +269,6 @@ void
 SGComparisonCondition::setRightValue (const SGPropertyNode *node)
 {
   _right_property = 0;
-  delete _right_value;
   _right_value = new SGPropertyNode(*node);
 }
 
@@ -308,7 +299,7 @@ readNotCondition( SGPropertyNode *prop_root, const SGPropertyNode *node )
     if (condition != 0)
       return new SGNotCondition(condition);
   }
-  SG_LOG(SG_COCKPIT, SG_ALERT, "Panel: empty 'not' condition");
+  SG_LOG(SG_COCKPIT, SG_ALERT, "empty 'not' condition");
   return 0;
 }
 
@@ -350,8 +341,10 @@ readComparison( SGPropertyNode *prop_root,
   condition->setLeftProperty(prop_root, node->getStringValue("property[0]"));
   if (node->hasValue("property[1]"))
     condition->setRightProperty(prop_root, node->getStringValue("property[1]"));
-  else
+  else if (node->hasValue("value"))
     condition->setRightValue(node->getChild("value", 0));
+  else
+    throw sg_exception("condition: comparison without property[1] or value");
 
   return condition;
 }
@@ -402,13 +395,11 @@ SGConditional::SGConditional ()
 
 SGConditional::~SGConditional ()
 {
-  delete _condition;
 }
 
 void
 SGConditional::setCondition (SGCondition * condition)
 {
-  delete _condition;
   _condition = condition;
 }