diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 2f9e17bb0..36ff94c78 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -4584,7 +4584,7 @@ Allowed colors are {\it black}, {\it red}, {\it green}, {\it brown}, {\it blue}, {\it magenta}, {\it cyan}, {\it gray}, {\it orange}, {\it light-green}, {\it yellow}, {\it light-blue}, {\it light-magenta}, {\it light-cyan}, and {\it white}. -And {\itno-color}, the default foreground color, which isn't necessarily +And {\it no-color}, the default foreground color, which isn't necessarily the same as any of the other colors. %.lp "" @@ -4675,9 +4675,9 @@ the hitpoints field to display in the color red if your hitpoints drop to or below a threshold of 30%:\\ \begin{verbatim} OPTION=hilite_status:hitpoints/<=30%/red/normal -\end{verbatim}\\ -(That example is actually specifying {\tt red\&normal} for <=30\% -and {\tt no-color\&normal} for >30\%.)\\ +\end{verbatim} +(That example is actually specifying {\tt red\&normal} for {\tt <=30\%} +and {\tt no-color\&normal} for {\tt >30\%}.)\\ For another example, the following line in your configuration file will cause wisdom to be displayed red if it drops and green if it rises:\\ diff --git a/doc/fixes36.2 b/doc/fixes36.2 index f234f0776..dee7ce01d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.300 $ $NHDT-Date: 1554841009 2019/04/09 20:16:49 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.303 $ $NHDT-Date: 1555201701 2019/04/14 00:28:21 $ 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, @@ -409,6 +409,8 @@ once a status highlight for a temporary rule ('up', 'down', 'changed') timed if a migrating long worm couldn't be placed, or some other monster was given an existing long worm's place and it couldn't be put somewhere else, a "trying to place monster at <0,0>" warning would occur +if hero throws a pick-axe into a shop and shopkeeper catches it, shk will say + "get out of my way, scum" even if there's no monster at pick-axe spot Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository @@ -465,6 +467,8 @@ when engulfed while in a shop, dropping an item into the engulfer and then using ':' to look at current location could cause a crash when items were on the floor just inside a shop's door where the shopkeeper doesn't buy and sell stuff, those items showed a 'for sale' price +probing a monster inside a shop (including shopkeeper) showed 'for sale' + price for items in monster's minvent applying a container while inside a shop and initiating a put-in operation would show non-empty containers in inventory--including the one being applied--with "for sale" amounts for the prices of their contents @@ -681,6 +685,7 @@ include isaac64 for pseudo random number generation core prng and display prng use different contexts when healing magic other than unicorn horn cures blindness, cure deafness too do less status updating when the 'time' option is on +slightly more thorough feedback when shop damage is repaired in hero's presence curses: status display substantially revamped for both horizontal (via 'align_status:bottom' or 'top') and vertical (via 'align_status:left' or 'right'); 3-line horizontal layout (via 'statuslines:3') added diff --git a/include/extern.h b/include/extern.h index ee4731ad3..67f8e3ee1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1554857123 2019/04/10 00:45:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.700 $ */ +/* 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 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1411,7 +1411,7 @@ E void FDECL(mon_to_stone, (struct monst *)); E void FDECL(m_into_limbo, (struct monst *)); E void FDECL(mnexto, (struct monst *)); E void FDECL(maybe_mnexto, (struct monst *)); -E boolean FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); +E int FDECL(mnearto, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P)); E void FDECL(m_respond, (struct monst *)); E void FDECL(setmangry, (struct monst *, BOOLEAN_P)); E void FDECL(wakeup, (struct monst *, BOOLEAN_P)); @@ -2247,7 +2247,8 @@ E void FDECL(sellobj, (struct obj *, XCHAR_P, XCHAR_P)); E int FDECL(doinvbill, (int)); E struct monst *FDECL(shkcatch, (struct obj *, XCHAR_P, XCHAR_P)); E void FDECL(add_damage, (XCHAR_P, XCHAR_P, long)); -E int FDECL(repair_damage, (struct monst *, struct damage *, BOOLEAN_P)); +E int FDECL(repair_damage, (struct monst *, struct damage *, int *, + BOOLEAN_P)); E int FDECL(shk_move, (struct monst *)); E void FDECL(after_shk_move, (struct monst *)); E boolean FDECL(is_fshk, (struct monst *)); diff --git a/src/invent.c b/src/invent.c index 3d502673f..ff69de77e 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1549075239 2019/02/02 02:40:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.252 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1555196229 2019/04/13 22:57:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.253 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4303,12 +4303,17 @@ char *title; * displaying 'weapon in claw', etc. properly. */ youmonst.data = mon->data; + /* in case inside a shop, don't append "for sale" prices */ + iflags.suppress_price++; n = query_objlist(title ? title : tmp, &(mon->minvent), (INVORDER_SORT | (incl_hero ? INCLUDE_HERO : 0)), &selected, pickings, do_all ? allow_all : worn_wield_only); - set_uasmon(); + + iflags.suppress_price--; + /* was 'set_uasmon();' but that potentially has side-effects */ + youmonst.data = &mons[u.umonnum]; /* most basic part of set_uasmon */ } else { invdisp_nothing(title ? title : tmp, "(none)"); n = 0; diff --git a/src/mkmaze.c b/src/mkmaze.c index 863502baf..1b3959315 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkmaze.c $NHDT-Date: 1543185071 2018/11/25 22:31:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */ +/* NetHack 3.6 mkmaze.c $NHDT-Date: 1555022325 2019/04/11 22:38:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.68 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1878,6 +1878,7 @@ boolean ini; case CONS_MON: { struct monst *mon = (struct monst *) cons->list; + (void) mnearto(mon, cons->x, cons->y, TRUE); break; } diff --git a/src/mon.c b/src/mon.c index d0a422f60..b3c1abaf3 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1554580625 2019/04/06 19:57:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.280 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1555022326 2019/04/11 22:38:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.281 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2636,10 +2636,15 @@ struct monst *mtmp; /* mnearto() * Put monster near (or at) location if possible. * Returns: - * true if relocation was successful - * false otherwise + * 2 if another monster was moved out of this one's way; + * 1 if relocation was successful (without moving another one); + * 0 otherwise. + * Note: if already at the target spot, result is 1 rather than 0. + * + * Might be called recursively if 'move_other' is True; if so, that argument + * will be False on the nested call so there won't be any further recursion. */ -boolean +int mnearto(mtmp, x, y, move_other) register struct monst *mtmp; xchar x, y; @@ -2648,15 +2653,18 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ struct monst *othermon = (struct monst *) 0; xchar newx, newy; coord mm; + int res = 1; if (mtmp->mx == x && mtmp->my == y && m_at(x, y) == mtmp) - return TRUE; + return res; if (move_other && (othermon = m_at(x, y)) != 0) { if (othermon->wormno) remove_worm(othermon); else remove_monster(x, y); + + othermon->mx = othermon->my = 0; /* 'othermon' is not on the map */ } newx = x; @@ -2667,28 +2675,21 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ * no end of trouble. */ if (!enexto(&mm, newx, newy, mtmp->data)) - return FALSE; + return 0; if (!isok(mm.x, mm.y)) - return FALSE; + return 0; newx = mm.x; newy = mm.y; } rloc_to(mtmp, newx, newy); if (move_other && othermon) { - xchar oldx = othermon->mx, oldy = othermon->my; - - othermon->mx = othermon->my = 0; - (void) mnearto(othermon, x, y, FALSE); - if (othermon->mx == 0 && othermon->my == 0) { - /* reloc failed */ - othermon->mx = oldx; - othermon->my = oldy; + res = 2; /* moving another monster out of the way */ + if (!mnearto(othermon, x, y, FALSE)) /* no 'move_other' this time */ m_into_limbo(othermon); - } } - return TRUE; + return res; } /* monster responds to player action; not the same as a passive attack; diff --git a/src/restore.c b/src/restore.c index e9f25d72c..4f19ed878 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 restore.c $NHDT-Date: 1543972193 2018/12/05 01:09:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.128 $ */ +/* NetHack 3.6 restore.c $NHDT-Date: 1555201698 2019/04/14 00:28:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.129 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -192,7 +192,7 @@ boolean ghostly; struct monst *shkp = shop_keeper(*shp); if (shkp && inhishop(shkp) - && repair_damage(shkp, tmp_dam, TRUE)) + && repair_damage(shkp, tmp_dam, (int *) 0, TRUE)) break; } } diff --git a/src/shk.c b/src/shk.c index ef5bc0206..1817d9bec 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1551738135 2019/03/04 22:22:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1555201699 2019/04/14 00:28:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3397,7 +3397,7 @@ register xchar x, y; && dist2(shkp->mx, shkp->my, x, y) < 3 /* if it is the shk's pos, you hit and anger him */ && (shkp->mx != x || shkp->my != y)) { - if (mnearto(shkp, x, y, TRUE) && !Deaf && !muteshk(shkp)) + if (mnearto(shkp, x, y, TRUE) == 2 && !Deaf && !muteshk(shkp)) verbalize("Out of my way, scum!"); if (cansee(x, y)) { pline("%s nimbly%s catches %s.", Shknam(shkp), @@ -3469,11 +3469,13 @@ struct monst *shkp; boolean croaked; { struct damage *tmp_dam, *tmp2_dam; + struct obj *shk_inv = shkp->minvent; boolean did_repair = FALSE, saw_door = FALSE, saw_floor = FALSE, - stop_picking = FALSE, doorway_trap = FALSE; - int saw_walls = 0, saw_untrap = 0; + stop_picking = FALSE, doorway_trap = FALSE, skip_msg = FALSE; + int saw_walls = 0, saw_untrap = 0, feedback; char trapmsg[BUFSZ]; + feedback = !croaked; /* 1 => give feedback, 0 => don't or already did */ tmp_dam = level.damagelist; tmp2_dam = 0; while (tmp_dam) { @@ -3491,12 +3493,12 @@ boolean croaked; if (croaked) { disposition = (shops[1]) ? 0 : 1; } else if (stop_picking) { - disposition = repair_damage(shkp, tmp_dam, FALSE); + disposition = repair_damage(shkp, tmp_dam, &feedback, FALSE); } else { /* Defer the stop_occupation() until after repair msgs */ if (closed_door(x, y)) stop_picking = picking_at(x, y); - disposition = repair_damage(shkp, tmp_dam, FALSE); + disposition = repair_damage(shkp, tmp_dam, &feedback, FALSE); if (!disposition) stop_picking = FALSE; } @@ -3539,7 +3541,16 @@ boolean croaked; if (!did_repair) return; - if (saw_untrap) { + trapmsg[0] = '\0'; /* not just lint suppression... */ + shk_inv = (shkp->minvent != shk_inv) ? shkp->minvent : 0; + if (saw_untrap == 1 && shk_inv + && (shk_inv->otyp == BEARTRAP || shk_inv->otyp == LAND_MINE) + && canseemon(shkp)) { + pline("%s untraps %s.", Shknam(shkp), ansimpleoname(shk_inv)); + /* we've already reported this trap (and know it's the only one) */ + saw_untrap = 0; + skip_msg = !(saw_walls || saw_door || saw_floor); + } else if (saw_untrap) { Sprintf(trapmsg, "%s trap%s", (saw_untrap > 3) ? "several" : (saw_untrap > 1) ? "some" : "a", @@ -3547,10 +3558,11 @@ boolean croaked; Sprintf(eos(trapmsg), " %s", vtense(trapmsg, "are")); Sprintf(eos(trapmsg), " removed from the %s", (doorway_trap && saw_untrap == 1) ? "doorway" : "floor"); - } else - trapmsg[0] = '\0'; /* not just lint suppression... */ + } - if (saw_walls) { + if (skip_msg) { + ; /* already gave an untrap message which covered the only repair */ + } else if (saw_walls) { char wallbuf[BUFSZ]; Sprintf(wallbuf, "section%s", plur(saw_walls)); @@ -3572,6 +3584,10 @@ boolean croaked; saw_floor ? "the floor damage is gone" : "", ((saw_door || saw_floor) && *trapmsg) ? " and " : "", trapmsg); + /* FIXME: + * these messages aren't right if the unseen repairs were only + * for trap removal (except for hole and possibly trap door). + */ else if (inside_shop(u.ux, u.uy) == ESHK(shkp)->shoproom) You_feel("more claustrophobic than before."); else if (!Deaf && !rn2(10)) @@ -3586,9 +3602,10 @@ boolean croaked; * 3: untrap */ int -repair_damage(shkp, tmp_dam, catchup) +repair_damage(shkp, tmp_dam, once, catchup) struct monst *shkp; struct damage *tmp_dam; +int *once; boolean catchup; /* restoring a level */ { xchar x, y; @@ -3607,13 +3624,30 @@ boolean catchup; /* restoring a level */ if (!IS_ROOM(tmp_dam->typ)) { if ((x == u.ux && y == u.uy && !Passes_walls) || (x == shkp->mx && y == shkp->my) - || ((mtmp = m_at(x, y)) && !passes_walls(mtmp->data))) + || ((mtmp = m_at(x, y)) != 0 && !passes_walls(mtmp->data))) return 0; } - if ((ttmp = t_at(x, y)) != 0) { - if (x == u.ux && y == u.uy && !Passes_walls) - return 0; - if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) { + ttmp = t_at(x, y); + if (ttmp && x == u.ux && y == u.uy && !Passes_walls) + return 0; + + if (once && *once) { + boolean shk_closeby = (distu(shkp->mx, shkp->my) + <= (BOLT_LIM / 2) * (BOLT_LIM / 2)); + + /* this is suboptimal if we eventually give a "shk untraps" + message for the only repair, but perhaps the shop repair + incantation means that shk's untrap attempt will never fail */ + if (canseemon(shkp)) + pline("%s whispers %s.", Shknam(shkp), + shk_closeby ? "an incantation" : "something"); + else if (!Deaf && shk_closeby) + You_hear("someone muttering an incantation."); + *once = 0; + } + if (ttmp) { + if ((ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) + && dist2(x, y, shkp->mx, shkp->my) <= 2) { /* convert to an object */ otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP, TRUE, FALSE);