MCPcopy Create free account
hub / github.com/NetHack/NetHack / wiz_debug_cmd_bury

Function wiz_debug_cmd_bury

src/dig.c:2287–2320  ·  view source on GitHub ↗

the #wizbury command - bury everything at your loc and around */

Source from the content-addressed store, hash-verified

2285#ifdef DEBUG
2286/* the #wizbury command - bury everything at your loc and around */
2287int
2288wiz_debug_cmd_bury(void)
2289{
2290 struct obj *otmp;
2291 int x, y, before = 0, after = 0, diff;
2292
2293 for (x = u.ux - 1; x <= u.ux + 1; x++)
2294 for (y = u.uy - 1; y <= u.uy + 1; y++) {
2295 if (!isok(x, y))
2296 continue;
2297 for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
2298 ++before;
2299
2300 bury_objs(x, y);
2301
2302 for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
2303 ++after;
2304 }
2305
2306 diff = before - after;
2307 if (before == 0)
2308 /* there was nothing here */
2309 pline("No objects here or adjacent to bury.");
2310 else if (diff == 0)
2311 /* before and after will be the same if only unburiable objects are
2312 present (The Amulet, invocation items, Rider corpses, uchain when
2313 uball doesn't get buried: carried or floor beyond burial range) */
2314 pline("No objects buried.");
2315 else
2316 /* usual case; if uball got buried, uchain went away and won't be
2317 counted as buried */
2318 pline("%d object%s buried.", diff, plur(diff));
2319 return ECMD_OK;
2320}
2321#endif /* DEBUG */
2322
2323#undef BY_YOU

Callers

nothing calls this directly

Calls 3

isokFunction · 0.85
bury_objsFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected