encumbrance checks

I polymorphed into something wimpy and became overloaded or even
overtaxed so I dropped everything.  The status line still showed
overloaded or overtaxed until my next move.  That didn't happen in
3.6.x or 3.4.3 but I didn't pursue trying to figure out what caused
this misbehavior.

I wanted to add an encumber_msg() call to freeinv() but that would
cause message sequencing issues.  Instead, add a call to it in a
few places where items are leaving hero's inventory, particularly
for the chain of calls for dropping stuff.  I've left it off in a
bunch of other potential places.

Also add a few missing (void) casts where the return value of
existing encumber_msg() calls is being ignored.
This commit is contained in:
PatR
2022-03-22 10:48:23 -07:00
parent ade53925a6
commit 385a9a7fde
8 changed files with 17 additions and 12 deletions

View File

@@ -844,6 +844,7 @@ untwoweapon(void)
return;
}
/* enchant wielded weapon */
int
chwepon(struct obj *otmp, int amount)
{
@@ -897,7 +898,7 @@ chwepon(struct obj *otmp, int amount)
if (otyp != STRANGE_OBJECT)
makeknown(otyp);
if (multiple)
encumber_msg();
(void) encumber_msg();
return 1;
} else if (uwep->otyp == CRYSKNIFE && amount < 0) {
multiple = (uwep->quan > 1L);
@@ -914,7 +915,7 @@ chwepon(struct obj *otmp, int amount)
if (otyp != STRANGE_OBJECT && otmp->bknown)
makeknown(otyp);
if (multiple)
encumber_msg();
(void) encumber_msg();
return 1;
}