diff --git a/doc/fixes36.3 b/doc/fixes36.3 index c71dc5bb6..98a1c79f3 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.65 $ $NHDT-Date: 1561314651 2019/06/23 18:30:51 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ $NHDT-Date: 1561414302 2019/06/24 22:11:42 $ 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, @@ -87,6 +87,7 @@ partly eaten food with one bite left had message anomalies when eaten; the wizard mode ^I menu could list "Not carrying anything" after inventory items if perm_invent option was On (even on tty where that's not supported) change #adjust to treat carrying only gold as not having anything to adjust +saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/include/hack.h b/include/hack.h index c7807f015..d1f02b0b0 100644 --- a/include/hack.h +++ b/include/hack.h @@ -477,6 +477,7 @@ enum bodypart_types { #define POTION_OCCUPANT_CHANCE(n) (13 + 2 * (n)) #define WAND_BACKFIRE_CHANCE 100 #define BALL_IN_MON (u.uswallow && uball && uball->where == OBJ_FREE) +#define CHAIN_IN_MON (u.uswallow && uchain && uchain->where == OBJ_FREE) #define NODIAG(monnum) ((monnum) == PM_GRID_BUG) /* Flags to control menus */ diff --git a/src/end.c b/src/end.c index 95f4a0a12..c45471eeb 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1559675615 2019/06/04 19:13:35 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.176 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1561414303 2019/06/24 22:11:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.178 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1023,6 +1023,12 @@ done_object_cleanup() /* placebc(); */ lift_covet_and_placebc(override_restriction); } + /* persistent inventory window now obsolete since disclosure uses + a normal popup one; avoids "Bad fruit #n" when saving bones */ + if (iflags.perm_invent) { + iflags.perm_invent = FALSE; + update_inventory(); /* make interface notice the change */ + } return; } @@ -1202,6 +1208,8 @@ int how; deal with ball and chain possibly being temporarily off the map */ if (!g.program_state.panicking) done_object_cleanup(); + /* in case we're panicking; normally cleared by done_object_cleanup() */ + iflags.perm_invent = FALSE; /* remember time of death here instead of having bones, rip, and topten figure it out separately and possibly getting different diff --git a/src/restore.c b/src/restore.c index d10a6ec88..48a5470d2 100644 --- a/src/restore.c +++ b/src/restore.c @@ -643,7 +643,8 @@ unsigned int *stuckid, *steedid; struct sysflag newgamesysflags; #endif struct context_info newgamecontext; /* all 0, but has some pointers */ - struct obj *otmp, *tmp_bc; + struct obj *otmp; + struct obj *bc_obj; char timebuf[15]; unsigned long uid; boolean defer_perm_invent; @@ -782,17 +783,15 @@ unsigned int *stuckid, *steedid; if (nhfp->fieldlevel && nhfp->addinfo) sfi_addinfo(nhfp, "objchain", "start", "invent", 0); g.invent = restobjchn(nhfp, FALSE, FALSE); - /* tmp_bc only gets set here if the ball & chain were orphaned - because you were swallowed; otherwise they will be on the floor - or in your inventory */ - tmp_bc = restobjchn(nhfp, FALSE, FALSE); - if (tmp_bc) { - for (otmp = tmp_bc; otmp; otmp = otmp->nobj) { - if (otmp->owornmask) - setworn(otmp, otmp->owornmask); - } - if (!uball || !uchain) - impossible("restgamestate: lost ball & chain"); + + /* restore dangling (not on floor or in inventory) ball and/or chain */ + bc_obj = restobjchn(nhfp, FALSE, FALSE); + while(bc_obj) { + struct obj * nobj = bc_obj->nobj; + if (bc_obj->owornmask) + setworn(bc_obj, bc_obj->owornmask); + bc_obj->nobj = (struct obj *)0; + bc_obj = nobj; } g.migrating_objs = restobjchn(nhfp, FALSE, FALSE); g.migrating_mons = restmonchn(nhfp, FALSE); @@ -818,6 +817,10 @@ unsigned int *stuckid, *steedid; for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->owornmask) setworn(otmp, otmp->owornmask); + + if ((uball && !uchain) || (uchain && !uball)) + impossible("restgamestate: lost ball & chain"); + /* reset weapon so that player will get a reminder about "bashing" during next fight when bare-handed or wielding an unconventional item; for pick-axe, we aren't able to distinguish between having diff --git a/src/save.c b/src/save.c index 192218886..b0608aea0 100644 --- a/src/save.c +++ b/src/save.c @@ -287,6 +287,7 @@ savegamestate(nhfp) NHFILE *nhfp; { unsigned long uid; + struct obj * bc_objs = (struct obj *)0; #ifdef MFLOPPY count_only = (nhfp->mode & COUNTING); @@ -337,14 +338,18 @@ NHFILE *nhfp; save_light_sources(nhfp, RANGE_GLOBAL); saveobjchn(nhfp, g.invent); - if (BALL_IN_MON) { - /* prevent loss of ball & chain when swallowed */ - uball->nobj = uchain; - uchain->nobj = (struct obj *) 0; - saveobjchn(nhfp, uball); - } else { - saveobjchn(nhfp, (struct obj *) 0); + + /* save ball and chain if they are currently dangling free (i.e. not on + floor or in inventory) */ + if (CHAIN_IN_MON) { + uchain->nobj = bc_objs; + bc_objs = uchain; } + if (BALL_IN_MON) { + uball->nobj = bc_objs; + bc_objs = uball; + } + saveobjchn(nhfp, bc_objs); saveobjchn(nhfp, g.migrating_objs); savemonchn(nhfp, g.migrating_mons);