- SGValue *v = node.getValue( tokens[1] );
- if ( v != NULL ) {
- SGValue::Type type = v->getType();
- if ( type == SGValue::UNKNOWN ) {
- v->setUnknownValue( tokens[2] );
- } else if ( type == SGValue::BOOL ) {
- if ( tokens[2] == "true" ) {
- v->setBoolValue( true );
- } else if ( tokens[2] == "false" ) {
- v->setBoolValue( false );
- } else {
- v->setBoolValue( atoi( tokens[2].c_str() ) );
- }
- } else if ( type == SGValue::INT ) {
- v->setIntValue( atoi( tokens[2].c_str() ) );
- } else if ( type == SGValue::FLOAT ) {
- v->setFloatValue( atof( tokens[2].c_str() ) );
- } else if ( type == SGValue::DOUBLE ) {
- v->setDoubleValue( atof( tokens[2].c_str() ) );
- } else if ( type == SGValue::STRING ) {
- v->setStringValue( tokens[2] );
- }
-
- // now fetch and write out the new value as confirmation
- // of the change
- string value = node.getStringValue ( tokens[1], "" );
- string tmp = tokens[1] + " = '" + value + "' (";
- tmp += getValueTypeString( node.getValue( tokens[1] ) );
- tmp += ")\n";
-
- io->writestring( tmp.c_str() );
- } else {
- string tmp = tokens[1] + " is unknown.\n";
-
- io->writestring( tmp.c_str() );
- }