Small code cleanup

This commit is contained in:
Pasi Kallinen
2016-01-10 14:47:06 +02:00
parent 65d780dc3d
commit c6bf49f647
+14 -25
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,31 +119,19 @@ 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, boulders and rocks
* TODO: skip worm tails */
*/ wantedloc = (do_mons && glyph_is_monster(glyph)
if (glyph_is_monster(glyph)) { || !do_mons && glyph_is_object(glyph));
if (!pass) { if (!wantedloc) continue;
++*cnt_p; if (!pass) {
} else { ++*cnt_p;
(*arr_p)[idx].x = x; } else {
(*arr_p)[idx].y = y; (*arr_p)[idx].x = x;
++idx; (*arr_p)[idx].y = y;
} ++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 */