fix mintrap() return value and resurrect dead code

fixes #672
This commit is contained in:
nhmall
2022-02-08 17:31:34 -05:00
parent f1ef83b4db
commit fe03b10208
2 changed files with 6 additions and 5 deletions

View File

@@ -1005,6 +1005,9 @@ giving a prefix keystroke other than 'm' prior to a command that doesn't use
prior revision broke all prefix usage
movement command revamp broke 'm>' and 'm<' on stairs to avoid auto-pickup at
the destination
when trapeffect_selector() returns 2 to caller mintrap(), meant to
signify that the monster was killed in the trap, ensure that
mintrap() returns that value too
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -3064,8 +3064,8 @@ int
mintrap(register struct monst *mtmp)
{
register struct trap *trap = t_at(mtmp->mx, mtmp->my);
boolean trapkilled = FALSE;
struct permonst *mptr = mtmp->data;
int trap_result = 0;
if (!trap) {
mtmp->mtrapped = 0; /* perhaps teleported? */
@@ -3129,11 +3129,9 @@ mintrap(register struct monst *mtmp)
if (trap->madeby_u && rnl(5))
setmangry(mtmp, FALSE);
return trapeffect_selector(mtmp, trap, 0);
trap_result = trapeffect_selector(mtmp, trap, 0);
}
if (trapkilled)
return 2;
return mtmp->mtrapped;
return (trap_result == 2) ? trap_result : mtmp->mtrapped;
}
/* Combine cockatrice checks into single functions to avoid repeating code. */