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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user