From 0ba90f4d2bc707584c190366d894ef6c565408dd Mon Sep 17 00:00:00 2001 From: david Date: Sat, 7 Sep 2002 12:35:31 +0000 Subject: [PATCH] Patch from Julian Foad: Use getDisplayName instead of duplicated code: gives a better decision on whether to display the index. Replace unnecessary node lookups by name with direct access: tidier and more efficient. E.g. "getValueTypeString (node->getNode(name.c_str()))" -> "getValueTypeString (child)". --- src/Network/props.cxx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Network/props.cxx b/src/Network/props.cxx index 8752da41b..8dd3331ef 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -203,15 +203,7 @@ PropsChannel::foundTerminator() for (int i = 0; i < dir->nChildren(); i++) { SGPropertyNode * child = dir->getChild(i); - string name = child->getName(); - string line = name; - - if (dir->getChild( name.c_str(), 1 )) - { - char buf[16]; - sprintf(buf, "[%d]", child->getIndex()); - line += buf; - } + string line = child->getDisplayName(true); if ( child->nChildren() > 0 ) { @@ -221,10 +213,9 @@ PropsChannel::foundTerminator() { if (mode == PROMPT) { - string value = dir->getStringValue( name.c_str(), "" ); + string value = child->getStringValue(); line += " =\t'" + value + "'\t("; - line += getValueTypeString( - dir->getNode( name.c_str() ) ); + line += getValueTypeString( child ); line += ")"; } } -- 2.39.5