level change or object deletion; context may no longer be valid */
| 266 | |
| 267 | /* level change or object deletion; context may no longer be valid */ |
| 268 | void |
| 269 | maybe_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 */ |
| 288 | struct obj * |
no test coverage detected