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

Function maybe_reset_pick

src/lock.c:268–285  ·  view source on GitHub ↗

level change or object deletion; context may no longer be valid */

Source from the content-addressed store, hash-verified

266
267/* level change or object deletion; context may no longer be valid */
268void
269maybe_reset_pick(struct obj *container) /* passed from obfree() */
270{
271 /*
272 * If a specific container, only clear context if it is for that
273 * particular container (which is being deleted). Other stuff on
274 * the current dungeon level remains valid.
275 * However if 'container' is Null, clear context if not carrying
276 * gx.xlock.box (which might be Null if context is for a door).
277 * Used for changing levels, where a floor container or a door is
278 * being left behind and won't be valid on the new level but a
279 * carried container will still be. There might not be any context,
280 * in which case redundantly clearing it is harmless.
281 */
282 if (container ? (container == gx.xlock.box)
283 : (!gx.xlock.box || !carried(gx.xlock.box)))
284 reset_pick();
285}
286
287/* pick a tool for autounlock */
288struct obj *

Callers 4

goto_levelFunction · 0.85
add_to_migrationFunction · 0.85
obfreeFunction · 0.85
makemap_prepostFunction · 0.85

Calls 1

reset_pickFunction · 0.85

Tested by

no test coverage detected