]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/props.cxx
Moved some of the low level scene graph construction code over to simgear.
[flightgear.git] / src / Network / props.cxx
index 253aac701c636b843c914f18153bb3d633217450..51b293177a83f5fafa938f6081715f28e208a1f6 100644 (file)
@@ -31,8 +31,8 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/commands.hxx>
 #include <simgear/misc/strutils.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
 
 #include STL_STRSTREAM
 
@@ -311,22 +311,29 @@ PropsChannel::foundTerminator()
        }
        else if ( command == "set" )
        {
-           if ( tokens.size() == 3 )
-           {
-               node->getNode( tokens[1].c_str(), true )->setStringValue(tokens[2].c_str());
+           if ( tokens.size() >= 2 )
+            {
+                string value, tmp;
+                if ( tokens.size() == 3 ) {
+                    value = tokens[2];
+                } else {
+                    value = "";
+                }
+                node->getNode( tokens[1].c_str(), true )
+                    ->setStringValue(value.c_str());
 
                if ( mode == PROMPT )
                {
                    // now fetch and write out the new value as confirmation
                    // of the change
-                   string value = node->getStringValue ( tokens[1].c_str(), "" );
-                   string tmp = tokens[1] + " = '" + value + "' (";
+                   value = node->getStringValue ( tokens[1].c_str(), "" );
+                   tmp = tokens[1] + " = '" + value + "' (";
                    tmp += getValueTypeString( node->getNode( tokens[1].c_str() ) );
                    tmp += ")";
                    push( tmp.c_str() );
                    push( getTerminator() );
                }
-           }
+           } 
        }
        else if ( command == "run" )
        {