]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/prop_picker.cxx
Patch from Melchior Franz:
[flightgear.git] / src / GUI / prop_picker.cxx
index e38342fd74aaca393949777a0da3996d5c728d89..59674c36d6a0175ebcaf112845df159b6e42fd55 100755 (executable)
@@ -470,20 +470,18 @@ void fgPropPicker::find_props ()
   for (i = 0; i < (int)node->nChildren(); i++) {
            SGPropertyNode * child = node->getChild(i);
            name = child->getName();
+           if ( node->getChild(name, 1) != 0 ) {
+               iindex = child->getIndex();
+               sprintf(sindex, "[%d]", iindex);
+               name += sindex;
+           }
            line = name;
            names[ pi ] = new char[ strlen(line.c_str())+2 ] ;
            strcpy ( names [ pi ], line.c_str() ) ;
            if ( child->nChildren() > 0 ) {
-                iindex = child->getIndex();
-               sprintf(sindex, "%d", iindex);
                dflag[ pi ] = 1 ;
                 files[ pi ] = new char[ strlen(line.c_str())+strlen(sindex)+4 ] ;
                strcpy ( files [ pi ], line.c_str() ) ;
-               if ( node->getChild(name, 1) != 0 ) {
-                   strcat ( files [ pi ], "[" ) ;
-                    strcat ( files [ pi ], sindex ) ;
-                   strcat ( files [ pi ], "]" ) ;
-               }
                strcat ( files [ pi ], "/" ) ;
                values[ pi ] = new char[ 2 ] ;
            } else {