]> granicus.if.org Git - nethack/commitdiff
still more magic lamp
authornethack.rankin <nethack.rankin>
Sat, 30 Apr 2005 06:11:55 +0000 (06:11 +0000)
committernethack.rankin <nethack.rankin>
Sat, 30 Apr 2005 06:11:55 +0000 (06:11 +0000)
     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.

src/potion.c

index 35552a837f5f307d55c63d9a4b97a6ded1591e37..f71035b5cad00736a257bd756d3c6dddf750a3b0 100644 (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