From 854fe40609daefc0709ef22c4c509825088eb15b Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 10 Jan 2016 18:27:34 +0200 Subject: [PATCH] Fix bz175: Pile mark is shown when potion is destroyed 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 | 1 + src/display.c | 15 +++++++++++++++ src/zap.c | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/include/extern.h b/include/extern.h index 70ce04b31..f45ca4b30 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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)); diff --git a/src/display.c b/src/display.c index 333ed4d5b..09fd943eb 100644 --- a/src/display.c +++ b/src/display.c @@ -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. */ diff --git a/src/zap.c b/src/zap.c index 6a695fbac..4f3dc5707 100644 --- 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) -- 2.40.0