Skip to content

Commit

Permalink
Match ObjectDir::HasSubDir (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBetson authored Aug 23, 2024
1 parent c99cf6a commit 0ddcd74
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/system/obj/Dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,23 @@ void ObjectDir::SetSubDir(bool b){
bool ObjectDir::HasSubDir(ObjectDir* dir){
ObjectDir* subdir;
int i = 0;
do {
subdir = NextSubDir(i);
if(!subdir) return false;
} while(subdir != dir);
return true;
int j = 0;

while(1) {
j = i;
i = j + 1;

subdir = NextSubDir(j);
if(subdir) {
if (subdir == dir) {
return true;
}
} else {
break;
}
}

return false;
}

bool ObjectDir::SaveSubdirs(){
Expand Down

0 comments on commit 0ddcd74

Please sign in to comment.