From 6daa6e2de9d26cccc27104f534e3dd44fbcc8636 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 1 Feb 2019 18:24:23 -0800 Subject: [PATCH 1/3] curing deafness Make healing magic which cures blindness also cure deafness. So, drinking non-cursed potion of healing or any extra healing or full healing; breathing fumes from blessed potion of healing or non-cursed potion of extra healing or any potion of full healing; prayer reward to cure blindness as a minor trouble. (Doesn't affect unicorn horns which already treat deafness and blindness as two distinct troubles that are eligible to be cured.) More of a missing feature than a bug fix, so I listed it in the new features section of the fixes file. --- doc/fixes36.2 | 3 ++- src/potion.c | 8 ++++++-- src/pray.c | 32 +++++++++++++++++++++++++------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 1c5b9edfa..33fca088c 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.242 $ $NHDT-Date: 1548978603 2019/01/31 23:50:03 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.243 $ $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ 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, @@ -547,6 +547,7 @@ in wizard mode, ^T can be preceded by 'm' prefix in order to test teleporting without having wizard mode override various restrictions 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 NetHack Community Patches (or Variation) Included diff --git a/src/potion.c b/src/potion.c index b0c5e5523..7d8afd0ba 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1547518427 2019/01/15 02:13:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1161,6 +1161,8 @@ register boolean curesick, cureblind; mundane 'dirt', but if it doesn't, blindness isn't cured */ u.ucreamed = 0; make_blinded(0L, TRUE); + /* heal deafness too */ + make_deaf(0L, TRUE); } if (curesick) { make_vomiting(0L, TRUE); @@ -1642,8 +1644,10 @@ register struct obj *obj; u.uhp++, context.botl = 1; if (obj->blessed) cureblind = TRUE; - if (cureblind) + if (cureblind) { make_blinded(0L, !u.ucreamed); + make_deaf(0L, TRUE); + } exercise(A_CON, TRUE); break; case POT_SICKNESS: diff --git a/src/pray.c b/src/pray.c index d63778d52..bc9a9ba82 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1540596912 2018/10/26 23:35:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.104 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1549074257 2019/02/02 02:24:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -247,6 +247,11 @@ in_trouble() && (!u.uswallow || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))) return TROUBLE_BLIND; + /* deafness isn't it's own trouble; healing magic cures deafness + when it cures blindness, so do the same with trouble repair */ + if ((HDeaf & TIMEOUT) > 1L) + return TROUBLE_BLIND; + for (i = 0; i < A_MAX; i++) if (ABASE(i) < AMAX(i)) return TROUBLE_POISONED; @@ -513,14 +518,27 @@ int trouble; } (void) encumber_msg(); break; - case TROUBLE_BLIND: { + case TROUBLE_BLIND: { /* handles deafness as well as blindness */ + char msgbuf[BUFSZ]; const char *eyes = body_part(EYE); + boolean cure_deaf = (HDeaf & TIMEOUT) ? TRUE : FALSE; - if (eyecount(youmonst.data) != 1) - eyes = makeplural(eyes); - Your("%s %s better.", eyes, vtense(eyes, "feel")); - u.ucreamed = 0; - make_blinded(0L, FALSE); + msgbuf[0] = '\0'; + if (Blinded) { + if (eyecount(youmonst.data) != 1) + eyes = makeplural(eyes); + Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel")); + u.ucreamed = 0; + make_blinded(0L, FALSE); + } + if (cure_deaf) { + make_deaf(0L, FALSE); + if (!Deaf) + Sprintf(eos(msgbuf), "%s can hear again", + !*msgbuf ? "You" : " and you"); + } + if (*msgbuf) + pline("%s.", msgbuf); break; } case TROUBLE_WOUNDED_LEGS: From b43b3f617c0a4c62f6882a81a6e45141cf33308a Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 1 Feb 2019 18:40:45 -0800 Subject: [PATCH 2/3] object classes for wizard mode identify When ^I was changed to allow picking more than one item to make its temporary identification become persistent, group accelators got left out. So to pick all potions, you needed to select them letter by letter (or via '.' to select everything, then deselect non-potions letter by letter). Now you can use '!' to select all potions. --- doc/fixes36.2 | 3 ++- src/invent.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 33fca088c..8bca59c53 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.243 $ $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.244 $ $NHDT-Date: 1549075239 2019/02/02 02:40:39 $ 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, @@ -372,6 +372,7 @@ orctown: orcs beyond the mines were being given any left-over booty and named as part of the same marauding gang operating within the mines make long extended commands list be more navigable simplify #wizidentify; don't rely on having bold menu entries +add object class group accelerators to #wizidentify ensure tmp_at() structures are initialized for all code paths when swallowed trapped-vs-levitation/flying change broke Sting releasing hero from web life-saving while poly'd and Unchanging wasn't restoring u.mh (HP as monster) diff --git a/src/invent.c b/src/invent.c index 01250e1af..3d502673f 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1547025166 2019/01/09 09:12:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.250 $ */ +/* 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 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2692,7 +2692,8 @@ long *out_cnt; else any.a_char = ilet; add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet, - 0, ATR_NONE, doname(otmp), MENU_UNSELECTED); + wizid ? def_oc_syms[(int) otmp->oclass].sym : 0, + ATR_NONE, doname(otmp), MENU_UNSELECTED); } } if (flags.sortpack) { From 7cc718ea0ea913be3ca99bf21e89f047f4307053 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 2 Feb 2019 17:37:06 -0800 Subject: [PATCH 3/3] fix #H7173 / github #101 - vault exit Fixes #101 If you tell the vault guard your name, drop carried gold, wait one turn, then pick up the gold again, the guard will move a step away during the wait. If you teleport away, the guard will seal vault walls and then park himself on the one-square (so far) temporary corridor adjacent to the vault wall. Periodically he'll say "Move along!" and the hero will hear it, regardless of location on the level. Unless you dig a corridor to rescue him, or one or more of the vault's walls get breached again, he will never move. The report emphasized that you could use this to steal the vault's gold, but it relies on being able to teleport beyond the gaurd's reach and if you can do that, you might as well do so before the guard comes. The stranded guard, and him saying "Move along!" when no longer leading hero out of the vault, are more significant bugs. Bonus fix: if the game ends and the guard seals up the vault while the hero is in a spot that gets fixed up (vault wall or temporary corridor) don't give the "You are encased in the rock" message if game end was due to death rather than quit. --- doc/fixes36.2 | 8 +++++++- include/extern.h | 4 +++- src/hack.c | 8 ++++---- src/teleport.c | 18 +++++++++++++++++- src/vault.c | 35 +++++++++++++++++++++++++++++++---- 5 files changed, 62 insertions(+), 11 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 8bca59c53..ea3ce46a2 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.244 $ $NHDT-Date: 1549075239 2019/02/02 02:40:39 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.245 $ $NHDT-Date: 1549157810 2019/02/03 01:36:50 $ 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, @@ -359,6 +359,12 @@ monster with multiple items in inventory could trigger 'dealloc_obj with nobj' panic when turned into a statue if separate mon->minvent items merged lock picking context could end up with stale container pointer if container being forced/unlocked/locked got destroyed or sent to another level +teleporting out a vault after guard appears could result in the guard being + stranded in a one-square long temporary corridor adjacent to vault + wall and periodically saying "Move along!" +if game ends while hero is in a vault wall breach or in guard's temporary + corridor, a message "you are encased in the rock" could be given when + guard repairs things (for possible bones); suppress it if hero is dead Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 47f38254a..af0e6147f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1548982186 2019/02/01 00:49:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.691 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1549157811 2019/02/03 01:36:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.692 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2586,8 +2586,10 @@ E int FDECL(hide_privileges, (BOOLEAN_P)); E void FDECL(newegd, (struct monst *)); E void FDECL(free_egd, (struct monst *)); E boolean FDECL(grddead, (struct monst *)); +E struct monst *NDECL(findgd); E void NDECL(vault_summon_gd); E char FDECL(vault_occupied, (char *)); +E void FDECL(uleftvault, (struct monst *)); E void NDECL(invault); E int FDECL(gd_move, (struct monst *)); E void NDECL(paygd); diff --git a/src/hack.c b/src/hack.c index a42334c92..c925e2c49 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1546656413 2019/01/05 02:46:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.203 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1549157812 2019/02/03 01:36:52 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.206 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2269,9 +2269,9 @@ register int typewanted; int typefound, min_x, min_y, max_x, max_y_offset, step; register struct rm *lev; -#define goodtype(rno) \ - (!typewanted \ - || (typefound = rooms[rno - ROOMOFFSET].rtype) == typewanted \ +#define goodtype(rno) \ + (!typewanted \ + || (typefound = (rooms[rno - ROOMOFFSET].rtype == typewanted)) != 0 \ || (typewanted == SHOPBASE && typefound > SHOPBASE)) switch (rno = levl[x][y].roomno) { diff --git a/src/teleport.c b/src/teleport.c index fb99e6331..488e4477b 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 teleport.c $NHDT-Date: 1546655319 2019/01/05 02:28:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.83 $ */ +/* NetHack 3.6 teleport.c $NHDT-Date: 1549157815 2019/02/03 01:36:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -252,6 +252,7 @@ register int nux, nuy; boolean allow_drag; { boolean ball_active, ball_still_in_range; + struct monst *vault_guard = vault_occupied(u.urooms) ? findgd() : 0; if (u.utraptype == TT_BURIEDBALL) { /* unearth it */ @@ -354,6 +355,21 @@ boolean allow_drag; else telescroll = 0; /* no discovery by scrolltele()'s caller */ } + /* sequencing issue: we want guard's alarm, if any, to occur before + room entry message, if any, so need to check for vault exit prior + to spoteffects; but spoteffects() sets up new value for u.urooms + and vault code depends upon that value, so we need to fake it */ + if (vault_guard) { + char save_urooms[5]; /* [sizeof u.urooms] */ + + Strcpy(save_urooms, u.urooms); + Strcpy(u.urooms, in_rooms(u.ux, u.uy, VAULT)); + /* if hero has left vault, make guard notice */ + if (!vault_occupied(u.urooms)) + uleftvault(vault_guard); + Strcpy(u.urooms, save_urooms); /* reset prior to spoteffects() */ + } + /* possible shop entry message comes after guard's shrill whistle */ spoteffects(TRUE); invocation_message(); } diff --git a/src/vault.c b/src/vault.c index 3945f215d..669cc52e3 100644 --- a/src/vault.c +++ b/src/vault.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 vault.c $NHDT-Date: 1545269451 2018/12/20 01:30:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 vault.c $NHDT-Date: 1549157816 2019/02/03 01:36:56 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,7 +10,6 @@ STATIC_DCL void FDECL(blackout, (int, int)); STATIC_DCL void FDECL(restfakecorr, (struct monst *)); STATIC_DCL void FDECL(parkguard, (struct monst *)); STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int)); -STATIC_DCL struct monst *NDECL(findgd); STATIC_DCL boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *)); STATIC_DCL void FDECL(move_gold, (struct obj *, int)); STATIC_DCL void FDECL(wallify_vault, (struct monst *)); @@ -104,7 +103,9 @@ boolean forceshow; } if (sawcorridor) pline_The("corridor disappears."); - if (IS_ROCK(levl[u.ux][u.uy].typ)) + /* only give encased message if hero is still alive (might get here + via paygd() when game is over; died: no message, quit: message) */ + if (IS_ROCK(levl[u.ux][u.uy].typ) && (Upolyd ? u.mh : u.uhp) > 0) You("are encased in rock."); return TRUE; } @@ -199,7 +200,6 @@ int x, y; return FALSE; } -STATIC_OVL struct monst * findgd() { @@ -233,6 +233,33 @@ char *array; return '\0'; } +/* hero has teleported out of vault while a guard is active */ +void +uleftvault(grd) +struct monst *grd; +{ + /* only called if caller has checked vault_occupied() and findgd() */ + if (!grd || !grd->isgd || DEADMONSTER(grd)) { + impossible("escaping vault without guard?"); + return; + } + /* if carrying gold and arriving anywhere other than next to the guard, + set the guard loose */ + if ((money_cnt(invent) || hidden_gold()) + && um_dist(grd->mx, grd->my, 1)) { + if (grd->mpeaceful) { + if (canspotmon(grd)) /* see or sense via telepathy */ + pline("%s becomes irate.", Monnam(grd)); + grd->mpeaceful = 0; /* bypass setmangry() */ + } + /* if arriving outside guard's temporary corridor, give the + guard an extra move to deliver message(s) and to teleport + out of and remove that corridor */ + if (!in_fcorridor(grd, u.ux, u.uy)) + (void) gd_move(grd); + } +} + STATIC_OVL boolean find_guard_dest(guard, rx, ry) struct monst *guard;