fix boomerang equiped in multiple slots

Reported directly to devteam:  with one quivered boomerang and a
compatable stack of one or more boomerangs either wielded or in the
alternate weapon slot, throwing the quivered one, failing to hit any
target or obstacle, and catching the returning boomerang would empty
the quiver, merge the caught boomerang with the wielded weapon or
swap-weapon slot, then re-quiver and yield
|x - 2 boomerangs (wielded) (at the ready)
or
|y - 2 boomerangs (alternate weapon; not wielded) (at the ready)
If 'sanity_check' was On, complaints would ensue.

'autoquiver' may need to be On in addition to the thrown boomerang
being the last item in the quiver.

The unsplit portion of the fix feels unclean.  There's bound to be a
better way.
This commit is contained in:
PatR
2022-12-24 00:27:59 -08:00
parent 9657b78359
commit 9a9f2d596d
3 changed files with 71 additions and 25 deletions

View File

@@ -2737,15 +2737,20 @@ obj_sanity_check(void)
/* objects temporarily freed from invent/floor lists;
they should have arrived somewhere by the time we get called */
if (gt.thrownobj)
insane_object(gt.thrownobj, ofmt3, "gt.thrownobj sanity",
insane_object(gt.thrownobj, ofmt3, "thrownobj sanity",
(struct monst *) 0);
if (gk.kickedobj)
insane_object(gk.kickedobj, ofmt3, "gk.kickedobj sanity",
insane_object(gk.kickedobj, ofmt3, "kickedobj sanity",
(struct monst *) 0);
/* returning_missile temporarily remembers thrownobj and should be
Null in between moves */
if (iflags.returning_missile)
insane_object(gk.kickedobj, ofmt3, "returning_missile sanity",
(struct monst *) 0);
/* gc.current_wand isn't removed from invent while in use, but should
be Null between moves when we're called */
if (gc.current_wand)
insane_object(gc.current_wand, ofmt3, "gc.current_wand sanity",
insane_object(gc.current_wand, ofmt3, "current_wand sanity",
(struct monst *) 0);
}