Fold invisible glyph unmapping into single function
This commit is contained in:
@@ -321,6 +321,7 @@ E void FDECL(map_background, (XCHAR_P, XCHAR_P, int));
|
|||||||
E void FDECL(map_trap, (struct trap *, int));
|
E void FDECL(map_trap, (struct trap *, int));
|
||||||
E void FDECL(map_object, (struct obj *, int));
|
E void FDECL(map_object, (struct obj *, int));
|
||||||
E void FDECL(map_invisible, (XCHAR_P, XCHAR_P));
|
E void FDECL(map_invisible, (XCHAR_P, XCHAR_P));
|
||||||
|
E boolean FDECL(unmap_invisible, (int, int));
|
||||||
E void FDECL(unmap_object, (int, int));
|
E void FDECL(unmap_object, (int, int));
|
||||||
E void FDECL(map_location, (int, int, int));
|
E void FDECL(map_location, (int, int, int));
|
||||||
E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P));
|
E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P));
|
||||||
|
|||||||
+3
-13
@@ -408,11 +408,8 @@ register struct obj *obj;
|
|||||||
map_invisible(rx, ry);
|
map_invisible(rx, ry);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (glyph_is_invisible(levl[rx][ry].glyph)) {
|
if (unmap_invisible(rx,ry))
|
||||||
unmap_object(rx, ry);
|
|
||||||
newsym(rx, ry);
|
|
||||||
pline_The("invisible monster must have moved.");
|
pline_The("invisible monster must have moved.");
|
||||||
}
|
|
||||||
|
|
||||||
lev = &levl[rx][ry];
|
lev = &levl[rx][ry];
|
||||||
switch (lev->typ) {
|
switch (lev->typ) {
|
||||||
@@ -631,10 +628,7 @@ struct obj *obj;
|
|||||||
|
|
||||||
if (!(mtmp = m_at(cc.x, cc.y))) {
|
if (!(mtmp = m_at(cc.x, cc.y))) {
|
||||||
There("is no creature there.");
|
There("is no creature there.");
|
||||||
if (glyph_is_invisible(levl[cc.x][cc.y].glyph)) {
|
(void) unmap_invisible(cc.x, cc.y);
|
||||||
unmap_object(cc.x, cc.y);
|
|
||||||
newsym(cc.x, cc.y);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3030,11 +3024,7 @@ struct obj *obj;
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* no monster here and no statue seen or remembered here */
|
/* no monster here and no statue seen or remembered here */
|
||||||
if (glyph_is_invisible(glyph)) {
|
(void) unmap_invisible(bhitpos.x, bhitpos.y);
|
||||||
/* now you know that nothing is there... */
|
|
||||||
unmap_object(bhitpos.x, bhitpos.y);
|
|
||||||
newsym(bhitpos.x, bhitpos.y);
|
|
||||||
}
|
|
||||||
You("miss; there is no one there to hit.");
|
You("miss; there is no one there to hit.");
|
||||||
}
|
}
|
||||||
u_wipe_engr(2); /* same as for melee or throwing */
|
u_wipe_engr(2); /* same as for melee or throwing */
|
||||||
|
|||||||
+3
-8
@@ -1394,9 +1394,7 @@ genericptr_t num;
|
|||||||
}
|
}
|
||||||
if (!canspotmon(mtmp) && !glyph_is_invisible(levl[zx][zy].glyph))
|
if (!canspotmon(mtmp) && !glyph_is_invisible(levl[zx][zy].glyph))
|
||||||
map_invisible(zx, zy);
|
map_invisible(zx, zy);
|
||||||
} else if (glyph_is_invisible(levl[zx][zy].glyph)) {
|
} else if (unmap_invisible(zx, zy)) {
|
||||||
unmap_object(zx, zy);
|
|
||||||
newsym(zx, zy);
|
|
||||||
(*(int *) num)++;
|
(*(int *) num)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1646,11 +1644,8 @@ register int aflag; /* intrinsic autosearch vs explicit searching */
|
|||||||
/* see if an invisible monster has moved--if Blind,
|
/* see if an invisible monster has moved--if Blind,
|
||||||
* feel_location() already did it
|
* feel_location() already did it
|
||||||
*/
|
*/
|
||||||
if (!aflag && !mtmp && !Blind
|
if (!aflag && !mtmp && !Blind)
|
||||||
&& glyph_is_invisible(levl[x][y].glyph)) {
|
(void) unmap_invisible(x, y);
|
||||||
unmap_object(x, y);
|
|
||||||
newsym(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((trap = t_at(x, y)) && !trap->tseen && !rnl(8)) {
|
if ((trap = t_at(x, y)) && !trap->tseen && !rnl(8)) {
|
||||||
nomul(0);
|
nomul(0);
|
||||||
|
|||||||
@@ -277,6 +277,19 @@ register xchar x, y;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
unmap_invisible(x, y)
|
||||||
|
int x, y;
|
||||||
|
{
|
||||||
|
if (isok(x,y) && glyph_is_invisible(levl[x][y].glyph)) {
|
||||||
|
unmap_object(x, y);
|
||||||
|
newsym(x, y);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unmap_object()
|
* unmap_object()
|
||||||
*
|
*
|
||||||
|
|||||||
+2
-8
@@ -262,10 +262,7 @@ doit:
|
|||||||
} else {
|
} else {
|
||||||
maybe_mnexto(mon);
|
maybe_mnexto(mon);
|
||||||
if (mon->mx != x || mon->my != y) {
|
if (mon->mx != x || mon->my != y) {
|
||||||
if (glyph_is_invisible(levl[x][y].glyph)) {
|
(void) unmap_invisible(x, y);
|
||||||
unmap_object(x, y);
|
|
||||||
newsym(x, y);
|
|
||||||
}
|
|
||||||
pline("%s %s, %s evading your %skick.", Monnam(mon),
|
pline("%s %s, %s evading your %skick.", Monnam(mon),
|
||||||
(!level.flags.noteleport && can_teleport(mon->data))
|
(!level.flags.noteleport && can_teleport(mon->data))
|
||||||
? "teleports"
|
? "teleports"
|
||||||
@@ -946,10 +943,7 @@ dokick()
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (glyph_is_invisible(levl[x][y].glyph)) {
|
(void) unmap_invisible(x, y);
|
||||||
unmap_object(x, y);
|
|
||||||
newsym(x, y);
|
|
||||||
}
|
|
||||||
if (is_pool(x, y) ^ !!u.uinwater) {
|
if (is_pool(x, y) ^ !!u.uinwater) {
|
||||||
/* objects normally can't be removed from water by kicking */
|
/* objects normally can't be removed from water by kicking */
|
||||||
You("splash some %s around.", hliquid("water"));
|
You("splash some %s around.", hliquid("water"));
|
||||||
|
|||||||
+2
-5
@@ -219,11 +219,8 @@ int expltype;
|
|||||||
}
|
}
|
||||||
if (mtmp && cansee(i + x - 1, j + y - 1) && !canspotmon(mtmp))
|
if (mtmp && cansee(i + x - 1, j + y - 1) && !canspotmon(mtmp))
|
||||||
map_invisible(i + x - 1, j + y - 1);
|
map_invisible(i + x - 1, j + y - 1);
|
||||||
else if (!mtmp && glyph_is_invisible(
|
else if (!mtmp)
|
||||||
levl[i + x - 1][j + y - 1].glyph)) {
|
(void) unmap_invisible(i + x - 1, j + y - 1);
|
||||||
unmap_object(i + x - 1, j + y - 1);
|
|
||||||
newsym(i + x - 1, j + y - 1);
|
|
||||||
}
|
|
||||||
if (cansee(i + x - 1, j + y - 1))
|
if (cansee(i + x - 1, j + y - 1))
|
||||||
visible = TRUE;
|
visible = TRUE;
|
||||||
if (explmask[i][j] == 1)
|
if (explmask[i][j] == 1)
|
||||||
|
|||||||
+1
-4
@@ -1635,10 +1635,7 @@ domove()
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (glyph_is_invisible(levl[x][y].glyph)) {
|
(void) unmap_invisible(x, y);
|
||||||
unmap_object(x, y);
|
|
||||||
newsym(x, y);
|
|
||||||
}
|
|
||||||
/* not attacking an animal, so we try to move */
|
/* not attacking an animal, so we try to move */
|
||||||
if ((u.dx || u.dy) && u.usteed && stucksteed(FALSE)) {
|
if ((u.dx || u.dy) && u.usteed && stucksteed(FALSE)) {
|
||||||
nomul(0);
|
nomul(0);
|
||||||
|
|||||||
@@ -3958,10 +3958,8 @@ boolean say; /* Announce out of sight hit/miss events if true */
|
|||||||
/* reveal/unreveal invisible monsters before tmp_at() */
|
/* reveal/unreveal invisible monsters before tmp_at() */
|
||||||
if (mon && !canspotmon(mon))
|
if (mon && !canspotmon(mon))
|
||||||
map_invisible(sx, sy);
|
map_invisible(sx, sy);
|
||||||
else if (!mon && glyph_is_invisible(levl[sx][sy].glyph)) {
|
else if (!mon)
|
||||||
unmap_object(sx, sy);
|
(void) unmap_invisible(sx, sy);
|
||||||
newsym(sx, sy);
|
|
||||||
}
|
|
||||||
if (ZAP_POS(levl[sx][sy].typ)
|
if (ZAP_POS(levl[sx][sy].typ)
|
||||||
|| (isok(lsx, lsy) && cansee(lsx, lsy)))
|
|| (isok(lsx, lsy) && cansee(lsx, lsy)))
|
||||||
tmp_at(sx, sy);
|
tmp_at(sx, sy);
|
||||||
|
|||||||
Reference in New Issue
Block a user