fix github pull request #161 - scatter()

Fixes #161

Report states that scattering objects might leave a 'pile' glyph when
no longer appropriate.  I didn't try to reproduce that, just took it
on faith.  The fix tried to be too efficient and might have missed
fixing the display if breaks() or ohitmon() destroyed the objects
being scattered and left 'total' at 0.
This commit is contained in:
PatR
2018-11-24 15:22:33 -08:00
parent bb08a46480
commit e5c488b15e
2 changed files with 7 additions and 2 deletions

View File

@@ -221,6 +221,7 @@ end of game while carrying Schroedinger's Box would reveal cat-or-corpse
attempting to untrap an adjacent trap while on the edge of--not in--a pit
failed due to not being able to reach the floor
magic trap's deafening roar effect wasn't waking nearby monsters
scattering of objects might leave source location with wrong thing displayed
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1522454717 2018/03/31 00:05:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.56 $ */
/* NetHack 3.6 explode.c $NHDT-Date: 1543101719 2018/11/24 23:21:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -616,6 +616,10 @@ struct obj *obj; /* only scatter this obj */
struct scatter_chain *schain = (struct scatter_chain *) 0;
long total = 0L;
if (individual_object && (obj->ox != sx || obj->oy != sy))
impossible("scattered object <%d,%d> not at scatter site <%d,%d>",
obj->ox, obj->oy, sx, sy);
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
if (otmp->quan > 1L) {
qtmp = otmp->quan - 1L;
@@ -759,7 +763,7 @@ struct obj *obj; /* only scatter this obj */
free((genericptr_t) stmp);
newsym(x, y);
}
newsym(sx, sy);
return total;
}