From c6a5ec1ab63d6f30635012abb8970ad6890e7b2d Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 4 Oct 2018 22:02:28 -0400 Subject: [PATCH] ensure tmp_at() structures are initialized for all code paths when swallowed --- doc/fixes36.2 | 1 + src/dothrow.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 8baf780cc..d458496a1 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -169,6 +169,7 @@ sortloot segfaulted when filtering a subset of items (seen with 'A' command) orctown: prevent Bad fruit #0 and some minor tuning make long extended commands list be more navigable simplify #wizidentify; don't rely on having bold menu entries +ensure tmp_at() structures are initialized for all code paths when swallowed tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status diff --git a/src/dothrow.c b/src/dothrow.c index 8dd71a8f2..877740193 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1134,6 +1134,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ mon = u.ustuck; bhitpos.x = mon->mx; bhitpos.y = mon->my; + if (tethered_weapon) + tmp_at(DISP_TETHER, obj_to_glyph(obj)); } else if (u.dz) { if (u.dz < 0 /* Mjollnir must we wielded to be thrown--caller verifies this; @@ -1280,12 +1282,20 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ /* missile has already been handled */ if (tethered_weapon) tmp_at(DISP_END, 0); } else if (u.uswallow) { - if (tethered_weapon) + if (tethered_weapon) { tmp_at(DISP_END, 0); - /* ball is not picked up by monster */ - if (obj != uball) - (void) mpickobj(u.ustuck, obj); - thrownobj = (struct obj *) 0; + pline("%s returns to your hand!", The(xname(thrownobj))); + thrownobj = addinv(thrownobj); + (void) encumber_msg(); + if (thrownobj->owornmask & W_QUIVER) /* in case addinv() autoquivered */ + setuqwep((struct obj *) 0); + setuwep(thrownobj); + } else { + /* ball is not picked up by monster */ + if (obj != uball) + (void) mpickobj(u.ustuck, obj); + thrownobj = (struct obj *) 0; + } } else { /* Mjollnir must we wielded to be thrown--caller verifies this; aklys must we wielded as primary to return when thrown */