fix #H9082 - post-3.6.2 monster throwing crash
Changing if (ammo_and_launcher(otmp, uwep) && mwep->otyp == ELVEN_BOW) (with 'uwep' typo) to if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep)) (with fixed 'mwep') moved ammo_and_launcher()'s hidden non-null test to after 'mwep->otyp'. If mwep was Null (so monster must be throwing non-ammo such as darts or daggers rather than shooting with a launcher), a crash occurred. (Throwing such things while the monster is wielding any weapon doesn't have this problem.) I don't think 3.6.2 can crash here. If hero's uwep is a bow, otmp must be arrows to get past pre-3.6.3's incorrect ammo_and_launcher() check. And a monster won't shoot arrows unless wielding a bow, so monster's mwep would be non-Null regardless of what uwep is. I tested a kobold with darts and an elven bow. But I also gave it one elven arrow to provoke it into wielding the bow and my test didn't throw darts with nothing wielded....
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.97 $ $NHDT-Date: 1564608120 2019/07/31 21:22:00 $
|
||||
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.98 $ $NHDT-Date: 1564767725 2019/08/02 17:42:05 $
|
||||
|
||||
This fixes36.3 file is here to capture information about updates in the 3.6.x
|
||||
lineage following the release of 3.6.2 in May 2019. Please note, however,
|
||||
@@ -128,6 +128,8 @@ fix for feedback when a monster plays a fire horn at self to cure green slime
|
||||
ended up being used for zapping a wand of fire at self too
|
||||
wizard mode ^I "not carrying anything" still claimed "not carrying anything"
|
||||
if "(all items are already identified)" was given
|
||||
monster throwing from stack of missiles (darts, daggers, spears) would cause
|
||||
crash if it wasn't wielding a weapon (bug in multi-shot shooting fix)
|
||||
curses: sometimes the message window would show a blank line after a prompt
|
||||
curses: the change to show map in columns 1..79 instead of 2..80 made the
|
||||
highlight for '@' show up in the wrong place if clipped map had been
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564608121 2019/07/31 21:22:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ */
|
||||
/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564767726 2019/08/02 17:42:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Pasi Kallinen, 2016. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -183,10 +183,10 @@ struct obj *otmp, *mwep;
|
||||
/* Elven Craftsmanship makes for light, quick bows */
|
||||
if (otmp->otyp == ELVEN_ARROW && !otmp->cursed)
|
||||
multishot++;
|
||||
/* for arrow, we checked bow&arrow at start of block, but for
|
||||
/* for arrow, we checked bow&arrow when entering block, but for
|
||||
bow, so far we've only validated that otmp is a weapon stack;
|
||||
need to verify that it's a stack of arrows rather than darts */
|
||||
if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep)
|
||||
if (mwep && mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep)
|
||||
&& !mwep->cursed)
|
||||
multishot++;
|
||||
/* 1/3 of launcher enchantment */
|
||||
|
||||
Reference in New Issue
Block a user