From 54aa047ec9a0a6776f799ae262b4e26d0023217f Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 1 Dec 2022 15:36:40 -0800 Subject: [PATCH] \#wizkill fix 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 | 10 +++++++++- src/hack.c | 10 +++++----- src/trap.c | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 417d85712..950320c52 100644 --- 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; diff --git a/src/hack.c b/src/hack.c index 4439fc67e..497ee3582 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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; diff --git a/src/trap.c b/src/trap.c index fe17ae208..3ad1b0181 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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.");