From e486d941edefcf33b4f6a005c55d5db86b56ac71 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 10 Nov 2018 18:22:38 -0800 Subject: [PATCH] couple of #wizintrinsic fixes When #wizinstrinsic was expanded to be able to set any timed attribute, some that need more than just a timeout counter were left inconsistent. 1) Timed Flying wasn't blocked by levitation, and existing flight wasn't becoming blocked by timed levitation. Also, eventual flight timeout wasn't updating the status line, so false 'Fly' condition remained shown until a status update happened for some other reason. 2) Setting timer for Warn_of_mon didn't set up any type of monster to warn about so wouldn't do anything. This sets that to grid bug unless already set due to polymorph form or artifact that warns. The end.c portion is just a bit of formatting. --- doc/fixes36.2 | 2 ++ src/cmd.c | 14 +++++++++++++- src/end.c | 8 ++++---- src/timeout.c | 25 +++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 96361d68a..2de78d988 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -192,6 +192,8 @@ attempting to #ride a long worm's tail could trigger impossible "worm_cross avoid "The " in "The falls down stairs." avoid potential buffer overflow if object with very long name knocks other objects down stairs when dropped, thrown, or kicked there +#wizintrinsic for 'flying' didn't update status line when flying ended +#wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index c783a5b2e..b2debe337 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1541631031 2018/11/07 22:50:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1541902950 2018/11/11 02:22:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.301 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1423,7 +1423,19 @@ wiz_intrinsic(VOID_ARGS) make_vomiting(newtimeout, FALSE); pline1(buf); break; + case WARN_OF_MON: + if (!Warn_of_mon) { + context.warntype.speciesidx = PM_GRID_BUG; + context.warntype.species + = &mons[context.warntype.speciesidx]; + } + goto def_feedback; + case LEVITATION: + case FLYING: + float_vs_flight(); + /*FALLTHRU*/ default: + def_feedback: pline("Timeout for %s %s %d.", propertynames[i].prop_name, oldtimeout ? "increased by" : "set to", amt); incr_itimeout(&u.uprops[p].intrinsic, amt); diff --git a/src/end.c b/src/end.c index 9cd4d40a0..a2f8967d0 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1540767809 2018/10/28 23:03:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.148 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1541902951 2018/11/11 02:22:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2009,10 +2009,10 @@ const char *killername; { struct kinfo *k = find_delayed_killer(id); - if (k == (struct kinfo *) 0) { + if (!k) { /* no match, add a new delayed killer to the list */ - k = (struct kinfo *) alloc(sizeof(struct kinfo)); - (void) memset((genericptr_t)k, 0, sizeof(struct kinfo)); + k = (struct kinfo *) alloc(sizeof (struct kinfo)); + (void) memset((genericptr_t) k, 0, sizeof (struct kinfo)); k->id = id; k->next = killer.next; killer.next = k; diff --git a/src/timeout.c b/src/timeout.c index 4c9be0607..a75fc66b9 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1505214876 2017/09/12 11:14:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1541902953 2018/11/11 02:22:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -45,7 +45,7 @@ const struct propname { { SEE_INVIS, "see invisible" }, { INVIS, "invisible" }, /* properties beyond here don't have timed values during normal play, - so there's no much point in trying to order them sensibly; + so there's not much point in trying to order them sensibly; they're either on or off based on equipment, role, actions, &c */ { FIRE_RES, "fire resistance" }, { COLD_RES, "cold resistance" }, @@ -367,6 +367,7 @@ nh_timeout() { register struct prop *upp; struct kinfo *kptr; + boolean was_flying; int sleeptime; int m_idx; int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0; @@ -431,6 +432,7 @@ nh_timeout() pline("%s stops galloping.", Monnam(u.usteed)); } + was_flying = Flying; for (upp = u.uprops; upp < u.uprops + SIZE(u.uprops); upp++) if ((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) { kptr = find_delayed_killer((int) (upp - u.uprops)); @@ -554,6 +556,25 @@ nh_timeout() case LEVITATION: (void) float_down(I_SPECIAL | TIMEOUT, 0L); break; + case FLYING: + /* timed Flying is via #wizintrinsic only */ + if (was_flying && !Flying) { + context.botl = 1; + You("land."); + spoteffects(TRUE); + } + break; + case WARN_OF_MON: + /* timed Warn_of_mon is via #wizintrinsic only */ + if (!Warn_of_mon) { + context.warntype.speciesidx = NON_PM; + if (context.warntype.species) { + You("are no longer warned about %s.", + makeplural(context.warntype.species->mname)); + context.warntype.species = (struct permonst *) 0; + } + } + break; case PASSES_WALLS: if (!Passes_walls) { if (stuck_in_wall())