extern void dotrap(struct trap *, unsigned);
extern void seetrap(struct trap *);
extern void feeltrap(struct trap *);
-extern int mintrap(struct monst *, long);
+extern int mintrap(struct monst *, unsigned);
extern void instapetrify(const char *);
extern void minstapetrify(struct monst *, boolean);
extern void selftouch(const char *);
#define PICK_RIGID 1
/* Flags to control dotrap() and mintrap() in trap.c */
-#define NO_TRAP_FLAGS 0
-#define FORCETRAP 0x01 /* triggering not left to chance */
-#define NOWEBMSG 0x02 /* suppress stumble into web message */
-#define FORCEBUNGLE 0x04 /* adjustments appropriate for bungling */
-#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn */
-#define TOOKPLUNGE 0x10 /* used '>' to enter pit below you */
-#define VIASITTING 0x20 /* #sit while at trap location (affects message) */
-#define FAILEDUNTRAP 0x40 /* trap activated by failed untrap attempt */
-#define HURTLING 0x80 /* monster is hurtling through air */
+#define NO_TRAP_FLAGS 0x00U
+#define FORCETRAP 0x01U /* triggering not left to chance */
+#define NOWEBMSG 0x02U /* suppress stumble into web message */
+#define FORCEBUNGLE 0x04U /* adjustments appropriate for bungling */
+#define RECURSIVETRAP 0x08U /* trap changed into another type this same turn */
+#define TOOKPLUNGE 0x10U /* used '>' to enter pit below you */
+#define VIASITTING 0x20U /* #sit while at trap location (affects message) */
+#define FAILEDUNTRAP 0x40U /* trap activated by failed untrap attempt */
+#define HURTLING 0x80U /* monster is hurtling through air */
/* Flags to control test_move in hack.c */
#define DO_MOVE 0 /* really doing the move */
}
if ((u.ux - x) && (u.uy - y) && bad_rock(g.youmonst.data, u.ux, y)
&& bad_rock(g.youmonst.data, x, u.uy)) {
- boolean too_much = (g.invent && (inv_weight() + weight_cap() > 600));
+ boolean too_much = (g.invent
+ && (inv_weight() + weight_cap() > 600));
/* Move at a diagonal. */
if (bigmonst(g.youmonst.data) || too_much) {
&& (Flying || Levitation || Wwalking))
#endif
) {
- const char *mnam, *pronoun;
+ const char *mnam;
int glyph = glyph_at(x, y);
mon->mundetected = 0; /* wakeup() will handle mimic */
- mnam = a_monnam(mon); /* after unhiding */
- pronoun = noit_mhim(mon);
- if (!strcmp(mnam, "it")) {
- mnam = !strcmp(pronoun, "it") ? "something" : "someone";
- }
+ /* after unhiding; combination of a_monnam() and some_mon_nam();
+ yields "someone" or "something" instead of "it" for unseen mon */
+ mnam = x_monnam(mon, ARTICLE_A, (char *) 0,
+ ((has_mgivenname(mon) ? SUPPRESS_SADDLE : 0)
+ | AUGMENT_IT),
+ FALSE);
if (!glyph_is_monster(glyph) && !glyph_is_invisible(glyph))
- You("find %s by bumping into %s.", mnam, pronoun);
+ You("find %s by bumping into %s.", mnam, noit_mhim(mon));
else
You("bump into %s.", mnam);
wakeup(mon, FALSE);
if (is_pool(x, y) && !u.uinwater) {
if ((Is_waterlevel(&u.uz) && is_waterwall(x,y))
|| !(Levitation || Flying || Wwalking)) {
- g.multi = 0; /* can move, so drown() allows crawling out of water */
+ /* couldn't move while hurtling; allow movement now so that
+ drown() will give a chance to crawl out of pool and survive */
+ g.multi = 0;
(void) drown();
return FALSE;
} else if (!Is_waterlevel(&u.uz) && !stopping_short) {
Norep("You move over %s.", an(is_moat(x, y) ? "moat" : "pool"));
- }
+ }
} else if (is_lava(x, y) && !stopping_short) {
Norep("You move over some lava.");
}
if (stopping_short) {
; /* see the comment above hurtle_jump() */
} else if (ttmp->ttyp == MAGIC_PORTAL) {
- dotrap(ttmp, 0);
+ dotrap(ttmp, NO_TRAP_FLAGS);
return FALSE;
} else if (ttmp->ttyp == VIBRATING_SQUARE) {
pline("The ground vibrates as you pass it.");
- dotrap(ttmp, 0); /* doesn't print messages */
+ dotrap(ttmp, NO_TRAP_FLAGS); /* doesn't print messages */
} else if (ttmp->ttyp == FIRE_TRAP) {
- dotrap(ttmp, 0);
+ dotrap(ttmp, NO_TRAP_FLAGS);
} else if ((is_pit(ttmp->ttyp) || is_hole(ttmp->ttyp))
&& Sokoban) {
/* air currents overcome the recoil in Sokoban;
when jumping, caller performs last step and enters trap */
if (!via_jumping)
- dotrap(ttmp, 0);
+ dotrap(ttmp, NO_TRAP_FLAGS);
*range = 0;
return TRUE;
} else {
case ANTI_MAGIC:
case POLY_TRAP:
You("have triggered a trap!");
- dotrap(ttmp, 0);
+ dotrap(ttmp, NO_TRAP_FLAGS);
return ECMD_TIME;
default:
impossible("Webbing over trap type %d?", ttmp->ttyp);
trapkilled = TRUE;
} else {
/* monsters recursively fall into new pit */
- if (mintrap(mtmp, trflags|FORCETRAP) == Trap_Killed_Mon)
+ if (mintrap(mtmp, trflags | FORCETRAP) == Trap_Killed_Mon)
trapkilled = TRUE;
}
/* a boulder may fill the new pit, crushing monster */
}
void
-dotrap(register struct trap* trap, unsigned int trflags)
+dotrap(struct trap *trap, unsigned trflags)
{
- register int ttype = trap->ttyp;
+ int ttype = trap->ttyp;
boolean already_seen = trap->tseen,
forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0),
}
int
-mintrap(register struct monst *mtmp, long mintrapflags)
+mintrap(struct monst *mtmp, unsigned mintrapflags)
{
- register struct trap *trap = t_at(mtmp->mx, mtmp->my);
+ struct trap *trap = t_at(mtmp->mx, mtmp->my);
struct permonst *mptr = mtmp->data;
int trap_result = Trap_Effect_Finished;
/*FALLTHRU*/
default:
if (!u.utrap) /* not already in the trap */
- dotrap(trap, 0);
+ dotrap(trap, NO_TRAP_FLAGS);
}
}
if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !u.uswallow
/* dotrap calls mintrap when mounted hero encounters a web */
if (u.usteed)
dotrapflags |= NOWEBMSG;
- dotrap(t, dotrapflags|FORCETRAP);
+ dotrap(t, dotrapflags | FORCETRAP);
result = (u.utrap != 0);
} else {
if (mon->mtrapped)
ttmp->tseen = 1;
newsym(x, y);
/* might fall down hole */
- dotrap(ttmp, 0);
+ dotrap(ttmp, NO_TRAP_FLAGS);
} else if (!striking && ttmp->ttyp == HOLE) {
/* locking transforms hole into trapdoor */
ttmp->ttyp = TRAPDOOR;