From 40e7eb7e2a85b68ec7df2b4a7889bfb336d975e3 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 5 May 2019 14:16:49 -0400 Subject: [PATCH 1/8] sync recent wording change in history --- dat/history | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dat/history b/dat/history index 4312393fd..032ab50a1 100644 --- a/dat/history +++ b/dat/history @@ -227,9 +227,9 @@ and in days past, devnull.net (gone for now, but not forgotten). - - - - - - - - - - From time to time, some depraved individual out there in netland sends a -particularly intriguing modification to help out with the game. The gods -of the dungeon sometimes make note of the names of the worst of these -miscreants in this, the list of Dungeoneers: +particularly intriguing modification to help out with the game. The +NetHack Development Team sometimes makes note of the names of the worst +of these miscreants in this, the list of Dungeoneers: Adam Aronow Janet Walz Nathan Eady Alex Kompel Janne Salmijarvi Norm Meluch From f55e9ddd7cffdeb0678986cf8b0160e29a2140a8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 5 May 2019 22:29:47 +0300 Subject: [PATCH 2/8] Fix impossible if monster cannot be relocated from tele region --- doc/fixes36.2 | 1 + src/mkmaze.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 610c60161..ec12a701f 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -421,6 +421,7 @@ message given when shape-shifted vampire cheats death by reverting to its Vlad wasn't set up as a vampshifter properly poly'd hero capable of spitting venom would leave intact venom object if it reached end of range at a 'soft' location such as water +avoid impossible if monster cannot be relocated from teleport region Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/mkmaze.c b/src/mkmaze.c index 1b3959315..897830243 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -326,6 +326,8 @@ xchar rtype; boolean oneshot; d_level *lev; { + struct monst *mtmp; + if (bad_location(x, y, nlx, nly, nhx, nhy)) { if (!oneshot) { return FALSE; /* caller should try again */ @@ -346,11 +348,12 @@ d_level *lev; case LR_UPTELE: case LR_DOWNTELE: /* "something" means the player in this case */ - if (MON_AT(x, y)) { + if ((mtmp = m_at(x, y)) != 0) { /* move the monster if no choice, or just try again */ - if (oneshot) - (void) rloc(m_at(x, y), FALSE); - else + if (oneshot) { + if (!rloc(mtmp, TRUE)) + m_into_limbo(mtmp); + } else return FALSE; } u_on_newpos(x, y); From bed2c2307e9ac2559f40779d180d41ffb88ff932 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 5 May 2019 22:49:21 +0300 Subject: [PATCH 3/8] Fix monster trapped state being wrong When cloning a monster, clear the clone trapped and hiding states. When splitting a monster (eg. a black pudding), the clone could be placed on a trap, so do mintrap. When removing a monster from the map, clear the trapped state. --- doc/fixes36.2 | 2 ++ src/makemon.c | 2 ++ src/mhitm.c | 4 +++- src/mon.c | 1 + src/uhitm.c | 4 +++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index ec12a701f..7b791a6b7 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -422,6 +422,8 @@ Vlad wasn't set up as a vampshifter properly poly'd hero capable of spitting venom would leave intact venom object if it reached end of range at a 'soft' location such as water avoid impossible if monster cannot be relocated from teleport region +fix cloned monster trapped and hiding states +split monster could be placed on trap without triggering it Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/makemon.c b/src/makemon.c index 6b750f2f6..94ee223dd 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -842,6 +842,8 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */ m2->mx = mm.x; m2->my = mm.y; + m2->mundetected = 0; + m2->mtrapped = 0; m2->mcloned = 1; m2->minvent = (struct obj *) 0; /* objects don't clone */ m2->mleashed = FALSE; diff --git a/src/mhitm.c b/src/mhitm.c index a2d0c6659..79f1e6739 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -419,7 +419,8 @@ register struct monst *magr, *mdef; || objects[otmp->otyp].oc_material == METAL)) && mdef->mhp > 1 && !mdef->mcan) { - if (clone_mon(mdef, 0, 0)) { + struct monst *mclone; + if ((mclone = clone_mon(mdef, 0, 0)) != 0) { if (vis && canspotmon(mdef)) { char buf[BUFSZ]; @@ -427,6 +428,7 @@ register struct monst *magr, *mdef; pline("%s divides as %s hits it!", buf, mon_nam(magr)); } + mintrap(mclone); } } } else diff --git a/src/mon.c b/src/mon.c index 2882a226c..7bb0d0f98 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1687,6 +1687,7 @@ struct monst **monst_list; /* &migrating_mons or &mydogs or null */ } if (on_map) { + mon->mtrapped = 0; if (mon->wormno) remove_worm(mon); else diff --git a/src/uhitm.c b/src/uhitm.c index b354d5d7a..f478d0289 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1227,7 +1227,8 @@ int dieroll; /* but not bashing with darts, arrows or ya */ && !(is_ammo(obj) || is_missile(obj))) && hand_to_hand) { - if (clone_mon(mon, 0, 0)) { + struct monst *mclone; + if ((mclone = clone_mon(mon, 0, 0)) != 0) { char withwhat[BUFSZ]; withwhat[0] = '\0'; @@ -1235,6 +1236,7 @@ int dieroll; Sprintf(withwhat, " with %s", yname(obj)); pline("%s divides as you hit it%s!", Monnam(mon), withwhat); hittxt = TRUE; + mintrap(mclone); } } From a8550fc0e7eb5d97690f6985d7d88de3e202b46f Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 13:33:30 -0700 Subject: [PATCH 4/8] ball&chain sanity checking Add a bc sanity check. It seems to work ok--in other words, not trigger--under normal punishment. I don't have any test cases to exercise its warnings. This dragged in a couple of minor bc changes that were pending. I should have cleared those out before tackling the sanity checking. --- include/extern.h | 3 +- src/ball.c | 90 ++++++++++++++++++++++++++++++++++++++++++------ src/cmd.c | 3 +- 3 files changed, 83 insertions(+), 13 deletions(-) diff --git a/include/extern.h b/include/extern.h index 67f8e3ee1..6959e2448 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1555201698 2019/04/14 00:28:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.702 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1557088399 2019/05/05 20:33:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.703 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -135,6 +135,7 @@ E boolean FDECL(drag_ball, (XCHAR_P, XCHAR_P, int *, xchar *, xchar *, xchar *, xchar *, boolean *, BOOLEAN_P)); E void FDECL(drop_ball, (XCHAR_P, XCHAR_P)); E void NDECL(drag_down); +E void NDECL(bc_sanity_check); /* ### bones.c ### */ diff --git a/src/ball.c b/src/ball.c index 3ac723866..d0570bbaa 100644 --- a/src/ball.c +++ b/src/ball.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 ball.c $NHDT-Date: 1450402033 2015/12/18 01:27:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.29 $ */ +/* NetHack 3.6 ball.c $NHDT-Date: 1557088406 2019/05/05 20:33:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) David Cohrs, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -24,12 +24,14 @@ boolean showmsg; setuswapwep((struct obj *) 0); if (uquiver == uball) setuqwep((struct obj *) 0); - ; - if (uwep != uball) - freeinv(uball); + /* [this used to test 'if (uwep != uball)' but that always passes + after the setuwep() above] */ + freeinv(uball); /* remove from inventory but don't place on floor */ + encumber_msg(); } } +/* ball&chain might hit hero when falling through a trap door */ void ballfall() { @@ -40,6 +42,7 @@ ballfall() ballrelease(TRUE); if (gets_hit) { int dmg = rn1(7, 25); + pline_The("iron ball falls on your %s.", body_part(HEAD)); if (uarmh) { if (is_metallic(uarmh)) { @@ -113,9 +116,9 @@ placebc() (void) flooreffects(uchain, u.ux, u.uy, ""); /* chain might rust */ - if (carried(uball)) /* the ball is carried */ + if (carried(uball)) { /* the ball is carried */ u.bc_order = BCPOS_DIFFER; - else { + } else { /* ball might rust -- already checked when carried */ (void) flooreffects(uball, u.ux, u.uy, ""); place_object(uball, u.ux, u.uy); @@ -411,6 +414,7 @@ boolean allow_drag; /* only need to move the chain? */ if (carried(uball) || distmin(x, y, uball->ox, uball->oy) <= 2) { xchar oldchainx = uchain->ox, oldchainy = uchain->oy; + *bc_control = BC_CHAIN; move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy); if (carried(uball)) { @@ -584,7 +588,7 @@ boolean allow_drag; return TRUE; } -drag: + drag: if (near_capacity() > SLT_ENCUMBER && dist2(x, y, u.ux, u.uy) <= 2) { You("cannot %sdrag the heavy iron ball.", @@ -774,21 +778,24 @@ xchar x, y; } } +/* ball&chain cause hero to randomly lose stuff from inventory */ STATIC_OVL void litter() { - struct obj *otmp = invent, *nextobj; + struct obj *otmp, *nextobj = 0; int capacity = weight_cap(); - while (otmp) { + for (otmp = invent; otmp; otmp = nextobj) { nextobj = otmp->nobj; if ((otmp != uball) && (rnd(capacity) <= (int) otmp->owt)) { if (canletgo(otmp, "")) { - pline("%s you down the stairs.", Yobjnam2(otmp, "follow")); + You("drop %s and %s %s down the stairs with you.", + yname(otmp), (otmp->quan == 1L) ? "it" : "they", + otense(otmp, "fall")); dropx(otmp); + encumber_msg(); /* drop[xyz]() probably ought to to this... */ } } - otmp = nextobj; } } @@ -839,4 +846,65 @@ drag_down() } } +void +bc_sanity_check() +{ + int otyp; + unsigned save_nameknown; + const char *onam; + + if (Punished && (!uball || !uchain)) { + impossible("Punished without %s%s%s?", + !uball ? "iron ball" : "", + (!uball && !uchain) ? " and " : "", + !uchain ? "attached chain" : ""); + } else if (!Punished && (uball || uchain)) { + impossible("Attached %s%s%s without being Punished?", + uchain ? "chain" : "", + (uchain && uball) ? " and " : "", + uball ? "iron ball" : ""); + } + /* ball is free when swallowed, changing levels, other times? */ + if (uball && (uball->otyp != HEAVY_IRON_BALL + || (uball->where != OBJ_FLOOR + && uball->where != OBJ_INVENT + && uball->where != OBJ_FREE) + || (uball->owornmask & W_BALL) == 0L + || (uball->owornmask & ~(W_BALL | W_WEAPON)) != 0L)) { + otyp = uball->otyp; + if (otyp < STRANGE_OBJECT || otyp >= NUM_OBJECTS + || !OBJ_NAME(objects[otyp])) { + onam = "glorkum"; + } else { + save_nameknown = objects[otyp].oc_name_known; + objects[otyp].oc_name_known = 1; + onam = simple_typename(otyp); + objects[otyp].oc_name_known = save_nameknown; + } + impossible("uball: type %d (%s), where %d, wornmask=0x%08lx", + otyp, onam, uball->where, uball->owornmask); + } + /* similar check to ball except can't be in inventory */ + if (uchain && (uchain->otyp != IRON_CHAIN + || (uchain->where != OBJ_FLOOR + && uchain->where != OBJ_FREE) + /* [could simplify this to owornmask != W_CHAIN] */ + || (uchain->owornmask & W_CHAIN) == 0L + || (uchain->owornmask & ~W_CHAIN) != 0L)) { + otyp = uchain->otyp; + if (otyp < STRANGE_OBJECT || otyp >= NUM_OBJECTS + || !OBJ_NAME(objects[otyp])) { + onam = "glorkum"; + } else { + save_nameknown = objects[otyp].oc_name_known; + objects[otyp].oc_name_known = 1; + onam = simple_typename(otyp); + objects[otyp].oc_name_known = save_nameknown; + } + impossible("uchain: type %d (%s), where %d, wornmask=0x%08lx", + otyp, onam, uchain->where, uchain->owornmask); + } + /* [check bc_order too?] */ +} + /*ball.c*/ diff --git a/src/cmd.c b/src/cmd.c index 34444a483..148f63ca1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1549327488 2019/02/05 00:44:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.331 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1557088405 2019/05/05 20:33:25 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.333 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4102,6 +4102,7 @@ sanity_check() timer_sanity_check(); mon_sanity_check(); light_sources_sanity_check(); + bc_sanity_check(); } #ifdef DEBUG_MIGRATING_MONS From fcd38bdbef94fa48565ded76ef016f3ab59540cd Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 13:38:58 -0700 Subject: [PATCH 5/8] couple of interface comments --- win/curses/cursstat.c | 2 +- win/tty/wintty.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 68962bf7a..4847308f0 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -432,7 +432,7 @@ boolean border; w += (int) strlen(text); /* if preceding field has any trailing spaces, don't add extra; (should only apply to prev==title; status_update() handles - others that used to have trailing spaces by stripping such */ + others that used to have trailing spaces by stripping such) */ if (spacing[fld] > 0 && prev_fld != BL_FLUSH && *(p = status_vals[prev_fld]) && *(eos(p) - 1) == ' ' && (prev_fld != BL_TITLE || !iflags.wc2_hitpointbar)) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 6d03a0ce1..cc191fb65 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintty.c $NHDT-Date: 1555702074 2019/04/19 19:27:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.202 $ */ +/* NetHack 3.6 wintty.c $NHDT-Date: 1557088734 2019/05/05 20:38:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.203 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -2396,7 +2396,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin) tty_display_nhwindow(WIN_MESSAGE, TRUE); - /*FALLTHRU*/ + /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: case NHW_MAP: @@ -3849,7 +3849,7 @@ unsigned long *colormasks; switch (fldidx) { case BL_RESET: reset_state = FORCE_RESET; - /* FALLTHRU */ + /*FALLTHRU*/ case BL_FLUSH: if (make_things_fit(reset_state) || truncation_expected) render_status(); @@ -3931,7 +3931,7 @@ unsigned long *colormasks; tty_status[NOW][fldidx].lth = 30 + 2; /* '[' and ']' */ break; case BL_GOLD: - /* \GXXXXNNNN counts as 1 */ + /* \GXXXXNNNN counts as 1 [moot since we use decode_mixed() above] */ if ((p = index(status_vals[fldidx], '\\')) != 0 && p[1] == 'G') tty_status[NOW][fldidx].lth -= (10 - 1); break; @@ -4038,7 +4038,7 @@ int sz[3]; /* On a change to the field location, everything further to the right must be updated as well. (Not necessarily - everything; it's possible for complementary changes to + everything; it's possible for complementary changes across multiple fields to put stuff further right back in sync.) */ if (tty_status[NOW][idx].x + tty_status[NOW][idx].lth != tty_status[BEFORE][idx].x + tty_status[BEFORE][idx].lth) @@ -4503,7 +4503,7 @@ render_status(VOID_ARGS) x += tlth; } finalx[row][NOW] = x - 1; - /* reset .redraw, .dirty, .padright now that they're rendered */ + /* reset .redraw and .dirty now that they're rendered */ tty_status[NOW][idx].dirty = FALSE; tty_status[NOW][idx].redraw = FALSE; /* From e2eeca2ed09f4c7adbea87eefd539205db2cc913 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 14:48:43 -0700 Subject: [PATCH 6/8] bones bit: crysknife vs green slime Being turned into green slime never drops hero's inventory so invent objects shouldn't be subject to obj_not_held() handling. obj_not_held() does apply to undead. Arising as a mummy or vampire doesn't go through the trouble of dropping everything and picking it back up, but there is a point in the die...arise sequence where the hero is implicitly a corpse so nobody is holding his/her stuff. --- doc/fixes36.2 | 4 +++- src/bones.c | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 7b791a6b7..c7fa21534 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.312 $ $NHDT-Date: 1556649298 2019/04/30 18:34:58 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.315 $ $NHDT-Date: 1557091781 2019/05/05 21:29:41 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -424,6 +424,8 @@ poly'd hero capable of spitting venom would leave intact venom object if it avoid impossible if monster cannot be relocated from teleport region fix cloned monster trapped and hiding states split monster could be placed on trap without triggering it +turning into green slime would make wielded or carried crysknives revert to + worm teeth in bones data even though they remained carried Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/bones.c b/src/bones.c index 7aadc3967..0a7b81793 100644 --- a/src/bones.c +++ b/src/bones.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 bones.c $NHDT-Date: 1539653203 2018/10/16 01:26:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 bones.c $NHDT-Date: 1557092711 2019/05/05 21:45:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -214,8 +214,8 @@ char *namebuf; /* called by savebones(); also by finish_paybill(shk.c) */ void drop_upon_death(mtmp, cont, x, y) -struct monst *mtmp; -struct obj *cont; +struct monst *mtmp; /* monster if hero turned into one (other than ghost) */ +struct obj *cont; /* container if hero is turned into a statue */ int x, y; { struct obj *otmp; @@ -223,9 +223,13 @@ int x, y; u.twoweap = 0; /* ensure curse() won't cause swapwep to drop twice */ while ((otmp = invent) != 0) { obj_extract_self(otmp); - obj_no_longer_held(otmp); + /* when turning into green slime, all gear remains held; + other types "arise from the dead" do aren't holding + equipment during their brief interval as a corpse */ + if (!mtmp || is_undead(mtmp->data)) + obj_no_longer_held(otmp); - otmp->owornmask = 0; + otmp->owornmask = 0L; /* lamps don't go out when dropped */ if ((cont || artifact_light(otmp)) && obj_is_burning(otmp)) end_burn(otmp, TRUE); /* smother in statue */ @@ -365,7 +369,7 @@ struct obj *corpse; return; } -make_bones: + make_bones: unleash_all(); /* in case these characters are not in their home bases */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -390,7 +394,7 @@ make_bones: /* check iron balls separately--maybe they're not carrying it */ if (uball) - uball->owornmask = uchain->owornmask = 0; + uball->owornmask = uchain->owornmask = 0L; /* dispose of your possessions, usually cursed */ if (u.ugrave_arise == (NON_PM - 1)) { @@ -422,21 +426,21 @@ make_bones: in_mklev = TRUE; /* use as-is */ mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT); in_mklev = FALSE; - if (!mtmp) { + if (!mtmp) { /* arise-type might have been genocided */ drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy); u.ugrave_arise = NON_PM; /* in case caller cares */ return; } - /* give mummy-from-hero a wrapping unless hero already - carries one; don't bother forcing it to become worn */ - if (mtmp->data->mlet == S_MUMMY && !carrying(MUMMY_WRAPPING)) - (void) mongets(mtmp, MUMMY_WRAPPING); mtmp = christen_monst(mtmp, plname); newsym(u.ux, u.uy); /* ["Your body rises from the dead as an ..." used to be given here, but it has been moved to done() so that it gets delivered even when savebones() isn't called] */ drop_upon_death(mtmp, (struct obj *) 0, u.ux, u.uy); + /* 'mtmp' now has hero's inventory; if 'mtmp' is a mummy, give it + a wrapping unless already carrying one */ + if (mtmp->data->mlet == S_MUMMY && !m_carrying(mtmp, MUMMY_WRAPPING)) + (void) mongets(mtmp, MUMMY_WRAPPING); m_dowear(mtmp, TRUE); } if (mtmp) { From 6127c1084831e2ac89ef28e9305e974aabf8619f Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 15:20:09 -0700 Subject: [PATCH 7/8] comment/formatting tidbits Some miscellaneous stuff I don't want to discard of lose track of. No change it actual code. --- src/botl.c | 20 +++++++++++++++----- src/dogmove.c | 24 +++++++++++------------- src/end.c | 11 ++++++++++- src/monmove.c | 9 +++++---- 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/botl.c b/src/botl.c index b961c75bc..f43c0f498 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1554857126 2019/04/10 00:45:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1557094795 2019/05/05 22:19:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -811,6 +811,15 @@ boolean *valsetlist; } #endif + /* + * TODO? + * It's possible for HPmax (or ENEmax) to change while current + * HP (or energy) stays the same. [Perhaps current and maximum + * both go up, then before the next status update takes place + * current goes down again.] If that happens with HPmax, we + * ought to force the windowport to treat current HP as changed + * if hitpointbar is On, in order for that to be re-rendered. + */ if (update_all || chg || reset) { idxmax = curr->idxmax; pc = (idxmax >= 0) ? percentage(curr, &blstats[idx][idxmax]) : 0; @@ -892,8 +901,8 @@ boolean *valsetlist; if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L) status_update(BL_RESET, (genericptr_t) 0, 0, 0, NO_COLOR, (unsigned long *) 0); - else if ((updated || context.botlx) && - (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) + else if ((updated || context.botlx) + && (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) status_update(BL_FLUSH, (genericptr_t) 0, 0, 0, NO_COLOR, (unsigned long *) 0); @@ -1376,7 +1385,8 @@ const char *name; STATIC_OVL boolean hilite_reset_needed(bl_p, augmented_time) struct istat_s *bl_p; -long augmented_time; +long augmented_time; /* no longer augmented; it once encoded fractional + * amounts for multiple moves within same turn */ { /* * This 'multi' handling may need some tuning... @@ -1434,7 +1444,7 @@ status_eval_next_unhilite() } } -/* called by options handling when 'statushilites' boolean is toggled */ +/* called by options handling when 'statushilites' value is changed */ void reset_status_hilites() { diff --git a/src/dogmove.c b/src/dogmove.c index 552da454b..df3452faa 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dogmove.c $NHDT-Date: 1551493951 2019/03/02 02:32:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.6 dogmove.c $NHDT-Date: 1557094801 2019/05/05 22:20:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.74 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -379,8 +379,9 @@ struct edog *edog; else You_feel("worried about %s.", y_monnam(mtmp)); stop_occupation(); - } else if (monstermoves > edog->hungrytime + 750 || DEADMONSTER(mtmp)) { - dog_died: + } else if (monstermoves > edog->hungrytime + 750 + || DEADMONSTER(mtmp)) { + dog_died: if (mtmp->mleashed && mtmp != u.usteed) Your("leash goes slack."); else if (cansee(mtmp->mx, mtmp->my)) @@ -615,7 +616,6 @@ int after, udist, whappr; return appr; } - STATIC_OVL struct monst * find_targ(mtmp, dx, dy, maxdist) register struct monst *mtmp; @@ -644,14 +644,13 @@ int maxdist; if (!m_cansee(mtmp, curx, cury)) break; - targ = m_at(curx, cury); - if (curx == mtmp->mux && cury == mtmp->muy) return &youmonst; - if (targ) { + if ((targ = m_at(curx, cury)) != 0) { /* Is the monster visible to the pet? */ - if ((!targ->minvis || perceives(mtmp->data)) && !targ->mundetected) + if ((!targ->minvis || perceives(mtmp->data)) + && !targ->mundetected) break; /* If the pet can't see it, it assumes it aint there */ targ = 0; @@ -807,7 +806,6 @@ struct monst *mtmp, *mtarg; return score; } - STATIC_OVL struct monst * best_target(mtmp) struct monst *mtmp; /* Pet */ @@ -859,7 +857,6 @@ struct monst *mtmp; /* Pet */ return best_targ; } - /* return 0 (no move), 1 (move) or 2 (dead) */ int dog_move(mtmp, after) @@ -1124,7 +1121,7 @@ int after; /* this is extra fast monster movement */ chcnt = 0; chi = i; } - nxti: + nxti: ; } @@ -1139,6 +1136,7 @@ int after; /* this is extra fast monster movement */ /* How hungry is the pet? */ if (!mtmp->isminion) { struct edog *dog = EDOG(mtmp); + hungry = (monstermoves > (dog->hungrytime + 300)); } @@ -1184,7 +1182,7 @@ int after; /* this is extra fast monster movement */ } } -newdogpos: + newdogpos: if (nix != omx || niy != omy) { boolean wasseen; @@ -1256,7 +1254,7 @@ newdogpos: } cc.x = mtmp->mx; cc.y = mtmp->my; - dognext: + dognext: if (!m_in_out_region(mtmp, nix, niy)) return 1; remove_monster(mtmp->mx, mtmp->my); diff --git a/src/end.c b/src/end.c index 73860ace4..ecf71a457 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1554591224 2019/04/06 22:53:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.168 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1557094801 2019/05/05 22:20:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.170 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -500,6 +500,15 @@ int how; } Strcpy(killer.name, buf); + /* + * Chicken and egg issue: + * Ordinarily Unchanging ought to override something like this, + * but the transformation occurs at death. With the current code, + * the effectiveness of Unchanging stops first, but a case could + * be made that it should last long enough to prevent undead + * transformation. (Turning to slime isn't an issue here because + * Unchanging prevents that from happening.) + */ if (mptr->mlet == S_WRAITH) u.ugrave_arise = PM_WRAITH; else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM) diff --git a/src/monmove.c b/src/monmove.c index 942124c28..2f7ae6f5c 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 monmove.c $NHDT-Date: 1545596010 2018/12/23 20:13:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.111 $ */ +/* NetHack 3.6 monmove.c $NHDT-Date: 1557094802 2019/05/05 22:20:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.113 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -541,7 +541,7 @@ register struct monst *mtmp; } } } -toofar: + toofar: /* If monster is nearby you, and has to wield a weapon, do so. This * costs the monster a move, of course. @@ -982,7 +982,7 @@ register int after; if ((likegold || likegems || likeobjs || likemagic || likerock || conceals) && (!*in_rooms(omx, omy, SHOPBASE) || (!rn2(25) && !mtmp->isshk))) { - look_for_obj: + look_for_obj: oomx = min(COLNO - 1, omx + minr); oomy = min(ROWNO - 1, omy + minr); lmx = max(1, omx - minr); @@ -1572,6 +1572,7 @@ register struct monst *mtmp; if (!gotu) { register int try_cnt = 0; + do { if (++try_cnt > 200) goto found_you; /* punt */ @@ -1585,7 +1586,7 @@ register struct monst *mtmp; && (can_ooze(mtmp) || can_fog(mtmp))))) || !couldsee(mx, my)); } else { - found_you: + found_you: mx = u.ux; my = u.uy; } From a08c0ed2ab02f46a55afc8c52988f538c1f43053 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 May 2019 16:56:58 -0700 Subject: [PATCH 8/8] VMS update Long overdue. Install.vms ought to be rewritten from scratch but that will probably never happen. --- sys/vms/Install.vms | 78 ++++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/sys/vms/Install.vms b/sys/vms/Install.vms index dab086cda..420f21537 100644 --- a/sys/vms/Install.vms +++ b/sys/vms/Install.vms @@ -37,7 +37,7 @@ [.sys .os2] -- OS/2 [.sys .share .sounds] -- AIFF format audio files [.sys .unix] -- guess :-) - [.sys .unit .hints] -- configuration data for setup.sh + [.sys .unit .hints] -- configuration data for setup.sh [.sys .wince] -- Windows CE [.sys .wince .ceinc] -- more WinCE [.sys .wince .ceinc .sys] -- ditto @@ -71,18 +71,27 @@ The distributed copy of config.h will work successfully on VMS; vmsconf.h has conditional code to deal with the UNIX-specific items. -4. If you have the programming utilities lex or flex and yacc or bison, - you may edit the procedure [.sys.vms]spec_lev.com and execute it to - process several source files for NetHack's special level and dungeon - compilers. If you use the version of these utilities from the OpenVMS - freeware CD you will have to remove the include that yacc - places at the top of each file. The provided spec_lev.com will default - to copy pre-processed versions of the appropriate files (dgn_lex.c, lev_lex.c, - dgn_yacc.c, lev_yacc.c, dgn_comp.h, and lev_comp.h) from [.sys.share] - into [.util]*.c and [.include]*.h. - If you choose to modify spec_lev.com, you want to run and test your - changes prior to executing vmsbuild.com; otherwise, vmsbuild.com will - do so for you and the results might not be what you expect. +4. vmsbuild.com checks for several source files in [.util] and if it doesn't + find them, it uses [.sys.vms]spec_lev.com to generate them. If you have + the programming utilities lex or flex and yacc or bison, they be will + used if symbols are set up to run them. Or if you have them but do not + have symbols set up, you may edit spec_lev.com to have it run them. + If neither of those situations applies, spec_lev.com will default to + copying pre-genearated versions of the appropriate files (dgn_lex.c, + lev_lex.c, dgn_yacc.c, lev_yacc.c, dgn_comp.h, and lev_comp.h) from + [.sys.share] into [.util]*.c and [.include]*.h. + + Once the file lev_yacc.c is in place, vmsbuild.com won't execute + spec_lev.com to make any of them, so if you decide to modify *_comp.l + and/or *_comp.y then you'll either need to execute spec_lev.com before + vmsbuild.com or remove [.util]lev_yacc.c so vmsbuild.com will do so. + + If you use the versions of the lex and yacc utilities from the OpenVMS + freeware CD, you will need to pass "/Define=_DECC_V4_SOURCE" as the + third argument to vmsbuild.com in step #5. The version of yacc + or bison in that distribution places '#include ' in the + generated code, before nethack's '#include "config.h"', leading to + conflicts that prevent compilation from completing. 5. To build NETHACK.EXE and its auxiliary programs, execute the following DCL command: @@ -138,7 +147,7 @@ Notes: 1. Save files and bones files from 3.4.x and earlier versions will not work with 3.6.2, but save files and bones file from 3.6.0 - and 3.6.1 should work. The scoreboard file (RECORD) from 3.6.0 or + and 3.6.1 should work. The scoreboard file (RECORD) from 3.6.0 or 3.4.x or 3.3.x will work. 2. To specify user-preference options in your environment, define the @@ -212,6 +221,9 @@ Notes: is the preferred way to compile because it's guaranteed to compile and link everything. + [Note: Makefile.* have been updated occasionally but not exercised + for a long time, so might not be in working order.] + 4. termcap is an ASCII data file containing descriptions of terminal capabilities and the escape sequences that software must use to take advantage of them. If you do not already have a termcap file in use @@ -240,7 +252,11 @@ Notes: termcap file, otherwise a message about "Unknown terminal type" will be printed and NetHack will exit. -5. NetHack contains code which attempts to make it secure in case it's +5. Both vmsbuild.com and Makefile.src have provisions to build nethack's + 'curses' interface, but the source code for it won't compile using + the implementation of curses which is supplied with VMS. + +6. NetHack contains code which attempts to make it secure in case it's installed with privileges (to allow the playground to be protected against world write access). This has only undergone limited testing, so install NetHack with privileges at your own risk. If you discover @@ -293,7 +309,7 @@ Notes: built NetHack, you can relink with tracebacks disabled by doing $ @[.SYS.VMS]VMSBUILD "LINK" "" "" "/noTrace/noDebug" -6. If you can't or won't install nethack.exe with privileges and if you +7. If you can't or won't install nethack.exe with privileges and if you don't have access to a privileged account yourself, then if you intend to allow other users to access your copy of NetHack you should probably place an ACL on the playground directory and its save subdirectory. @@ -326,7 +342,7 @@ Notes: you to run recover.exe on behalf of other users, because you won't be able to create files owned by them unless you have elevated privileges. -7. Many NetHack commands can be aborted by sending it the +8. Many NetHack commands can be aborted by sending it the character when it wants input. This is displayed as ESC inside the game. Digital VK201 keyboards (used by VT2xx and VT3xx and older VAXstations) and VK401 keyboards (used by VT4xx, newer VAXstations, @@ -366,16 +382,18 @@ Notes: be sure to remember to eventually reattach to the NetHack subprocess; otherwise the game in progress won't get saved when you logout. -8. NetHack optionally maintains a logfile which receives one line appended +9. NetHack optionally maintains a logfile which receives one line appended to it whenever a game ends. This can be disabled entirely by adding an "#undef LOGFILE" directive to vmsconf.h prior to building the program, or it can be disabled later by removing the file(s) LOGFILE.;* from the playground directory. If not disabled prior to compilation, the logfile can be reinitialized by simply creating an empty file named LOGFILE in the playground, but make sure that users are able - to write into it, or new entries will not be appended. + to write into it, or new entries will not be appended. A somewhat + more elaborate log file named XLOGFILE containing more information is + handled similarly. -9. Some attempt at support for VMS versions earlier than V4.6 has been +10. Some attempt at support for VMS versions earlier than V4.6 has been included, but no such obsolete system was available for testing it. vmsbuild.com detects the need for the extra support routines and arranges automatically for them to be compiled. The reason that @@ -383,7 +401,10 @@ Notes: underwent a major revision for VMS V4.6 and several routines which NetHack utilizes were not available prior to that upgrade. -10. vmsbuild.com collects almost all of the object files (xxx.OBJ) into + [That was written many years ago and the chance of it still working + is very small.] + +11. vmsbuild.com collects almost all of the object files (xxx.OBJ) into an object library (NETHACK.OLB) as it compiles the source files. This should prevent the quota-exceeded problems from the linker that some sites have reported for prior versions. Note that if you @@ -395,7 +416,7 @@ Notes: If you forget to replace the library entry, your newly compiled code will not be included in the new executable image. -11. To access "wizard mode"--intended for debugging purposes, not to +12. To access "wizard mode"--intended for debugging purposes, not to spoil the game with unlimited wishes--you must be running from the username compiled into the game via Local_WIZARD in vmsconf.h, and you must specify "-D" on the command line when invoking NetHack. @@ -405,7 +426,11 @@ Notes: $ @hackdir:nethack "-D" Any character name you specify will be ignored in favor of "wizard". -12. At program startup time, NetHack uses the empty file PERM to prevent + [More out of date information. Rather than compile-time Local_WIZARD, + uses(s) allowed to entre wizard mode are now controlled by the entry + WIZARDS in the file SYSCONF.] + +13. At program startup time, NetHack uses the empty file PERM to prevent two different processes from using the same character name (under the same UIC ownership) at the same time. It does this by temporarily giving that file a second directory entry named PERM.LOCK, then @@ -447,7 +472,7 @@ Notes: is accomplished using temporary entry RECORD.LOCK and LOGFILE using entry LOGFILE.LOCK. -13. Unless you have both Motif and the Athena Widget set from MIT, you +14. Unless you have both Motif and the Athena Widget set from MIT, you will not be able to use the X11 interface on VMS. Even if you do have both those things, such a configuration has not been tested and there are no provisions for it in vmsbuild.com. Makefile.src does @@ -473,14 +498,15 @@ Notes: window manager in order for any changes to take effect; it's easiest to just make the session manager quit and then log in again. -14. If necessary, send problem reports via e-mail to +15. If necessary, send problem reports via e-mail to Always include version information for NetHack, the operating system, and the C compiler used. 20-OCT-2003 minimally updated 9-NOV-2015... +and again 5-MAY-2019... -# NetHack 3.6 Install.vms $NHDT-Date: 1524689427 2018/04/25 20:50:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ +# NetHack 3.6 Install.vms $NHDT-Date: 1557100606 2019/05/05 23:56:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ # Copyright (c) 2003 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details.