fix issue #1305 - failed #untrap from doorway

Issue reported by loggersviii:  attempting #untrap from an adjacent
doorway can move the hero diagonally out of the doorway.

A followup comment by elunna pointed out that a monster's attack that
results in knockback can produce similar result.

Fixes #1305
This commit is contained in:
PatR
2024-12-13 22:48:32 -08:00
parent bbb4bfa938
commit b2b9b685c5
4 changed files with 55 additions and 26 deletions

View File

@@ -47,7 +47,6 @@ staticfn struct monst *monstinroom(struct permonst *, int) NONNULLARG1;
staticfn boolean furniture_present(int, int);
staticfn void move_update(boolean);
staticfn int pickup_checks(void);
staticfn boolean doorless_door(coordxy, coordxy);
staticfn void maybe_wail(void);
staticfn boolean water_turbulence(coordxy *, coordxy *);
@@ -963,7 +962,7 @@ invocation_pos(coordxy x, coordxy y)
&& x == svi.inv_pos.x && y == svi.inv_pos.y);
}
/* return TRUE if (dx,dy) is an OK place to move;
/* return TRUE if (ux+dx,ux+dy) is an OK place to move;
mode is one of DO_MOVE, TEST_MOVE, TEST_TRAV, or TEST_TRAP */
boolean
test_move(
@@ -2749,20 +2748,8 @@ domove_core(void)
|| Hallucination)) {
char qbuf[QBUFSZ];
int traptype = (Hallucination ? rnd(TRAPNUM - 1) : (int) trap->ttyp);
boolean into = FALSE; /* "onto" the trap vs "into" */
boolean into = into_vs_onto(traptype);
switch (traptype) {
case BEAR_TRAP:
case PIT:
case SPIKED_PIT:
case HOLE:
case TELEP_TRAP:
case LEVEL_TELEP:
case MAGIC_PORTAL:
case WEB:
into = TRUE;
break;
}
Snprintf(qbuf, sizeof qbuf, "Really %s %s that %s?",
u_locomotion("step"), into ? "into" : "onto",
defsyms[trap_to_defsym(traptype)].explanation);
@@ -3910,7 +3897,7 @@ lookaround(void)
}
/* check for a doorway which lacks its door (NODOOR or BROKEN) */
staticfn boolean
boolean
doorless_door(coordxy x, coordxy y)
{
struct rm *lev_p = &levl[x][y];