notice_all_mons()
Process monsters more consistently.
This commit is contained in:
+8
-5
@@ -1728,22 +1728,25 @@ notice_all_mons(boolean reset)
|
|||||||
struct monst **arr = NULL;
|
struct monst **arr = NULL;
|
||||||
int j, i = 0, cnt = 0;
|
int j, i = 0, cnt = 0;
|
||||||
|
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||||
|
if (DEADMONSTER(mtmp))
|
||||||
|
continue;
|
||||||
if (canspotmon(mtmp))
|
if (canspotmon(mtmp))
|
||||||
cnt++;
|
cnt++;
|
||||||
else if (reset)
|
else if (reset)
|
||||||
mtmp->mspotted = FALSE;
|
mtmp->mspotted = FALSE;
|
||||||
|
}
|
||||||
if (!cnt)
|
if (!cnt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
arr = (struct monst **) alloc(cnt * sizeof(struct monst *));
|
arr = (struct monst **) alloc(cnt * sizeof (struct monst *));
|
||||||
|
|
||||||
|
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||||
|
if (DEADMONSTER(mtmp))
|
||||||
|
continue;
|
||||||
if (!canspotmon(mtmp))
|
if (!canspotmon(mtmp))
|
||||||
mtmp->mspotted = FALSE;
|
mtmp->mspotted = FALSE;
|
||||||
else if (!DEADMONSTER(mtmp) && i < cnt)
|
else if (i < cnt)
|
||||||
arr[i++] = mtmp;
|
arr[i++] = mtmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user