paranoid_confirm:trap when flying or levitating

Avoid asking the player whether to _step_ on a trap when flying or
levitating.  locomotion() isn't the right routine for handling that.
This commit is contained in:
PatR
2024-11-27 10:37:55 -08:00
parent 5c0834e9d9
commit c255dc4bc4

View File

@@ -1776,9 +1776,14 @@ u_locomotion(const char *def)
{ {
boolean capitalize = (*def == highc(*def)); boolean capitalize = (*def == highc(*def));
/* regular locomotion() takes a monster type rather than a specific
monster, so can't tell whether it is operating on hero;
its is_flyer() and is_floater() tests wouldn't work on hero except
when hero is polymorphed and not wearing an amulet of flying
or boots/ring/spell of levitation */
return Levitation ? (capitalize ? "Float" : "float") return Levitation ? (capitalize ? "Float" : "float")
: Flying ? (capitalize ? "Fly" : "fly") : Flying ? (capitalize ? "Fly" : "fly")
: locomotion(gy.youmonst.data, def); : locomotion(gy.youmonst.data, def);
} }
/* Return a simplified floor solid/liquid state based on hero's state */ /* Return a simplified floor solid/liquid state based on hero's state */
@@ -1838,8 +1843,7 @@ staticfn boolean
swim_move_danger(coordxy x, coordxy y) swim_move_danger(coordxy x, coordxy y)
{ {
schar newtyp = u_simple_floortyp(x, y); schar newtyp = u_simple_floortyp(x, y);
boolean liquid_wall = IS_WATERWALL(newtyp) boolean liquid_wall = IS_WATERWALL(newtyp) || newtyp == LAVAWALL;
|| newtyp == LAVAWALL;
if (Underwater && (is_pool(x,y) || IS_WATERWALL(newtyp))) if (Underwater && (is_pool(x,y) || IS_WATERWALL(newtyp)))
return FALSE; return FALSE;
@@ -2715,7 +2719,7 @@ domove_core(void)
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
Snprintf(qbuf, sizeof qbuf, "%s into that %s cloud?", Snprintf(qbuf, sizeof qbuf, "%s into that %s cloud?",
locomotion(gy.youmonst.data, "step"), u_locomotion("step"),
(reg_damg(newreg) > 0) ? "poison gas" : "vapor"); (reg_damg(newreg) > 0) ? "poison gas" : "vapor");
if (!paranoid_query(ParanoidConfirm, upstart(qbuf))) { if (!paranoid_query(ParanoidConfirm, upstart(qbuf))) {
nomul(0); nomul(0);
@@ -2758,8 +2762,7 @@ domove_core(void)
break; break;
} }
Snprintf(qbuf, sizeof qbuf, "Really %s %s that %s?", Snprintf(qbuf, sizeof qbuf, "Really %s %s that %s?",
locomotion(gy.youmonst.data, "step"), u_locomotion("step"), into ? "into" : "onto",
into ? "into" : "onto",
defsyms[trap_to_defsym(traptype)].explanation); defsyms[trap_to_defsym(traptype)].explanation);
/* handled like paranoid_confirm:pray; when paranoid_confirm:trap /* handled like paranoid_confirm:pray; when paranoid_confirm:trap
isn't set, don't ask at all but if it is set (checked above), isn't set, don't ask at all but if it is set (checked above),