worn/wielded pointer sanity checks
Check the various uarm, uwep, and so forth pointers to make sure that they point to items in hero's inventory and that those items have the corresponding W_ARM, W_WEP, &c bit set in their owornmask field. Also check whether any other items in inventory have the same bit set. [Some of this is already handled by sanity_check_worn() in mkobj.c.] Also validate two-weapon combat mode. I don't recall ever seeing any problems reported about it though. Does not validate ball and chain. Those should have their own sanity checks that validate a bunch of other stuff besides just worn slots. They already get some checking by the normal object tests. This works ok with 'sanity_check' set and items worn and wielded normally. The only insane situation tested was by reverting the confused-looting-with-quivered-gold fix from earlier today. I haven't used a debugger to force other such problems so this isn't very thoroughly tested.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1706213788 2024/01/25 20:16:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1373 $ */
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1707547708 2024/02/10 06:48:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1381 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -3686,6 +3686,7 @@ extern void setnotworn(struct obj *) NO_NNARGS; /* has tests for obj */
|
||||
extern void allunworn(void);
|
||||
extern struct obj *wearmask_to_obj(long);
|
||||
extern long wearslot(struct obj *) NONNULLARG1;
|
||||
extern void check_wornmask_slots(void);
|
||||
extern void mon_set_minvis(struct monst *) NONNULLARG1;
|
||||
extern void mon_adjust_speed(struct monst *, int, struct obj *) NONNULLARG1;
|
||||
extern void update_mon_extrinsics(struct monst *, struct obj *, boolean,
|
||||
|
||||
Reference in New Issue
Block a user