Small code cleanup

This commit is contained in:
Pasi Kallinen
2016-01-10 14:47:06 +02:00
parent 65d780dc3d
commit c6bf49f647
+5 -16
View File
@@ -103,6 +103,7 @@ int *cnt_p;
boolean do_mons; boolean do_mons;
{ {
int x, y, pass, glyph, idx; int x, y, pass, glyph, idx;
boolean wantedloc;
*cnt_p = idx = 0; *cnt_p = idx = 0;
for (pass = 0; pass < 2; pass++) { for (pass = 0; pass < 2; pass++) {
@@ -118,12 +119,13 @@ boolean do_mons;
for (x = 1; x < COLNO; x++) for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
glyph = glyph_at(x, y); glyph = glyph_at(x, y);
if (do_mons) {
/* unlike '/M', this skips monsters revealed by /* unlike '/M', this skips monsters revealed by
* warning glyphs and remembered invisible ones; * warning glyphs and remembered invisible ones;
* TODO: skip worm tails * TODO: skip worm tails, boulders and rocks
*/ */
if (glyph_is_monster(glyph)) { wantedloc = (do_mons && glyph_is_monster(glyph)
|| !do_mons && glyph_is_object(glyph));
if (!wantedloc) continue;
if (!pass) { if (!pass) {
++*cnt_p; ++*cnt_p;
} else { } else {
@@ -132,19 +134,6 @@ boolean do_mons;
++idx; ++idx;
} }
} }
} else { /* objects */
/* TODO: skip boulders and rocks */
if (glyph_is_object(glyph)) {
if (!pass) {
++*cnt_p;
} else {
(*arr_p)[idx].x = x;
(*arr_p)[idx].y = y;
++idx;
}
}
}
}
} /* pass */ } /* pass */
if (*cnt_p) if (*cnt_p)
qsort(*arr_p, *cnt_p, sizeof (coord), cmp_coord_distu); qsort(*arr_p, *cnt_p, sizeof (coord), cmp_coord_distu);