Fold invisible glyph unmapping into single function

This commit is contained in:
Pasi Kallinen
2017-10-07 16:24:49 +03:00
parent f8760093cc
commit 4b7aea0eac
8 changed files with 27 additions and 42 deletions

View File

@@ -408,11 +408,8 @@ register struct obj *obj;
map_invisible(rx, ry);
return res;
}
if (glyph_is_invisible(levl[rx][ry].glyph)) {
unmap_object(rx, ry);
newsym(rx, ry);
if (unmap_invisible(rx,ry))
pline_The("invisible monster must have moved.");
}
lev = &levl[rx][ry];
switch (lev->typ) {
@@ -631,10 +628,7 @@ struct obj *obj;
if (!(mtmp = m_at(cc.x, cc.y))) {
There("is no creature there.");
if (glyph_is_invisible(levl[cc.x][cc.y].glyph)) {
unmap_object(cc.x, cc.y);
newsym(cc.x, cc.y);
}
(void) unmap_invisible(cc.x, cc.y);
return 1;
}
@@ -3030,11 +3024,7 @@ struct obj *obj;
}
} else {
/* no monster here and no statue seen or remembered here */
if (glyph_is_invisible(glyph)) {
/* now you know that nothing is there... */
unmap_object(bhitpos.x, bhitpos.y);
newsym(bhitpos.x, bhitpos.y);
}
(void) unmap_invisible(bhitpos.x, bhitpos.y);
You("miss; there is no one there to hit.");
}
u_wipe_engr(2); /* same as for melee or throwing */