still more magic lamp

I was going about the use of tmp_at() from the wrong direction.
Instead of trying to replicate how a monster has been displayed, just pick
whatever is shown at its location and then redisplay that after it's gone.
This commit is contained in:
nethack.rankin
2005-04-30 06:11:55 +00:00
parent 50a9b78995
commit 4b00bd8662

View File

@@ -2047,28 +2047,21 @@ void
mongrantswish(monp)
struct monst **monp;
{
/* note: `mon' is still valid after mongone() (til next dmonsfree())
but it's no longer on the map--affects coordinates and visibility */
struct monst *mon = *monp;
int mx = mon->mx, my = mon->my;
boolean monspotted = canspotmon(mon),
/* no need to handle Warning since monster is peaceful */
disp_hackery = monspotted || Detect_monsters;
int mx = mon->mx, my = mon->my,
glyph = glyph_at(mx, my);
/* remove the monster first in case wish proves to be fatal
(blasted by artifact), to keep it out of resulting bones file */
mongone(mon);
*monp = 0; /* inform caller than monster is gone */
/* hide that removal from the player--map is visible during wish prompt */
if (disp_hackery) {
tmp_at(DISP_ALWAYS,
monspotted ? mon_to_glyph(mon) : detected_mon_to_glyph(mon));
tmp_at(mx, my);
}
*monp = 0; /* inform caller that monster is gone */
/* hide that removal from player--map is visible during wish prompt */
tmp_at(DISP_ALWAYS, glyph);
tmp_at(mx, my);
/* grant the wish */
makewish();
/* clean up */
if (disp_hackery) tmp_at(DISP_END, 0);
tmp_at(DISP_END, 0);
}
void