From abdec86a3d1147130bf5ae7bce2436f6ff2f972b Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 14 Nov 2019 12:56:08 -0800 Subject: [PATCH 1/3] fix #H9425 - shade_miss target Fix 'unused' variable by using it as intended. Thinko brought on by too many revisions... --- src/uhitm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uhitm.c b/src/uhitm.c index a95595548..2eedb184f 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1573688694 2019/11/13 23:44:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.214 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1573764936 2019/11/14 20:55:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.215 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1375,17 +1375,17 @@ boolean thrown, verbose; if (verbose && ((youdef || cansee(mdef->mx, mdef->my) || sensemon(mdef)) || (magr == &youmonst && distu(mdef->mx, mdef->my) <= 2))) { - static const char harmless[] = " harmlessly through "; + static const char harmlessly_thru[] = " harmlessly through "; what = (!obj || shade_aware(obj)) ? "attack" : cxname(obj); target = youdef ? "you" : mon_nam(mdef); if (!thrown) { whose = youagr ? "Your" : s_suffix(Monnam(magr)); pline("%s %s %s%s%s.", whose, what, - vtense(what, "pass"), harmless, mon_nam(mdef)); + vtense(what, "pass"), harmlessly_thru, target); } else { pline("%s %s%s%s.", The(what), /* note: not pline_The() */ - vtense(what, "pass"), harmless, mon_nam(mdef)); + vtense(what, "pass"), harmlessly_thru, target); } if (!youdef && !canspotmon(mdef)) map_invisible(mdef->mx, mdef->my); From 501541635a77fc5692dc9d0b3c9d138c2478571b Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 14 Nov 2019 14:18:59 -0800 Subject: [PATCH 2/3] fix #H9426 - curses_procs null stubs --- win/curses/cursmain.c | 45 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index e0b69b42c..6cf98fcb2 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -24,6 +24,15 @@ extern char erase_char, kill_char; extern long curs_mesg_suppress_turn; /* from cursmesg.c */ +/* stubs for curses_procs{} */ +#ifdef POSITIONBAR +static void dummy_update_position_bar(char *); +#endif +#ifdef CHANGE_COLOR +static void dummy_change_color(int, long, int); +static char *dummy_get_color_string(VOID_ARGS); +#endif + /* Public functions for curses NetHack interface */ /* Interface definition, for windows.c */ @@ -69,7 +78,7 @@ struct window_procs curses_procs = { curses_cliparound, #endif #ifdef POSITIONBAR - donull, + dummy_update_position_bar, #endif curses_print_glyph, curses_raw_print, @@ -83,9 +92,13 @@ struct window_procs curses_procs = { curses_get_ext_cmd, curses_number_pad, curses_delay_output, -#ifdef CHANGE_COLOR /* only a Mac option currently */ - donull, - donull, +#ifdef CHANGE_COLOR + dummy_change_color, +#ifdef MAC /* old OS 9, not OSX */ + (void (*)(int)) 0, + (short (*)(winid, char *)) 0, +#endif + dummy_get_color_string, #endif curses_start_screen, curses_end_screen, @@ -945,4 +958,28 @@ curs_reset_windows(boolean redo_main, boolean redo_status) } } +/* stubs for curses_procs{} */ + +#ifdef POSITIONBAR +static void +dummy_update_position_bar(char *arg UNUSED) +{ + return; +} +#endif + +#ifdef CHANGE_COLOR +static void +dummy_change_color(int a1 UNUSED, long a2 UNUSED, int a3 UNUSED) +{ + return; +} + +static char * +dummy_get_color_string(VOID_ARGS) +{ + return (char *) 0; +} +#endif + /*cursmain.c*/ From 5abf64adaf2e30b626f89e4e1ef5b7579b08a094 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 14 Nov 2019 15:28:32 -0800 Subject: [PATCH 3/3] fix #H9424 - mon vs shade damage despite harmless Monster vs monster non-weapon attack against a shade that failed due to non-silver and non-blessed hit was inflicting damage. --- doc/fixes36.3 | 3 ++- src/mhitm.c | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 25d065ddd..9fdefdb20 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.172 $ $NHDT-Date: 1573688684 2019/11/13 23:44:44 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.174 $ $NHDT-Date: 1573773953 2019/11/14 23:25:53 $ 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, @@ -252,6 +252,7 @@ in symset:curses, symbol S_tree was accidentally set to horizontal line where percentage highlighting for Xp broke up/down/changed highlighting for it; it was flagged as having gone up every time the percentage changed deaf change to zap_over_floor needed to be restricted to player actions only +monster vs shade attack inflicted damage despite "passes harmlessly through" curses: sometimes the message window would show a blank line after a prompt curses: the change to show map in columns 1..79 instead of 2..80 made the highlight for '@' show up in the wrong place if clipped map had been diff --git a/src/mhitm.c b/src/mhitm.c index c69597227..5d33df493 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitm.c $NHDT-Date: 1573688692 2019/11/13 23:44:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */ +/* NetHack 3.6 mhitm.c $NHDT-Date: 1573773926 2019/11/14 23:25:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -411,9 +411,9 @@ register struct monst *magr, *mdef; || mdef->data == &mons[PM_BROWN_PUDDING]) && (otmp && (objects[otmp->otyp].oc_material == IRON || objects[otmp->otyp].oc_material == METAL)) - && mdef->mhp > 1 - && !mdef->mcan) { + && mdef->mhp > 1 && !mdef->mcan) { struct monst *mclone; + if ((mclone = clone_mon(mdef, 0, 0)) != 0) { if (vis && canspotmon(mdef)) { char buf[BUFSZ]; @@ -455,6 +455,13 @@ register struct monst *magr, *mdef; break; case AT_ENGL: + if (mdef->data == &mons[PM_SHADE]) { /* no silver teeth... */ + if (vis) + pline("%s attempt to engulf %s is futile.", + s_suffix(Monnam(magr)), mon_nam(mdef)); + strike = 0; + break; + } if (u.usteed && mdef == u.usteed) { strike = 0; break; @@ -572,7 +579,9 @@ struct attack *mattk; mdef->mcansee ? "smiles at" : "talks to"); pline("%s %s %s.", buf, mon_nam(mdef), compat == 2 ? "engagingly" : "seductively"); - } else if (!shade_miss(magr, mdef, otmp, FALSE, TRUE)) { + } else if (shade_miss(magr, mdef, otmp, FALSE, TRUE)) { + return MM_MISS; /* bypass mdamagem() */ + } else { char magr_name[BUFSZ]; Strcpy(magr_name, Monnam(magr)); @@ -851,11 +860,12 @@ mdamagem(magr, mdef, mattk) register struct monst *magr, *mdef; register struct attack *mattk; { - struct obj *obj; + struct obj *obj, dmgwep; char buf[BUFSZ]; struct permonst *pa = magr->data, *pd = mdef->data; - int armpro, num, tmp = d((int) mattk->damn, (int) mattk->damd), - res = MM_MISS; + int armpro, num, + tmp = d((int) mattk->damn, (int) mattk->damd), + res = MM_MISS; boolean cancelled; if ((touch_petrifies(pd) /* or flesh_petrifies() */ @@ -958,16 +968,19 @@ register struct attack *mattk; case AD_HEAL: case AD_PHYS: physical: - if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { + /* this shade check is necessary in case any attacks which + dish out physical damage bypass hitmm() to get here */ + if ((mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW) && otmp) + dmgwep = *otmp; + else + dmgwep = zeroobj; + + if (shade_miss(magr, mdef, &dmgwep, FALSE, TRUE)) { + tmp = 0; + } else if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { tmp = 0; } else if (mattk->aatyp == AT_WEAP || (mattk->aatyp == AT_CLAW && otmp)) { - if (mdef->data == &mons[PM_SHADE] - && !(otmp && objects[otmp->otyp].oc_material == SILVER)) { - /* "passes harmlessly through" given by hitmm() */ - tmp = 0; - break; - } if (otmp) { struct obj *marmg;