From 171895fb3091b20b772c7ce10af67d5d5e3c03f9 Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 14 Jan 2008 03:50:01 +0000 Subject: ANSIfy. Remove unnecessary casts. Clean up for -Wsign-compare. Make more things file-static. Other minor tidyups, and fix a couple minor bugs found along the way. --- rogue/room.c | 79 ++++++++++++++++++++++++------------------------------------ 1 file changed, 31 insertions(+), 48 deletions(-) (limited to 'rogue/room.c') diff --git a/rogue/room.c b/rogue/room.c index 01bc4b4a..6494046d 100644 --- a/rogue/room.c +++ b/rogue/room.c @@ -1,4 +1,4 @@ -/* $NetBSD: room.c,v 1.11 2008/01/14 00:23:52 dholland Exp $ */ +/* $NetBSD: room.c,v 1.12 2008/01/14 03:50:02 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: room.c,v 1.11 2008/01/14 00:23:52 dholland Exp $"); +__RCSID("$NetBSD: room.c,v 1.12 2008/01/14 03:50:02 dholland Exp $"); #endif #endif /* not lint */ @@ -56,11 +56,11 @@ __RCSID("$NetBSD: room.c,v 1.11 2008/01/14 00:23:52 dholland Exp $"); #include "rogue.h" room rooms[MAXROOMS]; -boolean rooms_visited[MAXROOMS]; -#define NOPTS 7 +static boolean rooms_visited[MAXROOMS]; -const struct option { +#define NOPTS 7 +static const struct option { const char *prompt; boolean is_bool; char **strval; @@ -68,37 +68,36 @@ const struct option { } 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, (boolean *)0 + 0, &nick_name, NULL }, { "Fruit (\"fruit\"): ", - 0, &fruit, (boolean *)0 + 0, &fruit, NULL }, { "Save file (\"file\"): ", - 0, &save_file, (boolean *)0 + 0, &save_file, NULL } }; void -light_up_room(rn) - int rn; +light_up_room(int rn) { short i, j; @@ -126,8 +125,7 @@ light_up_room(rn) } void -light_passage(row, col) - int row, col; +light_passage(int row, int col) { short i, j, i_end, j_end; @@ -147,8 +145,7 @@ light_passage(row, col) } void -darken_room(rn) - short rn; +darken_room(short rn) { short i, j; @@ -172,8 +169,7 @@ darken_room(rn) } char -get_dungeon_char(row, col) - short row, col; +get_dungeon_char(short row, short col) { unsigned short mask = dungeon[row][col]; @@ -221,8 +217,7 @@ get_dungeon_char(row, col) } char -get_mask_char(mask) - unsigned short mask; +get_mask_char(unsigned short mask) { switch(mask) { case SCROL: @@ -249,9 +244,7 @@ get_mask_char(mask) } 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; @@ -271,7 +264,7 @@ gr_row_col(row, col, mask) } short -gr_room() +gr_room(void) { short i; @@ -283,8 +276,7 @@ gr_room() } short -party_objects(rn) - int rn; +party_objects(int rn) { short i, j, nf = 0; object *obj; @@ -318,8 +310,7 @@ party_objects(rn) } short -get_room_number(row, col) - int row, col; +get_room_number(int row, int col) { short i; @@ -333,7 +324,7 @@ get_room_number(row, col) } boolean -is_all_connected() +is_all_connected(void) { short i, starting_room; @@ -356,8 +347,7 @@ is_all_connected() } void -visit_rooms(rn) - int rn; +visit_rooms(int rn) { short i; short oth_rn; @@ -373,7 +363,7 @@ visit_rooms(rn) } void -draw_magic_map() +draw_magic_map(void) { short i, j, ch, och; unsigned short mask = (HORWALL | VERTWALL | DOOR | TUNNEL | TRAP | STAIRS | @@ -423,10 +413,7 @@ draw_magic_map() } 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; @@ -500,8 +487,7 @@ dr_course(monster, entering, row, col) } boolean -get_oth_room(rn, row, col) - short rn, *row, *col; +get_oth_room(short rn, short *row, short *col) { short d = -1; @@ -523,7 +509,7 @@ get_oth_room(rn, row, col) } void -edit_opts() +edit_opts(void) { char save[NOPTS+1][DCOLS]; short i, j; @@ -627,8 +613,7 @@ CH: } void -opt_show(i) - int i; +opt_show(int i) { const char *s; const struct option *opt = &options[i]; @@ -644,8 +629,7 @@ opt_show(i) } void -opt_erase(i) - int i; +opt_erase(int i) { const struct option *opt = &options[i]; @@ -654,14 +638,13 @@ opt_erase(i) } void -opt_go(i) - int i; +opt_go(int i) { move(i, strlen(options[i].prompt)); } void -do_shell() +do_shell(void) { #ifdef UNIX const char *sh; -- cgit v1.2.3-56-ge451