]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/props.cxx
fix another crash on exit by finally converting the rest of unguarded
[flightgear.git] / src / Network / props.cxx
index da99da9c9c058e329261aa4ebf736c31dd4f42d1..af23f44b399d294806c617488314976c4db5afeb 100644 (file)
@@ -4,7 +4,7 @@
 // Written by Curtis Olson, started September 2000.
 // Modified by Bernie Bright, May 2002.
 //
-// Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2000  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -18,7 +18,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -34,7 +34,7 @@
 #include <simgear/props/props.hxx>
 #include <simgear/props/props_io.hxx>
 
-#include STL_STRSTREAM
+#include <sstream>
 
 #include <Main/globals.hxx>
 #include <Main/viewmgr.hxx>
 
 #include "props.hxx"
 
-#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
-SG_USING_STD(strstream);
+SG_USING_STD(stringstream);
 SG_USING_STD(ends);
-#endif
 
 /**
  * Props connection class.
@@ -213,18 +211,18 @@ PropsChannel::foundTerminator()
                push( line.c_str() );
            }
        } else if ( command == "dump" ) {
-           strstream buf;
+           stringstream buf;
            if ( tokens.size() <= 1 ) {
                writeProperties( buf, node );
                buf << ends; // null terminate the string
-               push( buf.str() );
+               push( buf.str().c_str() );
                push( getTerminator() );
            } else {
                SGPropertyNode *child = node->getNode( tokens[1].c_str() );
                if ( child ) {
                    writeProperties ( buf, child );
                    buf << ends; // null terminate the string
-                   push( buf.str() );
+                   push( buf.str().c_str() );
                    push( getTerminator() );
                } else {
                    node_not_found_error( tokens[1] );
@@ -332,6 +330,14 @@ PropsChannel::foundTerminator()
                             = args.getNode("subsystem", i-2, true);
                         node->setStringValue( tokens[i].c_str() );
                     }
+                } else if ( tokens[1] == "set-sea-level-air-temp-degc" ) {
+                    for ( unsigned int i = 2; i < tokens.size(); ++i ) {
+                        cout << "props: set-sl command = " << tokens[i]
+                             << endl;
+                        SGPropertyNode *node
+                            = args.getNode("temp-degc", i-2, true);
+                        node->setStringValue( tokens[i].c_str() );
+                    }
                 } else if ( tokens[1] == "set-outside-air-temp-degc" ) {
                     for ( unsigned int i = 2; i < tokens.size(); ++i ) {
                         cout << "props: set-oat command = " << tokens[i]
@@ -348,6 +354,16 @@ PropsChannel::foundTerminator()
                             = args.getNode("timeofday", i-2, true);
                         node->setStringValue( tokens[i].c_str() );
                     }
+                } else if ( tokens[1] == "play-audio-message" ) {
+                    if ( tokens.size() == 4 ) {
+                        cout << "props: play audio message = " << tokens[2]
+                             << " " << tokens[3] << endl;
+                        SGPropertyNode *node;
+                        node = args.getNode("path", 0, true);
+                        node->setStringValue( tokens[2].c_str() );
+                        node = args.getNode("file", 0, true);
+                        node->setStringValue( tokens[3].c_str() );
+                   }
                 }
                 if ( !globals->get_commands()
                          ->execute(tokens[1].c_str(), &args) )
@@ -478,6 +494,7 @@ FGProps::open()
 bool
 FGProps::close()
 {
+    SG_LOG( SG_IO, SG_INFO, "closing FGProps" );   
     return true;
 }