From: david Date: Thu, 9 May 2002 21:57:07 +0000 (+0000) Subject: Patch from Melchior Franz: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c37d2019e083cd6b94a4a183b4c5636bc6aacad6;p=flightgear.git Patch from Melchior Franz: - don't send "set" confirmation when in data mode. If an external program really cares if the settings were accepted, which is rather unlikely, it simply has to "get" the property again. The returned line would have been a pain to parse, anyway (something like "from-model = 'true' (bool)"). - do not only "set" the first token, but concatenate all given tokens with a space in between. This won't be used much, but makes sense for setting strings, while it does no harm when setting numbers. Silently ignoring all but the first token is impolite. ;-) - remove old, commented out debug message that doesn't make much sense any more. --- diff --git a/src/Network/props.cxx b/src/Network/props.cxx index b54ac4d29..3692a5cfe 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -215,9 +215,6 @@ bool FGProps::process_command( const char *cmd ) { string tmp; string value = node->getStringValue ( tokens[1].c_str(), "" ); if ( mode == PROMPT ) { - //string ttt = "debug = '" + tokens[1] + "'\n"; - //io->writestring( ttt.c_str() ); - tmp = tokens[1] + " = '" + value + "' ("; tmp += getValueTypeString( node->getNode( tokens[1].c_str() ) ); tmp += ")\n"; @@ -230,16 +227,22 @@ bool FGProps::process_command( const char *cmd ) { if ( tokens.size() <= 2 ) { // do nothing } else { - node->getNode( tokens[1].c_str(), true )->setStringValue(tokens[2].c_str()); + string tmp = tokens[2]; + for ( unsigned int i = 3; i < tokens.size() - 1; i++ ) { + tmp += " " + tokens[i]; + } + node->getNode( tokens[1].c_str(), true )->setStringValue(tmp.c_str()); - // 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 + "' ("; - tmp += getValueTypeString( node->getNode( tokens[1].c_str() ) ); - tmp += ")\n"; - - io->writestring( tmp.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 + "' ("; + tmp += getValueTypeString( node->getNode( tokens[1].c_str() ) ); + tmp += ")\n"; + + io->writestring( tmp.c_str() ); + } } } else if ( command == "quit" ) { close();