From a6ff7210be83aa138944095d64a9bd600f74d568 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 Feb 2019 13:17:14 -0800 Subject: [PATCH 1/4] fix #H8215 - monster intrinsics from worn gear Fixes #177 The monst struct has 'mintrinsics' field which attempts to handle both mon->data->mresists and extrinsics supplied by worn armor, but polymorph/shape-change was clobbering the extrinsics side of things. Potentially fixing that by changing newcham() to use set_mon_data(...,1) instead of (...,0) solved that but exposed two other bugs. Intrinsics from the old form carried over to the new form along with extrinsics from worn armor, and update_mon_intrinsics() for armor being destroyed or dropped only worked as intended if the armor->owornmask was cleared beforehand--some places were clearing it after, so extrinsics from worn gear could persist even after that gear was gone. So, fixing the set_mon_data() call in newcham() was a no go. This fixes update_mon_intrinsics() and adopts the suggested code from github pull request #177 to have mon->mintrinsics only handle worn gear instead of trying to overload innate intrinsics with that. This is a superset of that; the flag argument to set_mon_data() is gone and mon->mintrinsics has been renamed mon->mextrinsics. (The routine update_mon_intrinsics() ought to be renamed too, but I didn't do that.) --- include/extern.h | 4 ++-- include/mondata.h | 26 +++++++++++++++++--------- include/monst.h | 4 ++-- src/makemon.c | 8 ++++---- src/mon.c | 12 ++++++------ src/mondata.c | 12 ++---------- src/mplayer.c | 4 ++-- src/polyself.c | 4 ++-- src/sp_lev.c | 4 ++-- src/teleport.c | 4 ++-- src/were.c | 4 ++-- src/worn.c | 30 ++++++++++++++---------------- 12 files changed, 57 insertions(+), 59 deletions(-) diff --git a/include/extern.h b/include/extern.h index 5160007ba..a908a0432 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1549921169 2019/02/11 21:39:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.693 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1550524545 2019/02/18 21:15:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.694 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1437,7 +1437,7 @@ E boolean FDECL(vamp_stone, (struct monst *)); /* ### mondata.c ### */ -E void FDECL(set_mon_data, (struct monst *, struct permonst *, int)); +E void FDECL(set_mon_data, (struct monst *, struct permonst *)); E struct attack *FDECL(attacktype_fordmg, (struct permonst *, int, int)); E boolean FDECL(attacktype, (struct permonst *, int)); E boolean FDECL(noattacks, (struct permonst *)); diff --git a/include/mondata.h b/include/mondata.h index dc7fba275..d8c3511b2 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.h $NHDT-Date: 1548209737 2019/01/23 02:15:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $ */ +/* NetHack 3.6 mondata.h $NHDT-Date: 1550524558 2019/02/18 21:15:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.37 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,14 +10,22 @@ #define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0) -#define resists_fire(mon) (((mon)->mintrinsics & MR_FIRE) != 0) -#define resists_cold(mon) (((mon)->mintrinsics & MR_COLD) != 0) -#define resists_sleep(mon) (((mon)->mintrinsics & MR_SLEEP) != 0) -#define resists_disint(mon) (((mon)->mintrinsics & MR_DISINT) != 0) -#define resists_elec(mon) (((mon)->mintrinsics & MR_ELEC) != 0) -#define resists_poison(mon) (((mon)->mintrinsics & MR_POISON) != 0) -#define resists_acid(mon) (((mon)->mintrinsics & MR_ACID) != 0) -#define resists_ston(mon) (((mon)->mintrinsics & MR_STONE) != 0) +#define resists_fire(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_FIRE) != 0) +#define resists_cold(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_COLD) != 0) +#define resists_sleep(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_SLEEP) != 0) +#define resists_disint(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_DISINT) != 0) +#define resists_elec(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_ELEC) != 0) +#define resists_poison(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_POISON) != 0) +#define resists_acid(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_ACID) != 0) +#define resists_ston(mon) \ + ((((mon)->data->mresists | (mon)->mextrinsics) & MR_STONE) != 0) #define is_lminion(mon) \ (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) diff --git a/include/monst.h b/include/monst.h index d0dee04b0..dde983205 100644 --- a/include/monst.h +++ b/include/monst.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 monst.h $NHDT-Date: 1547428769 2019/01/14 01:19:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.27 $ */ +/* NetHack 3.6 monst.h $NHDT-Date: 1550524559 2019/02/18 21:15:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -70,7 +70,7 @@ struct monst { uchar m_ap_type; /* what mappearance is describing, m_ap_types */ schar mtame; /* level of tameness, implies peaceful */ - unsigned short mintrinsics; /* low 8 correspond to mresists */ + unsigned short mextrinsics; /* low 8 correspond to mresists */ int mspec_used; /* monster's special ability attack timeout */ Bitfield(female, 1); /* is female */ diff --git a/src/makemon.c b/src/makemon.c index d78363130..9ec531866 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makemon.c $NHDT-Date: 1544998885 2018/12/16 22:21:25 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */ +/* NetHack 3.6 makemon.c $NHDT-Date: 1550524560 2019/02/18 21:16:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.132 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1200,7 +1200,7 @@ int mmflags; mtmp->m_id = context.ident++; if (!mtmp->m_id) mtmp->m_id = context.ident++; /* ident overflowed */ - set_mon_data(mtmp, ptr, 0); + set_mon_data(mtmp, ptr); /* mtmp->data = ptr; */ if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx) quest_status.leader_m_id = mtmp->m_id; mtmp->mnum = mndx; @@ -1863,7 +1863,7 @@ struct monst *mtmp, *victim; pline("As %s grows up into %s, %s %s!", mon_nam(mtmp), an(ptr->mname), mhe(mtmp), nonliving(ptr) ? "expires" : "dies"); - set_mon_data(mtmp, ptr, -1); /* keep mvitals[] accurate */ + set_mon_data(mtmp, ptr); /* keep mvitals[] accurate */ mondied(mtmp); return (struct permonst *) 0; } else if (canspotmon(mtmp)) { @@ -1886,7 +1886,7 @@ struct monst *mtmp, *victim; : "grows up into", an(buf)); } - set_mon_data(mtmp, ptr, 1); /* preserve intrinsics */ + set_mon_data(mtmp, ptr); newsym(mtmp->mx, mtmp->my); /* color may change */ lev_limit = (int) mtmp->m_lev; /* never undo increment */ diff --git a/src/mon.c b/src/mon.c index 7ea70a576..8bd12f066 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1548937318 2019/01/31 12:21:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.278 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1550524562 2019/02/18 21:16:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.279 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1991,14 +1991,14 @@ register struct monst *mtmp; mptr = mtmp->data; /* save this for m_detach() */ /* restore chameleon, lycanthropes to true form at death */ if (mtmp->cham >= LOW_PM) { - set_mon_data(mtmp, &mons[mtmp->cham], -1); + set_mon_data(mtmp, &mons[mtmp->cham]); mtmp->cham = NON_PM; } else if (mtmp->data == &mons[PM_WEREJACKAL]) - set_mon_data(mtmp, &mons[PM_HUMAN_WEREJACKAL], -1); + set_mon_data(mtmp, &mons[PM_HUMAN_WEREJACKAL]); else if (mtmp->data == &mons[PM_WEREWOLF]) - set_mon_data(mtmp, &mons[PM_HUMAN_WEREWOLF], -1); + set_mon_data(mtmp, &mons[PM_HUMAN_WEREWOLF]); else if (mtmp->data == &mons[PM_WERERAT]) - set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT], -1); + set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT]); /* * mvitals[].died does double duty as total number of dead monsters @@ -3573,7 +3573,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */ mtmp->mhp = 1; /* take on the new form... */ - set_mon_data(mtmp, mdat, 0); + set_mon_data(mtmp, mdat); if (emits_light(olddata) != emits_light(mtmp->data)) { /* used to give light, now doesn't, or vice versa, diff --git a/src/mondata.c b/src/mondata.c index 9feeeae4e..aeb56d56b 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1546465283 2019/01/02 21:41:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.70 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1550524563 2019/02/18 21:16:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,22 +10,14 @@ /* set up an individual monster's base type (initial creation, shapechange) */ void -set_mon_data(mon, ptr, flag) +set_mon_data(mon, ptr) struct monst *mon; struct permonst *ptr; -int flag; { int new_speed, old_speed = mon->data ? mon->data->mmove : 0; mon->data = ptr; mon->mnum = (short) monsndx(ptr); - if (flag == -1) - return; /* "don't care" */ - - if (flag == 1) - mon->mintrinsics |= (ptr->mresists & 0x00FF); - else - mon->mintrinsics = (ptr->mresists & 0x00FF); if (mon->movement) { /* same adjustment as poly'd hero undergoes */ new_speed = ptr->mmove; diff --git a/src/mplayer.c b/src/mplayer.c index e0526be6a..2dba08e1b 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mplayer.c $NHDT-Date: 1545964576 2018/12/28 02:36:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 mplayer.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.26 $ */ /* Copyright (c) Izchak Miller, 1992. */ /* NetHack may be freely redistributed. See license for details. */ @@ -341,7 +341,7 @@ boolean special; /* roll for character class */ pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST); - set_mon_data(&fakemon, &mons[pm], -1); + set_mon_data(&fakemon, &mons[pm]); /* roll for an available location */ do { diff --git a/src/polyself.c b/src/polyself.c index a326827b5..59a21397f 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 polyself.c $NHDT-Date: 1548208238 2019/01/23 01:50:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.126 $ */ +/* NetHack 3.6 polyself.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -43,7 +43,7 @@ set_uasmon() struct permonst *mdat = &mons[u.umonnum]; int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0; - set_mon_data(&youmonst, mdat, 0); + set_mon_data(&youmonst, mdat); #define PROPSET(PropIndx, ON) \ do { \ diff --git a/src/sp_lev.c b/src/sp_lev.c index 43492a0fa..ded755317 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1545946257 2018/12/27 21:30:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.109 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1550524566 2019/02/18 21:16:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -1754,7 +1754,7 @@ struct mkroom *croom; struct permonst *olddata = mtmp->data; mgender_from_permonst(mtmp, mdat); - set_mon_data(mtmp, mdat, 0); + set_mon_data(mtmp, mdat); if (emits_light(olddata) != emits_light(mtmp->data)) { /* used to give light, now doesn't, or vice versa, or light's range has changed */ diff --git a/src/teleport.c b/src/teleport.c index 488e4477b..4ae361796 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1,4 +1,4 @@ -/* 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 $ */ +/* NetHack 3.6 teleport.c $NHDT-Date: 1550524567 2019/02/18 21:16:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -130,7 +130,7 @@ unsigned entflags; mdat = &mons[u.umonster]; } fakemon = zeromonst; - set_mon_data(&fakemon, mdat, -1); /* set up for goodpos */ + set_mon_data(&fakemon, mdat); /* set up for goodpos */ good_ptr = good; range = 1; diff --git a/src/were.c b/src/were.c index 2c73877f6..eb1a4d090 100644 --- a/src/were.c +++ b/src/were.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 were.c $NHDT-Date: 1505214877 2017/09/12 11:14:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */ +/* NetHack 3.6 were.c $NHDT-Date: 1550524568 2019/02/18 21:16:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.23 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -107,7 +107,7 @@ register struct monst *mon; pline("%s changes into a %s.", Monnam(mon), is_human(&mons[pm]) ? "human" : mons[pm].mname + 4); - set_mon_data(mon, &mons[pm], 0); + set_mon_data(mon, &mons[pm]); if (mon->msleeping || !mon->mcanmove) { /* transformation wakens and/or revitalizes */ mon->msleeping = 0; diff --git a/src/worn.c b/src/worn.c index 1eb1ed671..1a966b7ae 100644 --- a/src/worn.c +++ b/src/worn.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 worn.c $NHDT-Date: 1537234121 2018/09/18 01:28:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.55 $ */ +/* NetHack 3.6 worn.c $NHDT-Date: 1550524569 2019/02/18 21:16:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -317,7 +317,8 @@ struct obj *obj; /* item to make known if effect can be seen */ } } -/* armor put on or taken off; might be magical variety */ +/* armor put on or taken off; might be magical variety + [TODO: rename to 'update_mon_extrinsics()' and change all callers...] */ void update_mon_intrinsics(mon, obj, on, silently) struct monst *mon; @@ -369,7 +370,7 @@ boolean on, silently; if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */ /* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */ mask = (uchar) (1 << (which - 1)); - mon->mintrinsics |= (unsigned short) mask; + mon->mextrinsics |= (unsigned short) mask; } break; } @@ -395,25 +396,22 @@ boolean on, silently; case ACID_RES: case STONE_RES: mask = (uchar) (1 << (which - 1)); - /* If the monster doesn't have this resistance intrinsically, - check whether any other worn item confers it. Note that - we don't currently check for anything conferred via simply - carrying an object. */ - if (!(mon->data->mresists & mask)) { - for (otmp = mon->minvent; otmp; otmp = otmp->nobj) - if (otmp->owornmask - && (int) objects[otmp->otyp].oc_oprop == which) - break; - if (!otmp) - mon->mintrinsics &= ~((unsigned short) mask); - } + /* update monster's extrinsics (for worn objects only; + 'obj' itself might still be worn or already unworn) */ + for (otmp = mon->minvent; otmp; otmp = otmp->nobj) + if (otmp != obj + && otmp->owornmask + && (int) objects[otmp->otyp].oc_oprop == which) + break; + if (!otmp) + mon->mextrinsics &= ~((unsigned short) mask); break; default: break; } } -maybe_blocks: + maybe_blocks: /* obj->owornmask has been cleared by this point, so we can't use it. However, since monsters don't wield armor, we don't have to guard against that and can get away with a blanket worn-mask value. */ From 48ea3572661a8002bb4c1c1e54d308009a06e5c9 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 Feb 2019 13:24:58 -0800 Subject: [PATCH 2/4] poly'd hero movement Noticed while fixing the 'monster intrinsics from worn gear' bug(s): set_uasmon() calls set_mon_data(&youmonst,...) which updates movement when the monster polymorphs into something slower, then it did the same thing to youmonst.movement itself, hitting the hero with a double dose of reduction for any movement points not yet spent on current turn. Remove the set_uasmon() side of that, and change set_mon_data() side to add a redundant non-zero test to prevent static analysis from warning that it might be dividing by 0. --- src/mondata.c | 16 ++++++++++++---- src/polyself.c | 12 +----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/mondata.c b/src/mondata.c index aeb56d56b..fae34e8b7 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1550524563 2019/02/18 21:16:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1550525093 2019/02/18 21:24:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -19,13 +19,21 @@ struct permonst *ptr; mon->data = ptr; mon->mnum = (short) monsndx(ptr); - if (mon->movement) { /* same adjustment as poly'd hero undergoes */ + if (mon->movement) { /* used to adjust poly'd hero as well as monsters */ new_speed = ptr->mmove; /* prorate unused movement if new form is slower so that it doesn't get extra moves leftover from previous form; if new form is faster, leave unused movement as is */ - if (new_speed < old_speed) - mon->movement = new_speed * mon->movement / old_speed; + if (new_speed < old_speed) { + /* + * Some static analysis warns that this might divide by 0 + mon->movement = new_speed * mon->movement / old_speed; + * so add a redundant test to suppress that. + */ + mon->movement *= new_speed; + if (old_speed > 0) /* old > new and new >= 0, so always True */ + mon->movement /= old_speed; + } } return; } diff --git a/src/polyself.c b/src/polyself.c index 59a21397f..b9e6fa81b 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 polyself.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */ +/* NetHack 3.6 polyself.c $NHDT-Date: 1550525094 2019/02/18 21:24:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.128 $ */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -41,7 +41,6 @@ void set_uasmon() { struct permonst *mdat = &mons[u.umonnum]; - int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0; set_mon_data(&youmonst, mdat); @@ -101,15 +100,6 @@ set_uasmon() float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */ polysense(); - if (youmonst.movement) { - new_speed = mdat->mmove; - /* prorate unused movement if new form is slower so that - it doesn't get extra moves leftover from previous form; - if new form is faster, leave unused movement as is */ - if (new_speed < old_speed) - youmonst.movement = new_speed * youmonst.movement / old_speed; - } - #ifdef STATUS_HILITES status_initialize(REASSESS_ONLY); #endif From b516b5fd9ea98388b1542169a1a16a17549f5971 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 Feb 2019 15:24:02 -0800 Subject: [PATCH 3/4] more #H8215 - monster instrinsics --- doc/fixes36.2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9c472f09b..c92370f72 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.257 $ $NHDT-Date: 1550014802 2019/02/12 23:40:02 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.258 $ $NHDT-Date: 1550532194 2019/02/18 23:23: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, @@ -371,6 +371,8 @@ DUMPLOG: output from '/' (#whatis) and ';' went into ^P message recall history when donning armor, defer flagging its +/- value--which can be deduced from the status line--as known until finished in case it gets stolen before then (player might still deduce the +/- value but hero won't learn it) +a monster with resistances supplied by worn armor would lose them if that + monster went through a shape change even if the armor stayed worn Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository From 01c400a20004660dd53634c774c540b9cc81365e Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 Feb 2019 15:34:09 -0800 Subject: [PATCH 4/4] OSX has /dev/random We aren't defining BSD for OSX but we probably should be. This doesn't go that far, just changes a couple of __APPLE__ for MACOSX (set up in config1.h) and defines DEV_RANDOM as "/dev/random". --- include/unixconf.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/unixconf.h b/include/unixconf.h index 781e3563e..9b5abeed3 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixconf.h $NHDT-Date: 1548372343 2019/01/24 23:25:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */ +/* NetHack 3.6 unixconf.h $NHDT-Date: 1550532737 2019/02/18 23:32:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.39 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -350,7 +350,7 @@ /* the high quality random number routines */ #ifndef USE_ISAAC64 # if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ - || defined(RANDOM) || defined(__APPLE__) + || defined(RANDOM) || defined(MACOSX) # define Rand() random() # else # define Rand() lrand48() @@ -407,7 +407,7 @@ #endif /* LINUX */ #endif /* GNOME_GRAPHICS */ -#ifdef __APPLE__ +#ifdef MACOSX # define RUNTIME_PASTEBUF_SUPPORT #endif @@ -415,11 +415,12 @@ * /dev/random is blocking on Linux, so there we default to /dev/urandom which * should still be good enough. * BSD systems usually have /dev/random that is supposed to be used. + * OSX is based on NetBSD kernel and has both /dev/random and /dev/urandom. */ #ifdef LINUX # define DEV_RANDOM "/dev/urandom" #else -# ifdef BSD +# if defined(BSD) || defined(MACOSX) # define DEV_RANDOM "/dev/random" # endif #endif