diff --git a/doc/fixes37.0 b/doc/fixes37.0 index e7bc7c547..15bd240cc 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.218 $ $NHDT-Date: 1589323704 2020/05/12 22:48:24 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.219 $ $NHDT-Date: 1589491665 2020/05/14 21:27:45 $ General Fixes and Modified Features ----------------------------------- @@ -166,8 +166,6 @@ change light radius of stack of candles to square root could get redundate "mon hits other-mon" messages when mon wields an artifact failed untrap while mounted that moved hero onto the trap would leave steed with stale coordinates, triggering warnings if 'sanity_check' is On -when hold_another_object() fails while hero is swallowed, drop the item into - swallower's inventory instead of onto the floor when digging a pit results in it being filled by adjacent pool or lava, any objects at the spot weren't subjected to water or fire damage; also, riding hero's steed wasn't subjected to immersion either @@ -179,6 +177,16 @@ falling while going down stairs and dropping items due to encumbrance or punishment wasn't subject fragile ones to breakage objects scattered by an explosion which land on water or lava weren't affected by the water or lava +hold_another_object (for wishing, horn of plenty, theft while poly'd, other + non-pickup actions giving hero another inventory item) wasn't + reporting change in encumbrance; that would catch up on next turn but + could be off during additional move(s) for current turn +hold_another_object added item to inventory first, then maybe removed and + dropped it, resulting in spurious add and remove perm_invent updates +hold_another_object used hardcoded Stressed to limit carrying instead of + using the 'pickup_burden' option for that +when hold_another_object fails while hero is swallowed, drop the item into + swallower's inventory instead of onto the floor Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/invent.c b/src/invent.c index ffcbb7863..4e8c20419 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 invent.c $NHDT-Date: 1588189423 2020/04/29 19:43:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.297 $ */ +/* NetHack 3.7 invent.c $NHDT-Date: 1589491665 2020/05/14 21:27:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.298 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -19,7 +19,8 @@ static int FDECL(invletter_value, (CHAR_P)); static int FDECL(CFDECLSPEC sortloot_cmp, (const genericptr, const genericptr)); static void NDECL(reorder_invent); -static struct obj *FDECL(addinv_core0, (struct obj *, struct obj *)); +static struct obj *FDECL(addinv_core0, (struct obj *, struct obj *, + BOOLEAN_P)); static void FDECL(noarmor, (BOOLEAN_P)); static void FDECL(invdisp_nothing, (const char *, const char *)); static boolean FDECL(worn_wield_only, (struct obj *)); @@ -875,8 +876,9 @@ struct obj *obj; * Adjust hero attributes as necessary. */ static struct obj * -addinv_core0(obj, other_obj) +addinv_core0(obj, other_obj, update_perm_invent) struct obj *obj, *other_obj; +boolean update_perm_invent; { struct obj *otmp, *prev; int saved_otyp = (int) obj->otyp; /* for panic */ @@ -950,7 +952,8 @@ struct obj *obj, *other_obj; added: addinv_core2(obj); carry_obj_effects(obj); /* carrying affects the obj */ - update_inventory(); + if (update_perm_invent) + update_inventory(); return obj; } @@ -959,7 +962,7 @@ struct obj * addinv(obj) struct obj *obj; { - return addinv_core0(obj, (struct obj *) 0); + return addinv_core0(obj, (struct obj *) 0, TRUE); } /* add obj to the hero's inventory by inserting in front of a specific item */ @@ -967,7 +970,7 @@ struct obj * addinv_before(obj, other_obj) struct obj *obj, *other_obj; { - return addinv_core0(obj, other_obj); + return addinv_core0(obj, other_obj, TRUE); } /* @@ -1034,22 +1037,26 @@ const char *drop_fmt, *drop_arg, *hold_msg; } if (Fumbling) { obj->nomerge = 1; - obj = addinv(obj); /* dropping expects obj to be in invent */ + /* dropping expects obj to be in invent */ + obj = addinv_core0(obj, (struct obj *) 0, FALSE); goto drop_it; } else { long oquan = obj->quan; int prev_encumbr = near_capacity(); /* before addinv() */ - /* encumbrance only matters if it would now become worse - than max( current_value, stressed ) */ - if (prev_encumbr < MOD_ENCUMBER) - prev_encumbr = MOD_ENCUMBER; + /* encumbrance limit is max( current_state, pickup_burden ); + this used to use hardcoded MOD_ENCUMBER (stressed) instead + of the 'pickup_burden' option (which defaults to stressed) */ + if (prev_encumbr < flags.pickup_burden) + prev_encumbr = flags.pickup_burden; /* addinv() may redraw the entire inventory, overwriting - drop_arg when it comes from something like doname() */ + drop_arg when it is kept in an 'obuf' from doname(); + [should no longer be necessary now that perm_invent update is + suppressed, but it's cheap to keep as a paranoid precaution] */ if (drop_arg) drop_arg = strcpy(buf, drop_arg); - obj = addinv(obj); + obj = addinv_core0(obj, (struct obj *) 0, FALSE); if (inv_cnt(FALSE) > 52 || ((obj->otyp != LOADSTONE || !obj->cursed) && near_capacity() > prev_encumbr)) { /* undo any merge which took place */ @@ -1063,6 +1070,9 @@ const char *drop_fmt, *drop_arg, *hold_msg; setuqwep(obj); if (hold_msg || drop_fmt) prinv(hold_msg, obj, oquan); + /* obj made it into inventory and is staying there */ + update_inventory(); + encumber_msg(); } } return obj; diff --git a/src/zap.c b/src/zap.c index 158f542c2..73dc524a0 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1586633039 2020/04/11 19:23:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.335 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1589491666 2020/05/14 21:27:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.340 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -5365,9 +5365,8 @@ makewish() } /* * Note: if they wished for and got a non-object successfully, - * otmp == &cg.zeroobj. That includes gold, or an artifact that - * has been denied. Wishing for "nothing" requires a separate - * value to remain distinct. + * otmp == &zeroobj. That includes an artifact which has been denied. + * Wishing for "nothing" requires a separate value to remain distinct. */ otmp = readobjnam(buf, ¬hing); if (!otmp) {