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.
This commit is contained in:
Pasi Kallinen
2016-01-10 18:27:34 +02:00
parent a8172e1208
commit 854fe40609
3 changed files with 20 additions and 0 deletions

View 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));

View 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.
*/

View File

@@ -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)