]> granicus.if.org Git - nethack/commitdiff
\#wizkill fix
authorPatR <rankin@nethack.org>
Thu, 1 Dec 2022 23:36:40 +0000 (15:36 -0800)
committerPatR <rankin@nethack.org>
Thu, 1 Dec 2022 23:36:40 +0000 (15:36 -0800)
When running #wizkill, if hero was swallowed and you killed the
engulfer and that dropped hero onto a level teleporter, the targetting
loop for selecting the next monster to kill kept going after changing
to another level.  Terminate #wizkill if killing something sends you
to a different level.

Not fixed, and an old bug, or variation of one:  the cursor got
positioned at the coordinates of your spot on the prior level even
though the part of the new level where you actually arrived was
displayed.

The hack.c and trap.c bits are just reformatting.

src/cmd.c
src/hack.c
src/trap.c

index 417d8571295bba40a04b58b0452c68c3f39bf81a..950320c5298acf047e2bd7723c4bfa49c3e25b0a 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1275,7 +1275,9 @@ wiz_kill(void)
     int ans;
     char c, qbuf[QBUFSZ];
     const char *prompt = "Pick first monster to slay";
-    boolean save_verbose = flags.verbose;
+    boolean save_verbose = flags.verbose,
+            save_autodescribe = iflags.autodescribe;
+    d_level uarehere = u.uz;
 
     cc.x = u.ux, cc.y = u.uy;
     for (;;) {
@@ -1283,8 +1285,10 @@ wiz_kill(void)
         prompt = "Next monster";
 
         flags.verbose = FALSE;
+        iflags.autodescribe = TRUE;
         ans = getpos(&cc, TRUE, "a monster");
         flags.verbose = save_verbose;
+        iflags.autodescribe = save_autodescribe;
         if (ans < 0 || cc.x < 1)
             break;
 
@@ -1350,6 +1354,10 @@ wiz_kill(void)
                 monkilled(mtmp, (char *) 0, AD_PHYS);
                 gc.context.mon_moving = FALSE;
             }
+            /* end targetting loop if an engulfer dropped hero onto a level-
+               changing trap */
+            if (u.utotype || !on_level(&u.uz, &uarehere))
+                break;
         } else {
             There("is no monster there.");
             break;
index 4439fc67ec8db44cfc0bc4466d1b5be8bdefb50d..497ee35828f723f0458aca028645192e8a62334c 100644 (file)
@@ -2702,7 +2702,8 @@ set_uinwater(int in_out)
    leaving a pool of water/lava, and by moveloop to check for staying on one;
    returns true to skip rest of spoteffects */
 boolean
-pooleffects(boolean newspot)             /* true if called by spoteffects */
+pooleffects(
+    boolean newspot) /* true if called by spoteffects */
 {
     /* check for leaving water */
     if (u.uinwater) {
@@ -2848,10 +2849,9 @@ spoteffects(boolean pick)
             /*
              * dotrap on a fire trap calls melt_ice() which triggers
              * spoteffects() (again) which can trigger the same fire
-             * trap (again). Use static spottrap to prevent that.
-             * We track spottraptyp because some traps morph
-             * (landmine to pit) and any new trap type
-             * should get triggered.
+             * trap (again).  Use static spottrap to prevent that.
+             * We track spottraptyp because some traps morph (landmine
+             * to pit) and any new trap type should get triggered.
              */
             if (!spottrap || spottraptyp != trap->ttyp) {
                 spottrap = trap;
index fe17ae2086eb4aee3fed8621c4893605ade6f9e8..3ad1b0181fc6b5bd65441798c1e05058d6bc1f52 100644 (file)
@@ -1644,7 +1644,8 @@ trapeffect_pit(
                             x_monnam(u.usteed, steed_article, "poor",
                                      SUPPRESS_SADDLE, FALSE));
             } else if (iflags.menu_requested && already_known) {
-                You("carefully %s into the pit.", u_locomotion("lower yourself"));
+                You("carefully %s into the pit.",
+                    u_locomotion("lower yourself"));
                 deliberate = TRUE;
             } else if (conj_pit) {
                 You("move into an adjacent pit.");