]> granicus.if.org Git - nethack/commitdiff
Fix bz175: Pile mark is shown when potion is destroyed
authorPasi Kallinen <paxed@alt.org>
Sun, 10 Jan 2016 16:27:34 +0000 (18:27 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 10 Jan 2016 16:33:41 +0000 (18:33 +0200)
Original bug report:

> When killing something that's carrying a potion, or death-drops a potion,
> or stands on top of a potion, with a force bolt or a wand of striking,
> "you hear something shatter" or "a potion of foo shatters" but the corpse
> is inverse as if it's (still) a pile.

Unfortunately the newsym() checks for already existing glyph, and
the gbuf doesn't distinguish between object piles and single items,
so newsym doesn't mark the location for update.

This is a dirty hack to force the newsym to update the glyph.
The glyph buffering should be revisited in a future version.

include/extern.h
src/display.c
src/zap.c

index 70ce04b3113adf8a51d6692df5ac6efd7f5c1132..f45ca4b303a90d3f18c4f5c53a9333a00e1742ae 100644 (file)
@@ -310,6 +310,7 @@ E void FDECL(map_location, (int, int, int));
 E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P));
 E void FDECL(feel_location, (XCHAR_P, XCHAR_P));
 E void FDECL(newsym, (int, int));
+E void FDECL(newsym_force, (int, int));
 E void FDECL(shieldeff, (XCHAR_P, XCHAR_P));
 E void FDECL(tmp_at, (int, int));
 E void FDECL(swallowed, (int));
index 333ed4d5b36a0bb48ba93a42a1b083bb4f4836c8..09fd943eb410a8627fbd3b79a15506b9883f1de7 100644 (file)
@@ -1318,6 +1318,21 @@ static gbuf_entry gbuf[ROWNO][COLNO];
 static char gbuf_start[ROWNO];
 static char gbuf_stop[ROWNO];
 
+/* FIXME: This is a dirty hack, because newsym() doesn't distinguish
+ * between object piles and single objects, it doesn't mark the location
+ * for update. */
+void
+newsym_force(x, y)
+register int x, y;
+{
+    newsym(x,y);
+    gbuf[y][x].new = 1;
+    if (gbuf_start[y] > x)
+        gbuf_start[y] = x;
+    if (gbuf_stop[y] < x)
+        gbuf_stop[y] = x;
+}
+
 /*
  * Store the glyph in the 3rd screen for later flushing.
  */
index 6a695fbacefdae78d6fffa756a6109655929947b..4f3dc57072954a120775d0e5dec9a44ba37e5d1e 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1875,10 +1875,14 @@ struct obj *obj, *otmp;
                         You_hear("a crumbling sound.");
                 }
             } else {
+                int oox = obj->ox;
+                int ooy = obj->oy;
                 if (context.mon_moving
                         ? !breaks(obj, obj->ox, obj->oy)
                         : !hero_breaks(obj, obj->ox, obj->oy, FALSE))
                     maybelearnit = FALSE; /* nothing broke */
+                else
+                    newsym_force(oox,ooy);
                 res = 0;
             }
             if (maybelearnit)