]> git.mxchange.org Git - simgear.git/commitdiff
let readProperties() refuse to overwrite write-proteced properties
authormfranz <mfranz>
Wed, 9 Jul 2008 16:17:52 +0000 (16:17 +0000)
committermfranz <mfranz>
Wed, 9 Jul 2008 16:17:52 +0000 (16:17 +0000)
simgear/props/props_io.cxx

index d661223784a1b19ca2d217f0787ebdb1e70d1f18..88d4c3704ce779a9506319668764a9e190643ec5 100644 (file)
@@ -103,6 +103,7 @@ private:
   int _default_mode;
   string _data;
   SGPropertyNode * _root;
+  SGPropertyNode null;
   int _level;
   vector<State> _state_stack;
   string _base;
@@ -189,6 +190,11 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
 
                                // Got the index, so grab the node.
     SGPropertyNode * node = st.node->getChild(name, index, true);
+    if (!node->getAttribute(SGPropertyNode::WRITE)) {
+      SG_LOG(SG_INPUT, SG_ALERT, "Not overwriting write-protected property "
+          << node->getPath());
+      node = &null;
+    }
 
                                // Get the access-mode attributes,
                                // but don't set yet (in case they