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.
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;
}