Refactor bones search loop

Using a for loop instead of an if and a do/while makes the code much
more clear and concise, so that it's easier to understand what the
function does at a glance.  The actual approach to iterating through the
current level's bones files and searching for a match is more or less
unchanged.
This commit is contained in:
Michael Meyer
2020-12-30 22:42:48 -05:00
parent 47884d63ac
commit 6ae7818346

View File

@@ -671,12 +671,11 @@ const char *name;
Strcat(buf, "-");
len = strlen(buf);
if ((bp = g.level.bonesinfo)) {
do {
if (!strncmp(bp->who, buf, len))
return TRUE;
} while ((bp = bp->next) != (struct cemetery *) 0);
for (bp = g.level.bonesinfo; bp; bp = bp->next) {
if (!strncmp(bp->who, buf, len))
return TRUE;
}
return FALSE;
}