-/* $NetBSD: trap.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */
+/* $NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: trap.c,v 1.6 2003/08/07 09:37:40 agc Exp $");
+__RCSID("$NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $");
#endif
#endif /* not lint */
boolean trap_door = 0;
short bear_trap = 0;
-const char *const trap_strings[TRAPS * 2] = {
+static const char *const trap_strings[TRAPS * 2] = {
"trap door",
"you fell down a trap",
"bear trap",
"a gush of water hits you on the head"
};
-short
-trap_at(row, col)
- int row, col;
+static short
+trap_at(int row, int col)
{
short i;
}
void
-trap_player(row, col)
- short row, col;
+trap_player(short row, short col)
{
short t;
}
dungeon[row][col] &= (~HIDDEN);
if (rand_percent(rogue.exp + ring_exp)) {
- message("the trap failed", 1);
+ messagef(1, "the trap failed");
return;
}
switch(t) {
new_level_message = trap_strings[(t*2)+1];
break;
case BEAR_TRAP:
- message(trap_strings[(t*2)+1], 1);
+ messagef(1, "%s", trap_strings[(t*2)+1]);
bear_trap = get_rand(4, 7);
break;
case TELE_TRAP:
tele();
break;
case DART_TRAP:
- message(trap_strings[(t*2)+1], 1);
+ messagef(1, "%s", trap_strings[(t*2)+1]);
rogue.hp_current -= get_damage("1d6", 1);
if (rogue.hp_current <= 0) {
rogue.hp_current = 0;
}
print_stats(STAT_HP | STAT_STRENGTH);
if (rogue.hp_current <= 0) {
- killed_by((object *) 0, POISON_DART);
+ killed_by((object *)0, POISON_DART);
}
break;
case SLEEPING_GAS_TRAP:
- message(trap_strings[(t*2)+1], 1);
+ messagef(1, "%s", trap_strings[(t*2)+1]);
take_a_nap();
break;
case RUST_TRAP:
- message(trap_strings[(t*2)+1], 1);
- rust((object *) 0);
+ messagef(1, "%s", trap_strings[(t*2)+1]);
+ rust(NULL);
break;
}
}
void
-add_traps()
+add_traps(void)
{
short i, n, tries = 0;
short row, col;
}
void
-id_trap()
+id_trap(void)
{
short dir, row, col, d, t;
- message("direction? ", 0);
+ messagef(0, "direction? ");
while (!is_direction(dir = rgetchar(), &d)) {
sound_bell();
if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) {
t = trap_at(row, col);
- message(trap_strings[t*2], 0);
+ messagef(0, "%s", trap_strings[t*2]);
} else {
- message("no trap there", 0);
+ messagef(0, "no trap there");
}
}
void
-show_traps()
+show_traps(void)
{
short i, j;
}
void
-search(n, is_auto)
- short n;
- boolean is_auto;
+search(short n, boolean is_auto)
{
short s, i, j, row, col, t;
short shown = 0, found = 0;
shown++;
if (dungeon[row][col] & TRAP) {
t = trap_at(row, col);
- message(trap_strings[t*2], 1);
+ messagef(1, "%s",
+ trap_strings[t*2]);
}
}
}
}
}
if ((!is_auto) && (reg_search = !reg_search)) {
- (void) reg_move();
+ (void)reg_move();
}
}
}