fix hider bug

From a bug report, this turned out to be caused by a fix
I implemented for #H1749 three and a half years ago.  Kicking a hidden
monster's location would bring the monster out of hiding but lacked a
newsym(), so if there was 'I' displayed there it stayed displayed as 'I'
even while subsequent messages referred to the unhidden monster.

     No fixes entry.
This commit is contained in:
nethack.rankin
2012-05-06 02:29:33 +00:00
parent 669c2ab560
commit b1dbd463c5
+29 -15
View File
@@ -160,10 +160,12 @@ xchar x, y;
hidden doesn't affect chance to hit so neither does this reveal) */ hidden doesn't affect chance to hit so neither does this reveal) */
if (mon->mundetected || if (mon->mundetected ||
(mon->m_ap_type && mon->m_ap_type != M_AP_MONSTER)) { (mon->m_ap_type && mon->m_ap_type != M_AP_MONSTER)) {
/* [revealing the monster should probably give a message...] */
if (mon->m_ap_type) seemimic(mon); if (mon->m_ap_type) seemimic(mon);
mon->mundetected = 0; mon->mundetected = 0;
if (!canspotmon(mon)) map_invisible(x, y); if (!canspotmon(mon)) map_invisible(x, y);
else newsym(x, y);
There("is %s here.",
canspotmon(mon) ? a_monnam(mon) : "something hidden");
} }
/* Kick attacks by kicking monsters are normal attacks, not special. /* Kick attacks by kicking monsters are normal attacks, not special.
@@ -702,7 +704,7 @@ dokick()
{ {
int x, y; int x, y;
int avrg_attrib; int avrg_attrib;
int dmg = 0; int dmg = 0, glyph, oldglyph = -1;
register struct monst *mtmp; register struct monst *mtmp;
boolean no_kick = FALSE; boolean no_kick = FALSE;
char buf[BUFSZ]; char buf[BUFSZ];
@@ -816,8 +818,11 @@ dokick()
if it is peaceful and player declines to attack, or if the if it is peaceful and player declines to attack, or if the
hero passes out due to enbumbrance with low hp; context.move hero passes out due to enbumbrance with low hp; context.move
will be 1 unless player declines to kick peaceful monster */ will be 1 unless player declines to kick peaceful monster */
if (mtmp && !maybe_kick_monster(mtmp, x, y)) if (mtmp) {
return context.move; oldglyph = glyph_at(x, y);
if (!maybe_kick_monster(mtmp, x, y))
return context.move;
}
wake_nearby(); wake_nearby();
u_wipe_engr(2); u_wipe_engr(2);
@@ -846,21 +851,30 @@ dokick()
struct permonst *mdat = mtmp->data; struct permonst *mdat = mtmp->data;
kick_monster(mtmp, x, y); kick_monster(mtmp, x, y);
glyph = glyph_at(x, y);
/* see comment in attack_checks() */ /* see comment in attack_checks() */
if (!DEADMONSTER(mtmp) && if (mtmp->mhp <= 0) { /* DEADMONSTER() */
!canspotmon(mtmp) && /* if we mapped an invisible monster and immediately
/* check x and y; a monster that evades your kick by killed it, we don't want to forget what we thought
jumping to an unseen square doesn't leave an I behind */ was there before the kick */
mtmp->mx == x && mtmp->my == y && if (glyph != oldglyph && glyph_is_invisible(glyph))
!glyph_is_invisible(levl[x][y].glyph) && show_glyph(x, y, oldglyph);
!(u.uswallow && mtmp == u.ustuck)) } else if (!canspotmon(mtmp) &&
map_invisible(x, y); /* check <x,y>; monster that evades kick by jumping
if((Is_airlevel(&u.uz) || Levitation) && context.move) { to an unseen square doesn't leave an I behind */
mtmp->mx == x && mtmp->my == y &&
!glyph_is_invisible(glyph) &&
!(u.uswallow && mtmp == u.ustuck)) {
map_invisible(x, y);
}
/* recoil if floating */
if ((Is_airlevel(&u.uz) || Levitation) && context.move) {
int range; int range;
range = ((int)youmonst.data->cwt + (weight_cap() + inv_weight())); range = ((int)youmonst.data->cwt
+ (weight_cap() + inv_weight()));
if (range < 1) range = 1; /* divide by zero avoidance */ if (range < 1) range = 1; /* divide by zero avoidance */
range = (3*(int)mdat->cwt) / range; range = (3 * (int)mdat->cwt) / range;
if(range < 1) range = 1; if(range < 1) range = 1;
hurtle(-u.dx, -u.dy, range, TRUE); hurtle(-u.dx, -u.dy, range, TRUE);