-/* $NetBSD: room.c,v 1.8 2006/03/30 04:41:15 jnemeth Exp $ */
+/* $NetBSD: room.c,v 1.14 2019/02/03 03:19:25 mrg Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: room.c,v 1.8 2006/03/30 04:41:15 jnemeth Exp $");
+__RCSID("$NetBSD: room.c,v 1.14 2019/02/03 03:19:25 mrg Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
room rooms[MAXROOMS];
-boolean rooms_visited[MAXROOMS];
-#define NOPTS 7
+static boolean rooms_visited[MAXROOMS];
-struct option {
+#define NOPTS 7
+static const struct option {
const char *prompt;
boolean is_bool;
char **strval;
} options[NOPTS] = {
{
"Show position only at end of run (\"jump\"): ",
- 1, (char **) 0, &jump
+ 1, NULL, &jump
},
{
"Follow turnings in passageways (\"passgo\"): ",
- 1, (char **) 0, &passgo
+ 1, NULL, &passgo
},
{
"Don't print skull when killed (\"noskull\" or \"notombstone\"): ",
- 1, (char **) 0, &no_skull
+ 1, NULL, &no_skull
},
{
"Ask player before saying 'Okay, bye-bye!' (\"askquit\"): ",
- 1, (char **) 0, &ask_quit
+ 1, NULL, &ask_quit
},
{
"Name (\"name\"): ",
- 0, &nick_name
+ 0, &nick_name, NULL
},
{
"Fruit (\"fruit\"): ",
- 0, &fruit
+ 0, &fruit, NULL
},
{
"Save file (\"file\"): ",
- 0, &save_file
+ 0, &save_file, NULL
}
};
+static boolean get_oth_room(short, short *, short *);
+static void opt_erase(int);
+static void opt_go(int);
+static void opt_show(int);
+static void visit_rooms(int);
+
void
-light_up_room(rn)
- int rn;
+light_up_room(int rn)
{
short i, j;
}
void
-light_passage(row, col)
- int row, col;
+light_passage(int row, int col)
{
short i, j, i_end, j_end;
}
void
-darken_room(rn)
- short rn;
+darken_room(short rn)
{
short i, j;
}
char
-get_dungeon_char(row, col)
- short row, col;
+get_dungeon_char(short row, short col)
{
unsigned short mask = dungeon[row][col];
}
char
-get_mask_char(mask)
- unsigned short mask;
+get_mask_char(unsigned short mask)
{
switch(mask) {
case SCROL:
}
void
-gr_row_col(row, col, mask)
- short *row, *col;
- unsigned short mask;
+gr_row_col(short *row, short *col, unsigned short mask)
{
short rn;
short r, c;
}
short
-gr_room()
+gr_room(void)
{
short i;
}
short
-party_objects(rn)
- int rn;
+party_objects(int rn)
{
short i, j, nf = 0;
object *obj;
}
short
-get_room_number(row, col)
- int row, col;
+get_room_number(int row, int col)
{
short i;
}
boolean
-is_all_connected()
+is_all_connected(void)
{
short i, starting_room;
return(1);
}
-void
-visit_rooms(rn)
- int rn;
+static void
+visit_rooms(int rn)
{
short i;
short oth_rn;
}
void
-draw_magic_map()
+draw_magic_map(void)
{
short i, j, ch, och;
unsigned short mask = (HORWALL | VERTWALL | DOOR | TUNNEL | TRAP | STAIRS |
}
void
-dr_course(monster, entering, row, col)
- object *monster;
- boolean entering;
- short row, col;
+dr_course(object *monster, boolean entering, short row, short col)
{
short i, j, k, rn;
short r, rr;
/* no place to send monster */
monster->trow = NO_ROOM;
} else { /* exiting room */
- if (!get_oth_room(rn, &row, &col)) {
+ if (rn == NO_ROOM || !get_oth_room(rn, &row, &col)) {
monster->trow = NO_ROOM;
} else {
monster->trow = row;
}
}
-boolean
-get_oth_room(rn, row, col)
- short rn, *row, *col;
+static boolean
+get_oth_room(short rn, short *row, short *col)
{
short d = -1;
}
void
-edit_opts()
+edit_opts(void)
{
char save[NOPTS+1][DCOLS];
short i, j;
opt_go(++i);
break;
}
+ /* FALLTHROUGH */
default:
if (options[i].is_bool) {
sound_bell();
ch = rgetchar();
} while ((ch != '\012') && (ch != '\015') && (ch != '\033'));
if (j != 0) {
- (void) strcpy(*(options[i].strval), buf);
+ /*
+ * We rely on the option string being
+ * allocated to hold MAX_OPT_LEN+2
+ * bytes. This is arranged in init.c.
+ */
+ (void)strcpy(*(options[i].strval), buf);
}
opt_show(i);
goto CH;
}
}
-void
-opt_show(i)
- int i;
+static void
+opt_show(int i)
{
const char *s;
- struct option *opt = &options[i];
+ const struct option *opt = &options[i];
opt_erase(i);
addstr(s);
}
-void
-opt_erase(i)
- int i;
+static void
+opt_erase(int i)
{
- struct option *opt = &options[i];
+ const struct option *opt = &options[i];
mvaddstr(i, 0, opt->prompt);
clrtoeol();
}
-void
-opt_go(i)
- int i;
+static void
+opt_go(int i)
{
move(i, strlen(options[i].prompt));
}
void
-do_shell()
+do_shell(void)
{
#ifdef UNIX
const char *sh;