From 78a4edcc0f017b00d70299365cdb0814b837ae91 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 3 Aug 2018 20:07:21 -0700 Subject: [PATCH 1/7] suit_simple_name() Unlike cloak_simple_name() and helm_simple_name(), suit_simple_name() wasn't guarding against Null. Current usage never trips up against that, but when I added a new use in doseduce() [pending], it caused a crash. --- src/objnam.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/objnam.c b/src/objnam.c index 7de07963c..b44ddbf2e 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1525012618 2018/04/29 14:36:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.202 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1533352036 2018/08/04 03:07:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.206 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3978,17 +3978,19 @@ struct obj *suit; { const char *suitnm, *esuitp; - if (Is_dragon_mail(suit)) - return "dragon mail"; /* dragon scale mail */ - else if (Is_dragon_scales(suit)) - return "dragon scales"; - suitnm = OBJ_NAME(objects[suit->otyp]); - esuitp = eos((char *) suitnm); - if (strlen(suitnm) > 5 && !strcmp(esuitp - 5, " mail")) - return "mail"; /* most suits fall into this category */ - else if (strlen(suitnm) > 7 && !strcmp(esuitp - 7, " jacket")) - return "jacket"; /* leather jacket */ - /* suit is lame but armor is ambiguous and body armor is absurd */ + if (suit) { + if (Is_dragon_mail(suit)) + return "dragon mail"; /* dragon scale mail */ + else if (Is_dragon_scales(suit)) + return "dragon scales"; + suitnm = OBJ_NAME(objects[suit->otyp]); + esuitp = eos((char *) suitnm); + if (strlen(suitnm) > 5 && !strcmp(esuitp - 5, " mail")) + return "mail"; /* most suits fall into this category */ + else if (strlen(suitnm) > 7 && !strcmp(esuitp - 7, " jacket")) + return "jacket"; /* leather jacket */ + } + /* "suit" is lame but "armor" is ambiguous and "body armor" is absurd */ return "suit"; } From 007aa040b021c1fe4ac04d66e4961789aa892a65 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 3 Aug 2018 20:18:21 -0700 Subject: [PATCH 2/7] fix #H7342 - seduction sequencing Interrupt seduction if the hero gets moved away from the seducer, or if both of them move to another level. Loss of levitation can drop the hero onto a trap which sends him/her somewhere else, but seduction was continuing as if nothing had happened. In theory it could continue despite level change because succubus and incubus are level followers, but there's no way of knowing whether seducer and victim will arrive next to each other until they get delivered and that doesn't happen until long after the attack needs to finish. I don't think theft has the same problem because it is a multi-turn activity operating on one item at a time, but I didn't check it out. --- doc/fixes36.2 | 3 +++ src/mhitu.c | 50 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index e98a9245c..7b1369ddc 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -76,6 +76,9 @@ summary text [for message history] of quest message Pri 00081 (Priest quest success message given when bringing quest artifact to leader) misspelled "congratulations" verbal charm/seduce messages were given even when hero was deaf +succubus/incubus seduction might result in loss of levitation which in turn + could drop the hero onto a trap that transports him/her elsewhere; + seduction was proceeding as if nothing unusual had happened Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/mhitu.c b/src/mhitu.c index 195dc025a..12a6d3212 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -11,7 +11,8 @@ STATIC_VAR NEARDATA struct obj *mon_currwep = (struct obj *) 0; STATIC_DCL boolean FDECL(u_slip_free, (struct monst *, struct attack *)); STATIC_DCL int FDECL(passiveum, (struct permonst *, struct monst *, struct attack *)); -STATIC_DCL void FDECL(mayberem, (const char *, struct obj *, const char *)); +STATIC_DCL void FDECL(mayberem, (struct monst *, const char *, + struct obj *, const char *)); STATIC_DCL boolean FDECL(diseasemu, (struct permonst *)); STATIC_DCL int FDECL(hitmu, (struct monst *, struct attack *)); STATIC_DCL int FDECL(gulpmu, (struct monst *, struct attack *)); @@ -2349,7 +2350,7 @@ struct attack *mattk; return (pagr->mlet == S_NYMPH) ? 2 : 0; } -/* Returns 1 if monster teleported */ +/* returns 1 if monster teleported (or hero leaves monster's vicinity) */ int doseduce(mon) struct monst *mon; @@ -2392,7 +2393,7 @@ struct monst *mon; if (ring->owornmask && uarmg) { /* don't take off worn ring if gloves are in the way */ if (!tried_gloves++) - mayberem(Who, uarmg, "gloves"); + mayberem(mon, Who, uarmg, "gloves"); if (uarmg) continue; /* next ring might not be worn */ } @@ -2422,7 +2423,7 @@ struct monst *mon; if (uarmg) { /* don't put on ring if gloves are in the way */ if (!tried_gloves++) - mayberem(Who, uarmg, "gloves"); + mayberem(mon, Who, uarmg, "gloves"); if (uarmg) break; /* no point trying further rings */ } @@ -2449,14 +2450,25 @@ struct monst *mon; Who, the(xname(ring)), body_part(HAND)); setworn(ring, LEFT_RING); } else if (uright && uright->otyp != RIN_ADORNMENT) { + /* note: the "replaces" message might be inaccurate if + hero's location changes and the process gets interrupted, + but trying to figure that out in advance in order to use + alternate wording is not worth the effort */ pline("%s replaces %s with %s.", Who, yname(uright), yname(ring)); Ring_gone(uright); + /* ring removal might cause loss of levitation which could + drop hero onto trap that transports hero somewhere else */ + if (u.utotype || distu(mon->mx, mon->my) > 2) + return 1; setworn(ring, RIGHT_RING); } else if (uleft && uleft->otyp != RIN_ADORNMENT) { + /* see "replaces" note above */ pline("%s replaces %s with %s.", Who, yname(uleft), yname(ring)); Ring_gone(uleft); + if (u.utotype || distu(mon->mx, mon->my) > 2) + return 1; setworn(ring, LEFT_RING); } else impossible("ring replacement"); @@ -2471,16 +2483,25 @@ struct monst *mon; : naked ? "murmurs sweet nothings into your ear" : "murmurs in your ear", naked ? "" : ", while helping you undress"); - mayberem(Who, uarmc, cloak_simple_name(uarmc)); + mayberem(mon, Who, uarmc, cloak_simple_name(uarmc)); if (!uarmc) - mayberem(Who, uarm, "suit"); - mayberem(Who, uarmf, "boots"); + mayberem(mon, Who, uarm, suit_simple_name(uarm)); + mayberem(mon, Who, uarmf, "boots"); if (!tried_gloves) - mayberem(Who, uarmg, "gloves"); - mayberem(Who, uarms, "shield"); - mayberem(Who, uarmh, helm_simple_name(uarmh)); + mayberem(mon, Who, uarmg, "gloves"); + mayberem(mon, Who, uarms, "shield"); + mayberem(mon, Who, uarmh, helm_simple_name(uarmh)); if (!uarmc && !uarm) - mayberem(Who, uarmu, "shirt"); + mayberem(mon, Who, uarmu, "shirt"); + + /* removing armor (levitation boots, or levitation ring to make + room for adornment ring with incubus case) might result in the + hero falling through a trap door or landing on a teleport trap + and changing location, so hero might not be adjacent to seducer + any more (mayberem() has its own adjacency test so we don't need + to check after each potential removal) */ + if (u.utotype || distu(mon->mx, mon->my) > 2) + return 1; if (uarm || uarmc) { if (!Deaf) @@ -2627,7 +2648,8 @@ struct monst *mon; } STATIC_OVL void -mayberem(seducer, obj, str) +mayberem(mon, seducer, obj, str) +struct monst *mon; const char *seducer; /* only used for alternate message */ struct obj *obj; const char *str; @@ -2636,6 +2658,10 @@ const char *str; if (!obj || !obj->owornmask) return; + /* removal of a previous item might have sent the hero elsewhere + (loss of levitation that leads to landing on a transport trap) */ + if (u.utotype || distu(mon->mx, mon->my) > 2) + return; /* being deaf overrides confirmation prompt for high charisma */ if (Deaf) { From 42b5415d6d05cf061dd0134f5a4c50c7487405ae Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 6 Aug 2018 08:03:46 -0400 Subject: [PATCH 3/7] further OS X clarification --- README | 4 ++-- sys/mac/Install.mw | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README b/README index 391b975fc..156045a71 100644 --- a/README +++ b/README @@ -62,7 +62,7 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. Intel Pentium or better (or clone) running Linux, BSDI, or Windows (7 through 10) Intel 80386 or greater (or clone) boxes running Linux, or BSDI - Mac OS X 10.9 + Mac OS X 10.9 (follow the instructions in sys/unix, not sys/mac) OpenVMS (aka VMS) V8.4 on Alpha and on Integrity/Itanium/IA64 Instructions have been provided by way of community contribution on: @@ -166,6 +166,6 @@ In our own patches, we will assume that your code is synchronized with ours. -- Good luck, and happy Hacking -- -# $NHDT-Date: 1524689604 2018/04/25 20:53:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.42 $ +# $NHDT-Date: 1533557011 2018/08/06 12:03:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.45 $ # Copyright (c) 2012 by Michael Allison # NetHack may be freely redistributed. See license for details. diff --git a/sys/mac/Install.mw b/sys/mac/Install.mw index 4603d52dc..ad8e95017 100644 --- a/sys/mac/Install.mw +++ b/sys/mac/Install.mw @@ -1,5 +1,7 @@ Building a PPC NetHack 3.6 with the Metrowerks compilers +Note: If you are building using any compiler for OS X, use the instructions + in sys/unix. These are old instructions for 68k builds. You must be familiar with the Metrowerks compiler and know how to construct projects. The NetHack source may come with the four pre-made projects that From 469fb27e2fc78a5f206d67974a9c2c92abbf0775 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 6 Aug 2018 17:41:06 -0700 Subject: [PATCH 4/7] 10.11 is out of date these days but it's the most recent version that I can vouch for. --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 156045a71..677f3d300 100644 --- a/README +++ b/README @@ -62,7 +62,7 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. Intel Pentium or better (or clone) running Linux, BSDI, or Windows (7 through 10) Intel 80386 or greater (or clone) boxes running Linux, or BSDI - Mac OS X 10.9 (follow the instructions in sys/unix, not sys/mac) + Mac OS X 10.11 (follow the instructions in sys/unix, not sys/mac) OpenVMS (aka VMS) V8.4 on Alpha and on Integrity/Itanium/IA64 Instructions have been provided by way of community contribution on: @@ -166,6 +166,6 @@ In our own patches, we will assume that your code is synchronized with ours. -- Good luck, and happy Hacking -- -# $NHDT-Date: 1533557011 2018/08/06 12:03:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.45 $ +# $NHDT-Date: 1533602460 2018/08/07 00:41:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.46 $ # Copyright (c) 2012 by Michael Allison # NetHack may be freely redistributed. See license for details. From baf9c706b45ae9a7fdb353e3cb259498c651616c Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 11 Aug 2018 16:07:43 -0700 Subject: [PATCH 5/7] fix github issue #122 - #turn takes 0 time Fixes #122 When #turn won't work due to angry god or being in Gehennom, it aggravates monsters instead. But that was taking no time. --- doc/fixes36.2 | 1 + src/pray.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 7b1369ddc..eea588236 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -79,6 +79,7 @@ verbal charm/seduce messages were given even when hero was deaf succubus/incubus seduction might result in loss of levitation which in turn could drop the hero onto a trap that transports him/her elsewhere; seduction was proceeding as if nothing unusual had happened +#turn command which aggravated monsters did so without using a turn (not a pun) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/pray.c b/src/pray.c index d0cb794ae..8d4c5003d 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1939,12 +1939,12 @@ doturn() pline("For some reason, %s seems to ignore you.", u_gname()); aggravate(); exercise(A_WIS, FALSE); - return 0; + return 1; } if (Inhell) { pline("Since you are in Gehennom, %s won't help you.", u_gname()); aggravate(); - return 0; + return 1; } pline("Calling upon %s, you chant an arcane formula.", u_gname()); exercise(A_WIS, TRUE); From a105df73201bbfcbd77fc162b9423e00856164b9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 12 Aug 2018 08:40:55 -0400 Subject: [PATCH 6/7] inconsistency going down a hole/trapdoor accidentally vs deliberately Noted on rgrn, after being told that you don't fit upon discovery of a hole or trap door you could then immediately use '>' to proceed down. The deliberate situation remains possible and has some inherent risk. --- doc/fixes36.2 | 1 + src/do.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index eea588236..55cde42ad 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -80,6 +80,7 @@ succubus/incubus seduction might result in loss of levitation which in turn could drop the hero onto a trap that transports him/her elsewhere; seduction was proceeding as if nothing unusual had happened #turn command which aggravated monsters did so without using a turn (not a pun) +fix hole/trapdoor passage inconsistency when polymorphed into a giant Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/do.c b/src/do.c index 6bbd8c72b..53a89bc37 100644 --- a/src/do.c +++ b/src/do.c @@ -988,10 +988,29 @@ dodown() return 0; } - if (trap) - You("%s %s.", Flying ? "fly" : locomotion(youmonst.data, "jump"), - trap->ttyp == HOLE ? "down the hole" : "through the trap door"); + if (trap) { + const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through"; + const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump"); + if (youmonst.data->msize >= MZ_HUGE) { + char qbuf[QBUFSZ]; + + You("don't fit %s easily.", down_or_thru); + Sprintf(qbuf, "Try to squeeze %s?", down_or_thru); + if (yn(qbuf) == 'y') { + if (!rn2(3)) { + actn = "manage to squeeze"; + losehp(Maybe_Half_Phys(rnd(4)), + "contusion from a small passage", KILLED_BY); + } else { + You("were unable to fit %s.", down_or_thru); + return 0; + } + } + } + You("%s %s the %s.", actn, down_or_thru, + trap->ttyp == HOLE ? "hole" : "trap door"); + } if (trap && Is_stronghold(&u.uz)) { goto_hell(FALSE, TRUE); } else { From efedd48e7dde6dc22f416b63a27e371f66b3f3e1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 12 Aug 2018 09:06:47 -0400 Subject: [PATCH 7/7] previous change bit --- src/do.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/do.c b/src/do.c index 53a89bc37..8f878af79 100644 --- a/src/do.c +++ b/src/do.c @@ -1006,6 +1006,8 @@ dodown() You("were unable to fit %s.", down_or_thru); return 0; } + } else { + return 0; } } You("%s %s the %s.", actn, down_or_thru,