fgFindAircraftPath(): put the MAX_DEPTH check at a place where it makes sense
This commit is contained in:
parent
3cb5b0159d
commit
1eb5de245b
1 changed files with 14 additions and 10 deletions
|
@ -517,18 +517,22 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft, in
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
while ((dire = ulReadDir(dirp)) != NULL) {
|
while ((dire = ulReadDir(dirp)) != NULL) {
|
||||||
if (dire->d_isdir && depth < MAXDEPTH) {
|
if (dire->d_isdir) {
|
||||||
if ( strcmp("CVS", dire->d_name) && strcmp(".", dire->d_name)
|
if (depth > MAXDEPTH)
|
||||||
&& strcmp("..", dire->d_name) && strcmp("AI", dire->d_name))
|
continue;
|
||||||
{
|
|
||||||
SGPath next = path;
|
|
||||||
next.append(dire->d_name);
|
|
||||||
|
|
||||||
result = fgFindAircraftPath( next, aircraft, depth + 1 );
|
if (!strcmp("CVS", dire->d_name) || !strcmp(".", dire->d_name)
|
||||||
if ( ! result.empty() ) {
|
|| !strcmp("..", dire->d_name) || !strcmp("AI", dire->d_name))
|
||||||
break;
|
continue;
|
||||||
}
|
|
||||||
|
SGPath next = path;
|
||||||
|
next.append(dire->d_name);
|
||||||
|
|
||||||
|
result = fgFindAircraftPath( next, aircraft, depth + 1 );
|
||||||
|
if ( ! result.empty() ) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( !strcmp(dire->d_name, aircraft.c_str()) ) {
|
} else if ( !strcmp(dire->d_name, aircraft.c_str()) ) {
|
||||||
result = path.str();
|
result = path.str();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue