From 9365789b6dc3de8bd66881594b3500aad7bbbe10 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 25 Aug 2024 12:15:17 -0700 Subject: [PATCH] revise #wizbury feedback Simplify the code added in April. --- src/dig.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/dig.c b/src/dig.c index 92d7cd771..309f06a67 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 dig.c $NHDT-Date: 1709928001 2024/03/08 20:00:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.211 $ */ +/* NetHack 3.7 dig.c $NHDT-Date: 1724613307 2024/08/25 19:15:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.219 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2294,26 +2294,24 @@ wiz_debug_cmd_bury(void) ++before; bury_objs(x, y); + + for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere) + ++after; } - if (before == 0) { /* there was nothing here */ + diff = before - after; + if (before == 0) + /* there was nothing here */ pline("No objects here or adjacent to bury."); - } else { - for (x = u.ux - 1; x <= u.ux + 1; x++) - for (y = u.uy - 1; y <= u.uy + 1; y++) { - if (!isok(x, y)) - continue; - for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere) - ++after; - } - diff = before - after; - /* will be 0 if only unburiable objects (The Amulet, &c) are present; - if uball got buried, uchain went away--count that as being buried */ - if (diff == 0) - pline("No objects buried."); - else - pline("%d object%s buried.", diff, plur(diff)); - } + else if (diff == 0) + /* before and after will be the same if only unburiable objects are + present (The Amulet, invocation items, Rider corpses, uchain when + uball doesn't get buried: carried or floor beyond burial range) */ + pline("No objects buried."); + else + /* usual case; if uball got buried, uchain went away and won't be + counted as buried */ + pline("%d object%s buried.", diff, plur(diff)); return ECMD_OK; } #endif /* DEBUG */