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:
+4
-5
@@ -671,12 +671,11 @@ const char *name;
|
|||||||
Strcat(buf, "-");
|
Strcat(buf, "-");
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
|
|
||||||
if ((bp = g.level.bonesinfo)) {
|
for (bp = g.level.bonesinfo; bp; bp = bp->next) {
|
||||||
do {
|
if (!strncmp(bp->who, buf, len))
|
||||||
if (!strncmp(bp->who, buf, len))
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
} while ((bp = bp->next) != (struct cemetery *) 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user