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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user