]> granicus.if.org Git - nethack/commitdiff
couple of #wizintrinsic fixes
authorPatR <rankin@nethack.org>
Sun, 11 Nov 2018 02:22:38 +0000 (18:22 -0800)
committerPatR <rankin@nethack.org>
Sun, 11 Nov 2018 02:22:38 +0000 (18:22 -0800)
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
src/cmd.c
src/end.c
src/timeout.c

index 96361d68af59e074500954fad42f9e93ae4ece18..2de78d988c5f66c2b2c147a59335c7f25695ad5a 100644 (file)
@@ -192,6 +192,8 @@ attempting to #ride a long worm's tail could trigger impossible "worm_cross
 avoid "The " in "The <known-artifact-but-not-The-artifact> 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
index c783a5b2e1fcc355e8e36931e04575eb3b24f590..b2debe3373654871be0de98bb20519119bb10ac1 100644 (file)
--- 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);
index 9cd4d40a082dff16990f4959f6cdf720e2e28a22..a2f8967d0ebf72eb9a38e482b919cd5808bce914 100644 (file)
--- 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;
index 4c9be060778781238905a112092f711405eb1618..a75fc66b97d8560add7012a1fe2fdc771e9b3299 100644 (file)
@@ -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())