\#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.
This commit is contained in:
PatR
2022-12-01 15:36:40 -08:00
parent 81fb185cea
commit 54aa047ec9
3 changed files with 16 additions and 7 deletions
+9 -1
View File
@@ -1275,7 +1275,9 @@ wiz_kill(void)
int ans; int ans;
char c, qbuf[QBUFSZ]; char c, qbuf[QBUFSZ];
const char *prompt = "Pick first monster to slay"; 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; cc.x = u.ux, cc.y = u.uy;
for (;;) { for (;;) {
@@ -1283,8 +1285,10 @@ wiz_kill(void)
prompt = "Next monster"; prompt = "Next monster";
flags.verbose = FALSE; flags.verbose = FALSE;
iflags.autodescribe = TRUE;
ans = getpos(&cc, TRUE, "a monster"); ans = getpos(&cc, TRUE, "a monster");
flags.verbose = save_verbose; flags.verbose = save_verbose;
iflags.autodescribe = save_autodescribe;
if (ans < 0 || cc.x < 1) if (ans < 0 || cc.x < 1)
break; break;
@@ -1350,6 +1354,10 @@ wiz_kill(void)
monkilled(mtmp, (char *) 0, AD_PHYS); monkilled(mtmp, (char *) 0, AD_PHYS);
gc.context.mon_moving = FALSE; 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 { } else {
There("is no monster there."); There("is no monster there.");
break; break;
+5 -5
View 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; leaving a pool of water/lava, and by moveloop to check for staying on one;
returns true to skip rest of spoteffects */ returns true to skip rest of spoteffects */
boolean boolean
pooleffects(boolean newspot) /* true if called by spoteffects */ pooleffects(
boolean newspot) /* true if called by spoteffects */
{ {
/* check for leaving water */ /* check for leaving water */
if (u.uinwater) { if (u.uinwater) {
@@ -2848,10 +2849,9 @@ spoteffects(boolean pick)
/* /*
* dotrap on a fire trap calls melt_ice() which triggers * dotrap on a fire trap calls melt_ice() which triggers
* spoteffects() (again) which can trigger the same fire * spoteffects() (again) which can trigger the same fire
* trap (again). Use static spottrap to prevent that. * trap (again). Use static spottrap to prevent that.
* We track spottraptyp because some traps morph * We track spottraptyp because some traps morph (landmine
* (landmine to pit) and any new trap type * to pit) and any new trap type should get triggered.
* should get triggered.
*/ */
if (!spottrap || spottraptyp != trap->ttyp) { if (!spottrap || spottraptyp != trap->ttyp) {
spottrap = trap; spottrap = trap;
+2 -1
View File
@@ -1644,7 +1644,8 @@ trapeffect_pit(
x_monnam(u.usteed, steed_article, "poor", x_monnam(u.usteed, steed_article, "poor",
SUPPRESS_SADDLE, FALSE)); SUPPRESS_SADDLE, FALSE));
} else if (iflags.menu_requested && already_known) { } 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; deliberate = TRUE;
} else if (conj_pit) { } else if (conj_pit) {
You("move into an adjacent pit."); You("move into an adjacent pit.");