From e5c488b15e73662217f33245d34142dc24a66d89 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 24 Nov 2018 15:22:33 -0800 Subject: [PATCH] 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. --- doc/fixes36.2 | 1 + src/explode.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index b9bfdfd95..5e4d30edf 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -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 diff --git a/src/explode.c b/src/explode.c index fc2855c1d..46d3b327f 100644 --- a/src/explode.c +++ b/src/explode.c @@ -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; }