-/* $NetBSD: move.c,v 1.9 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: move.c,v 1.13 2011/05/23 23:01:17 joerg Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: move.c,v 1.9 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: move.c,v 1.13 2011/05/23 23:01:17 joerg Exp $");
#endif
#endif /* not lint */
short m_moves = 0;
boolean jump = 0;
-const char *you_can_move_again = "you can move again";
+const char you_can_move_again[] = "you can move again";
+
+static boolean can_turn(short, short);
+static boolean check_hunger(boolean);
+static char gr_dir(void);
+static void heal(void);
+static boolean next_to_something(int, int);
+static void turn_passage(short, boolean);
int
-one_move_rogue(dirch, pickup)
- short dirch, pickup;
+one_move_rogue(short dirch, short pickup)
{
short row, col;
object *obj;
if (confused) {
dirch = gr_dir();
}
- (void) is_direction(dirch, &d);
+ (void)is_direction(dirch, &d);
get_dir_rc(d, &row, &col, 1);
if (!can_move(rogue.row, rogue.col, row, col)) {
messagef(1, "you are being held");
} else {
messagef(0, "you are still stuck in the bear trap");
- (void) reg_move();
+ (void)reg_move();
}
return(MOVE_FAILED);
}
}
if (dungeon[row][col] & MONSTER) {
rogue_hit(object_at(&level_monsters, row, col), 0);
- (void) reg_move();
+ (void)reg_move();
return(MOVE_FAILED);
}
if (dungeon[row][col] & DOOR) {
}
messagef(1, "%s(%c)", desc, obj->ichar);
NOT_IN_PACK:
- (void) reg_move();
+ (void)reg_move();
return(STOPPED_ON_SOMETHING);
}
if (dungeon[row][col] & (DOOR | STAIRS | TRAP)) {
if ((!levitate) && (dungeon[row][col] & TRAP)) {
trap_player(row, col);
}
- (void) reg_move();
+ (void)reg_move();
return(STOPPED_ON_SOMETHING);
}
MVED: if (reg_move()) { /* fainted from hunger */
}
void
-multiple_move_rogue(dirch)
- short dirch;
+multiple_move_rogue(short dirch)
{
short row, col;
short m;
case 'Y':
case 'U':
case 'N':
- while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED)) ;
+ while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED))
+ ;
if ( (!interrupted) && passgo &&
(dungeon[rogue.row][rogue.col] & TUNNEL)) {
}
boolean
-is_passable(row, col)
- int row, col;
+is_passable(int row, int col)
{
if ((row < MIN_ROW) || (row > (DROWS - 2)) || (col < 0) ||
(col > (DCOLS-1))) {
return(dungeon[row][col] & (FLOOR | TUNNEL | DOOR | STAIRS | TRAP));
}
-boolean
-next_to_something(drow, dcol)
- int drow, dcol;
+static boolean
+next_to_something(int drow, int dcol)
{
short i, j, i_end, j_end, row, col;
short pass_count = 0;
}
boolean
-can_move(row1, col1, row2, col2)
- int row1, col1, row2, col2;
+can_move(int row1, int col1, int row2, int col2)
{
if (!is_passable(row2, col2)) {
return(0);
}
void
-move_onto()
+move_onto(void)
{
short ch, d;
boolean first_miss = 1;
}
check_message();
if (ch != CANCEL) {
- (void) one_move_rogue(ch, 0);
+ (void)one_move_rogue(ch, 0);
}
}
boolean
-is_direction(c, d)
- short c;
- short *d;
+is_direction(short c, short *d)
{
switch(c) {
case 'h':
return(1);
}
-boolean
-check_hunger(msg_only)
- boolean msg_only;
+static boolean
+check_hunger(boolean msg_only)
{
short i, n;
boolean fainted = 0;
if (rogue.moves_left == HUNGRY) {
- (void) strlcpy(hunger_str, "hungry", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "hungry", sizeof(hunger_str));
messagef(0, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
if (rogue.moves_left == WEAK) {
- (void) strlcpy(hunger_str, "weak", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "weak", sizeof(hunger_str));
messagef(1, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
if (rogue.moves_left <= FAINT) {
if (rogue.moves_left == FAINT) {
- (void) strlcpy(hunger_str, "faint", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "faint", sizeof(hunger_str));
messagef(1, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
mv_mons();
}
}
- messagef(1, you_can_move_again);
+ messagef(1, "%s", you_can_move_again);
}
}
if (msg_only) {
return(fainted);
}
if (rogue.moves_left <= STARVE) {
- killed_by((object *) 0, STARVATION);
+ killed_by(NULL, STARVATION);
}
switch(e_rings) {
break;
case 1:
rogue.moves_left--;
- (void) check_hunger(1);
+ (void)check_hunger(1);
rogue.moves_left -= (rogue.moves_left % 2);
break;
case 2:
rogue.moves_left--;
- (void) check_hunger(1);
+ (void)check_hunger(1);
rogue.moves_left--;
break;
}
}
boolean
-reg_move()
+reg_move(void)
{
boolean fainted;
}
void
-rest(count)
- int count;
+rest(int count)
{
int i;
if (interrupted) {
break;
}
- (void) reg_move();
+ (void)reg_move();
}
}
-char
-gr_dir()
+static char
+gr_dir(void)
{
short d;
return(d);
}
-void
-heal()
+static void
+heal(void)
{
static short heal_exp = -1, n, c = 0;
static boolean alt;
}
}
-boolean
-can_turn(nrow, ncol)
- short nrow, ncol;
+static boolean
+can_turn(short nrow, short ncol)
{
if ((dungeon[nrow][ncol] & TUNNEL) && is_passable(nrow, ncol)) {
return(1);
return(0);
}
-void
-turn_passage(dir, fast)
- short dir;
- boolean fast;
+static void
+turn_passage(short dir, boolean fast)
{
short crow = rogue.row, ccol = rogue.col, turns = 0;
short ndir = 0;