From 39a1066cab493ece48c6e692513d1311b7e27c44 Mon Sep 17 00:00:00 2001 From: dholland Date: Wed, 12 Aug 2009 08:44:45 +0000 Subject: sprinkle static --- rogue/inventory.c | 14 ++++-- rogue/message.c | 8 ++-- rogue/monster.c | 26 ++++++---- rogue/move.c | 23 +++++---- rogue/object.c | 35 +++++++++----- rogue/pack.c | 17 ++++--- rogue/random.c | 8 ++-- rogue/rogue.h | 54 +-------------------- rogue/room.c | 20 +++++--- rogue/score.c | 20 +++++--- rogue/throw.c | 8 +++- rogue/trap.c | 6 +-- rogue/use.c | 23 +++++---- snake/snake/snake.c | 123 ++++++++++++++++++++++++------------------------ snake/snscore/snscore.c | 10 ++-- tetris/screen.c | 8 ++-- tetris/screen.h | 3 +- tetris/tetris.c | 17 ++++--- tetris/tetris.h | 3 +- 19 files changed, 217 insertions(+), 209 deletions(-) diff --git a/rogue/inventory.c b/rogue/inventory.c index b1bc1595..1f744bde 100644 --- a/rogue/inventory.c +++ b/rogue/inventory.c @@ -1,4 +1,4 @@ -/* $NetBSD: inventory.c,v 1.13 2008/01/14 03:50:01 dholland Exp $ */ +/* $NetBSD: inventory.c,v 1.14 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: inventory.c,v 1.13 2008/01/14 03:50:01 dholland Exp $"); +__RCSID("$NetBSD: inventory.c,v 1.14 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -211,6 +211,10 @@ static const struct id_com_s com_id_tab[COMS] = { {'q', "q quaff potion" } }; +static int get_com_id(int *, short); +static int pr_com_id(int); +static int pr_motion_char(int); + void inventory(const object *pack, unsigned short mask) { @@ -355,7 +359,7 @@ MORE: } } -int +static int pr_com_id(int ch) { int i; @@ -368,7 +372,7 @@ pr_com_id(int ch) return(1); } -int +static int get_com_id(int *indexp, short ch) { short i; @@ -382,7 +386,7 @@ get_com_id(int *indexp, short ch) return(0); } -int +static int pr_motion_char(int ch) { if ( (ch == 'J') || diff --git a/rogue/message.c b/rogue/message.c index 73efdd9a..e38377de 100644 --- a/rogue/message.c +++ b/rogue/message.c @@ -1,4 +1,4 @@ -/* $NetBSD: message.c,v 1.13 2008/01/14 03:50:01 dholland Exp $ */ +/* $NetBSD: message.c,v 1.14 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: message.c,v 1.13 2008/01/14 03:50:01 dholland Exp $"); +__RCSID("$NetBSD: message.c,v 1.14 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -67,6 +67,8 @@ boolean msg_cleared = 1; char hunger_str[HUNGER_STR_LEN] = ""; const char *more = "-more-"; +static void save_screen(void); + static void message(const char *msg, boolean intrpt) @@ -316,7 +318,7 @@ print_stats(int stat_mask) refresh(); } -void +static void save_screen(void) { FILE *fp; diff --git a/rogue/monster.c b/rogue/monster.c index 3bfd918e..fd90f36d 100644 --- a/rogue/monster.c +++ b/rogue/monster.c @@ -1,4 +1,4 @@ -/* $NetBSD: monster.c,v 1.14 2008/01/14 03:50:01 dholland Exp $ */ +/* $NetBSD: monster.c,v 1.15 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: monster.c,v 1.14 2008/01/14 03:50:01 dholland Exp $"); +__RCSID("$NetBSD: monster.c,v 1.15 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -120,6 +120,14 @@ static object mon_tab[MONSTERS] = { {(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0,0,0,0} }; +static void aim_monster(object *); +static int flit(object *); +static int move_confused(object *); +static int mtry(object *, short, short); +static int no_room_for_monster(int); +static void put_m_at(short, short, object *); +static int rogue_is_around(int, int); + void put_mons(void) { @@ -433,7 +441,7 @@ O: } } -int +static int mtry(object *monster, short row, short col) { if (mon_can_go(monster, row, col)) { @@ -591,7 +599,7 @@ mon_name(const object *monster) return(m_names[ch]); } -int +static int rogue_is_around(int row, int col) { short rdif, cdif, retval; @@ -694,7 +702,7 @@ create_monster(void) } } -void +static void put_m_at(short row, short col, object *monster) { monster->row = row; @@ -705,7 +713,7 @@ put_m_at(short row, short col, object *monster) aim_monster(monster); } -void +static void aim_monster(object *monster) { short i, rn, d, r; @@ -738,7 +746,7 @@ rogue_can_see(int row, int col) return(retval); } -int +static int move_confused(object *monster) { short i, row, col; @@ -768,7 +776,7 @@ move_confused(object *monster) return(0); } -int +static int flit(object *monster) { short i, row, col; @@ -805,7 +813,7 @@ gr_obj_char(void) return(rs[r]); } -int +static int no_room_for_monster(int rn) { short i, j; diff --git a/rogue/move.c b/rogue/move.c index 73a2ce0e..7d1c2ca1 100644 --- a/rogue/move.c +++ b/rogue/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.11 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: move.c,v 1.12 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.11 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: move.c,v 1.12 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -59,6 +59,13 @@ short m_moves = 0; boolean jump = 0; 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(short dirch, short pickup) { @@ -231,7 +238,7 @@ is_passable(int row, int col) return(dungeon[row][col] & (FLOOR | TUNNEL | DOOR | STAIRS | TRAP)); } -boolean +static boolean next_to_something(int drow, int dcol) { short i, j, i_end, j_end, row, col; @@ -364,7 +371,7 @@ is_direction(short c, short *d) return(1); } -boolean +static boolean check_hunger(boolean msg_only) { short i, n; @@ -504,7 +511,7 @@ rest(int count) } } -char +static char gr_dir(void) { short d; @@ -540,7 +547,7 @@ gr_dir(void) return(d); } -void +static void heal(void) { static short heal_exp = -1, n, c = 0; @@ -605,7 +612,7 @@ heal(void) } } -boolean +static boolean can_turn(short nrow, short ncol) { if ((dungeon[nrow][ncol] & TUNNEL) && is_passable(nrow, ncol)) { @@ -614,7 +621,7 @@ can_turn(short nrow, short ncol) return(0); } -void +static void turn_passage(short dir, boolean fast) { short crow = rogue.row, ccol = rogue.col, turns = 0; diff --git a/rogue/object.c b/rogue/object.c index 0f475613..9897ec6a 100644 --- a/rogue/object.c +++ b/rogue/object.c @@ -1,4 +1,4 @@ -/* $NetBSD: object.c,v 1.13 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: object.c,v 1.14 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: object.c,v 1.13 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: object.c,v 1.14 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -162,6 +162,17 @@ struct id id_rings[RINGS] = { {270, "", "of searching ",0}, }; +static void gr_armor(object *); +static void gr_potion(object *); +static void gr_scroll(object *); +static void gr_wand(object *); +static void gr_weapon(object *, int); +static unsigned short gr_what_is(void); +static void make_party(void); +static void plant_gold(short, short, boolean); +static void put_gold(void); +static void rand_place(object *); + void put_objects(void) { @@ -185,7 +196,7 @@ put_objects(void) put_gold(); } -void +static void put_gold(void) { short i, j; @@ -215,7 +226,7 @@ put_gold(void) } } -void +static void plant_gold(short row, short col, boolean is_maze) { object *obj; @@ -379,7 +390,7 @@ gr_object(void) return(obj); } -unsigned short +static unsigned short gr_what_is(void) { short percent; @@ -405,7 +416,7 @@ gr_what_is(void) return(what_is); } -void +static void gr_scroll(object *obj) { short percent; @@ -443,7 +454,7 @@ gr_scroll(object *obj) } } -void +static void gr_potion(object *obj) { short percent; @@ -483,7 +494,7 @@ gr_potion(object *obj) } } -void +static void gr_weapon(object *obj, int assign_wk) { short percent; @@ -547,7 +558,7 @@ gr_weapon(object *obj, int assign_wk) } } -void +static void gr_armor(object *obj) { short percent; @@ -573,7 +584,7 @@ gr_armor(object *obj) } } -void +static void gr_wand(object *obj) { obj->what_is = WAND; @@ -640,7 +651,7 @@ free_object(object *obj) free_list = obj; } -void +static void make_party(void) { short n; @@ -702,7 +713,7 @@ put_amulet(void) rand_place(obj); } -void +static void rand_place(object *obj) { short row, col; diff --git a/rogue/pack.c b/rogue/pack.c index ac516df0..14bb6369 100644 --- a/rogue/pack.c +++ b/rogue/pack.c @@ -1,4 +1,4 @@ -/* $NetBSD: pack.c,v 1.10 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: pack.c,v 1.11 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pack.c,v 1.10 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: pack.c,v 1.11 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -57,6 +57,11 @@ __RCSID("$NetBSD: pack.c,v 1.10 2008/01/14 03:50:02 dholland Exp $"); const char *curse_message = "you can't, it appears to be cursed"; +static object *check_duplicate(object *, object *); +static boolean is_pack_letter(short *, unsigned short *); +static boolean mask_pack(const object *, unsigned short); +static short next_avail_ichar(void); + object * add_to_pack(object *obj, object *pack, int condense) { @@ -205,7 +210,7 @@ drop(void) (void)reg_move(); } -object * +static object * check_duplicate(object *obj, object *pack) { object *op; @@ -238,7 +243,7 @@ check_duplicate(object *obj, object *pack) return(0); } -short +static short next_avail_ichar(void) { object *obj; @@ -488,7 +493,7 @@ pack_count(const object *new_obj) return(count); } -boolean +static boolean mask_pack(const object *pack, unsigned short mask) { while (pack->next_object) { @@ -500,7 +505,7 @@ mask_pack(const object *pack, unsigned short mask) return(0); } -boolean +static boolean is_pack_letter(short *c, unsigned short *mask) { if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') || diff --git a/rogue/random.c b/rogue/random.c index e527903c..f119c0f9 100644 --- a/rogue/random.c +++ b/rogue/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.7 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: random.c,v 1.8 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: random.c,v 1.7 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: random.c,v 1.8 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -73,6 +73,8 @@ static int rand_deg = 31; static int rand_sep = 3; static long *end_ptr = &rntb[32]; +static long rrandom(void); + void srrandom(int x) { @@ -91,7 +93,7 @@ srrandom(int x) } } -long +static long rrandom(void) { long i; diff --git a/rogue/rogue.h b/rogue/rogue.h index e765467b..e46de5d8 100644 --- a/rogue/rogue.h +++ b/rogue/rogue.h @@ -1,4 +1,4 @@ -/* $NetBSD: rogue.h,v 1.19 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: rogue.h,v 1.20 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -443,10 +443,7 @@ struct rogue_time { #include object *alloc_object(void); -object *check_duplicate(object *, object *); -const char *get_ench_color(void); object *get_letter_object(int); -object *get_thrown_at_monster(object *, short, short *, short *); object *gr_monster(object *, int); object *gr_object(void); char *md_getenv(const char *); @@ -460,16 +457,12 @@ object *pick_up(int, int, short *); void add_exp(int, boolean); void add_traps(void); void aggravate(void); -void aim_monster(object *); void bounce(short, short, short, short, short); void byebye(int); void c_object_for_wizard(void); void call_it(void); boolean can_move(int, int, int, int); -boolean can_turn(short, short); -void center(short, const char *); void check_gold_seeker(object *); -boolean check_hunger(boolean); boolean check_imitator(object *); void check_message(void); int check_up(void); @@ -493,12 +486,9 @@ void edit_opts(void); void error_save(int) __attribute__((__noreturn__)); void fight(boolean); boolean flame_broil(object *); -int flit(object *); -void flop_weapon(object *, short, short); void free_object(object *); void free_stuff(object *); int get_armor_class(const object *); -int get_com_id(int *, short); int get_damage(const char *, boolean); void get_desc(const object *, char *, size_t); void get_dir_rc(short, short *, short *, short); @@ -508,35 +498,22 @@ int get_hit_chance(const object *); int get_input_line(const char *, const char *, char *, size_t, const char *, boolean, boolean); char get_mask_char(unsigned short); int get_number(const char *); -boolean get_oth_room(short, short *, short *); int get_rand(int, int); short get_room_number(int, int); -int get_value(const object *); void get_wand_and_ring_materials(void); int get_weapon_damage(const object *); char gmc(object *); char gmc_row_col(int, int); -void go_blind(void); -void gr_armor(object *); -char gr_dir(void); char gr_obj_char(void); -void gr_potion(object *); void gr_ring(object *, boolean); short gr_room(void); void gr_row_col(short *, short *, unsigned short); -void gr_scroll(object *); -void gr_wand(object *); -void gr_weapon(object *, int); void hallucinate(void); boolean has_amulet(void); -void heal(void); -void hold_monster(void); int hp_raise(void); -void id_all(void); void id_com(void); void id_trap(void); void id_type(void); -void idntfy(void); boolean imitating(short, short); int init(int, char **); void insert_score(char [][82], char [][30], const char *, short, short, const object *, int); @@ -546,7 +523,6 @@ void inventory(const object *, unsigned short); boolean is_all_connected(void); boolean is_digit(int); boolean is_direction(short, short *); -boolean is_pack_letter(short *, unsigned short *); boolean is_passable(int, int); boolean is_vowel(short); void kick_into_pack(void); @@ -556,9 +532,7 @@ void light_passage(int, int); void light_up_room(int); boolean m_confuse(object *); void make_level(void); -void make_party(void); void make_scroll_titles(void); -boolean mask_pack(const object *, unsigned short); boolean md_df(const char *); void md_exit(int) __attribute__((__noreturn__)); void md_gct(struct rogue_time *); @@ -580,39 +554,25 @@ int mon_can_go(const object *, short, short); int mon_damage(object *, short); void mon_hit(object *); boolean mon_sees(const object *, int, int); -int move_confused(object *); void move_mon_to(object *, short, short); void move_onto(void); -int mtry(object *, short, short); void multiple_move_rogue(short); void mv_1_monster(object *, short, short); void mv_aquatars(void); void mv_mons(void); int name_cmp(char *, const char *); -short next_avail_ichar(void); -boolean next_to_something(int, int); void nickize(char *, const char *, const char *); -int no_room_for_monster(int); int one_move_rogue(short, short); void onintr(int); -void opt_erase(int); -void opt_go(int); -void opt_show(int); short pack_count(const object *); short pack_letter(const char *, unsigned short); void pad(const char *, short); void party_monsters(int, int); short party_objects(int); void place_at(object *, int, int); -void plant_gold(short, short, boolean); void play_level(void); -void potion_heal(int); -int pr_com_id(int); -int pr_motion_char(int); void print_stats(int); void put_amulet(void); -void put_gold(void); -void put_m_at(short, short, object *); void put_mons(void); void put_objects(void); void put_on_ring(void); @@ -624,7 +584,6 @@ void quit(boolean); int r_index(const char *, int, boolean); void rand_around(short, short *, short *); int rand_percent(int); -void rand_place(object *); void read_scroll(void); boolean reg_move(void); void relight(void); @@ -637,17 +596,12 @@ void ring_stats(boolean); int rogue_can_see(int, int); void rogue_damage(short, object *, short); void rogue_hit(object *, boolean); -int rogue_is_around(int, int); -long rrandom(void); void rust(object *); void s_con_mon(object *); void save_game(void); void save_into_file(const char *); -void save_screen(void); void search(short, boolean); boolean seek_gold(object *); -void sell_pack(void); -void sf_error(void) __attribute__((__noreturn__)); void show_average_hp(void); void show_monsters(void); void show_objects(void); @@ -663,19 +617,14 @@ void take_from_pack(object *, object *); void take_off(void); void tele(void); void throw(void); -boolean throw_at_monster(object *, object *); -short trap_at(int, int); void trap_player(short, short); -void turn_passage(short, boolean); void un_put_on(object *); void unblind(void); void unconfuse(void); -void uncurse_all(void); void unhallucinate(void); void unwear(object *); void unwield(object *); void vanish(object *, short, object *); -void visit_rooms(int); void wait_for_ack(void); void wake_room(short, boolean, short, short); void wake_up(object *); @@ -689,7 +638,6 @@ void xxxx(char *, short); void zapp(void); object *add_to_pack(object *, object *, int); struct id *get_id_table(const object *); -unsigned short gr_what_is(void); extern boolean ask_quit; extern boolean being_held; diff --git a/rogue/room.c b/rogue/room.c index 6494046d..0071489f 100644 --- a/rogue/room.c +++ b/rogue/room.c @@ -1,4 +1,4 @@ -/* $NetBSD: room.c,v 1.12 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: room.c,v 1.13 2009/08/12 08:44:45 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.12 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: room.c,v 1.13 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -96,6 +96,12 @@ static const struct option { } }; +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(int rn) { @@ -346,7 +352,7 @@ is_all_connected(void) return(1); } -void +static void visit_rooms(int rn) { short i; @@ -486,7 +492,7 @@ dr_course(object *monster, boolean entering, short row, short col) } } -boolean +static boolean get_oth_room(short rn, short *row, short *col) { short d = -1; @@ -612,7 +618,7 @@ CH: } } -void +static void opt_show(int i) { const char *s; @@ -628,7 +634,7 @@ opt_show(int i) addstr(s); } -void +static void opt_erase(int i) { const struct option *opt = &options[i]; @@ -637,7 +643,7 @@ opt_erase(int i) clrtoeol(); } -void +static void opt_go(int i) { move(i, strlen(options[i].prompt)); diff --git a/rogue/score.c b/rogue/score.c index f094fa2d..231f0c6d 100644 --- a/rogue/score.c +++ b/rogue/score.c @@ -1,4 +1,4 @@ -/* $NetBSD: score.c,v 1.14 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: score.c,v 1.15 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: score.c,v 1.14 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: score.c,v 1.15 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -57,6 +57,12 @@ __RCSID("$NetBSD: score.c,v 1.14 2008/01/14 03:50:02 dholland Exp $"); #include "rogue.h" #include "pathnames.h" +static void center(short, const char *); +static int get_value(const object *); +static void id_all(void); +static void sell_pack(void); +static void sf_error(void) __attribute__((__noreturn__)); + void killed_by(const object *monster, short other) { @@ -516,7 +522,7 @@ is_vowel(short ch) (ch == 'u') ); } -void +static void sell_pack(void) { object *obj; @@ -548,7 +554,7 @@ sell_pack(void) messagef(0, "%s", ""); /* gcc objects to just "" */ } -int +static int get_value(const object *obj) { short wc; @@ -596,7 +602,7 @@ get_value(const object *obj) return(val); } -void +static void id_all(void) { short i; @@ -650,7 +656,7 @@ xxx(boolean st) return(r); } -void +static void center(short row, const char *buf) { short margin; @@ -659,7 +665,7 @@ center(short row, const char *buf) mvaddstr(row, margin, buf); } -void +static void sf_error(void) { md_lock(0); diff --git a/rogue/throw.c b/rogue/throw.c index e55e05ee..f8663dc9 100644 --- a/rogue/throw.c +++ b/rogue/throw.c @@ -1,4 +1,4 @@ -/* $NetBSD: throw.c,v 1.10 2008/01/14 03:50:03 dholland Exp $ */ +/* $NetBSD: throw.c,v 1.11 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: throw.c,v 1.10 2008/01/14 03:50:03 dholland Exp $"); +__RCSID("$NetBSD: throw.c,v 1.11 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -55,6 +55,10 @@ __RCSID("$NetBSD: throw.c,v 1.10 2008/01/14 03:50:03 dholland Exp $"); #include "rogue.h" +static void flop_weapon(object *, short, short); +static object *get_thrown_at_monster(object *, short, short *, short *); +static boolean throw_at_monster(object *, object *); + void throw(void) { diff --git a/rogue/trap.c b/rogue/trap.c index 6b9188e5..ae3c9186 100644 --- a/rogue/trap.c +++ b/rogue/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.9 2008/01/14 03:50:03 dholland Exp $ */ +/* $NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: trap.c,v 1.9 2008/01/14 03:50:03 dholland Exp $"); +__RCSID("$NetBSD: trap.c,v 1.10 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -74,7 +74,7 @@ static const char *const trap_strings[TRAPS * 2] = { "a gush of water hits you on the head" }; -short +static short trap_at(int row, int col) { short i; diff --git a/rogue/use.c b/rogue/use.c index b02b554b..8371a6f0 100644 --- a/rogue/use.c +++ b/rogue/use.c @@ -1,4 +1,4 @@ -/* $NetBSD: use.c,v 1.9 2008/01/14 03:50:03 dholland Exp $ */ +/* $NetBSD: use.c,v 1.10 2009/08/12 08:44:45 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)use.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: use.c,v 1.9 2008/01/14 03:50:03 dholland Exp $"); +__RCSID("$NetBSD: use.c,v 1.10 2009/08/12 08:44:45 dholland Exp $"); #endif #endif /* not lint */ @@ -68,6 +68,13 @@ boolean con_mon = 0; static const char strange_feeling[] = "you have a strange feeling for a moment, then it passes"; +static const char *get_ench_color(void); +static void go_blind(void); +static void hold_monster(void); +static void idntfy(void); +static void potion_heal(int); +static void uncurse_all(void); + void quaff(void) { @@ -310,7 +317,7 @@ vanish(object *obj, short rm, object *pack) } } -void +static void potion_heal(int extra) { float ratio; @@ -356,7 +363,7 @@ potion_heal(int extra) } } -void +static void idntfy(void) { short ch; @@ -424,7 +431,7 @@ eat(void) vanish(obj, 1, &rogue.pack); } -void +static void hold_monster(void) { short i, j; @@ -548,7 +555,7 @@ take_a_nap(void) messagef(0, "%s", you_can_move_again); } -void +static void go_blind(void) { short i, j; @@ -580,7 +587,7 @@ go_blind(void) mvaddch(rogue.row, rogue.col, rogue.fchar); } -const char * +static const char * get_ench_color(void) { if (halluc) { @@ -604,7 +611,7 @@ unconfuse(void) messagef(1, "you feel less %s now", (halluc ? "trippy" : "confused")); } -void +static void uncurse_all(void) { object *obj; diff --git a/snake/snake/snake.c b/snake/snake/snake.c index cac56136..2db38721 100644 --- a/snake/snake/snake.c +++ b/snake/snake/snake.c @@ -1,4 +1,4 @@ -/* $NetBSD: snake.c,v 1.25 2008/08/08 16:10:47 drochner Exp $ */ +/* $NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94"; #else -__RCSID("$NetBSD: snake.c,v 1.25 2008/08/08 16:10:47 drochner Exp $"); +__RCSID("$NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $"); #endif #endif /* not lint */ @@ -99,44 +99,43 @@ struct point { #define pchar(point, c) mvaddch((point)->line + 1, (point)->col + 1, (c)) #define delay(t) usleep(t * 50000); -struct point you; -struct point money; -struct point finish; -struct point snake[6]; +static struct point you; +static struct point money; +static struct point finish; +static struct point snake[6]; + +static int loot, penalty; +static int moves; +static int fast = 1; + +static int rawscores; +static FILE *logfile; + +static int lcnt, ccnt; /* user's idea of screen size */ +static int chunk; /* amount of money given at a time */ + +static void chase(struct point *, struct point *); +static int chk(const struct point *); +static void drawbox(void); +static void flushi(void); +static void length(int); +static void logit(const char *); +static void mainloop(void) __dead; +static struct point *point(struct point *, int, int); +static int post(int, int); +static int pushsnake(void); +static void setup(void); +static void snap(void); +static void snrand(struct point *); +static void spacewarp(int); +static void stop(int) __dead; +static int stretch(const struct point *); +static void surround(struct point *); +static void suspend(void); +static void win(const struct point *); +static void winnings(int); -int loot, penalty; -int moves; -int fast = 1; - -int rawscores; -FILE *logfile; - -int lcnt, ccnt; /* user's idea of screen size */ -int chunk; /* amount of money given at a time */ - -void chase(struct point *, struct point *); -int chk(const struct point *); -void drawbox(void); -void flushi(void); -void home(void); -void length(int); -void logit(const char *); int main(int, char **); -void mainloop(void) __dead; -struct point *point(struct point *, int, int); -int post(int, int); -int pushsnake(void); -void right(const struct point *); -void setup(void); -void snap(void); -void snrand(struct point *); -void spacewarp(int); -void stop(int) __dead; -int stretch(const struct point *); -void surround(struct point *); -void suspend(void); -void win(const struct point *); -void winnings(int); int main(argc, argv) @@ -247,7 +246,7 @@ main(argc, argv) return (0); } -struct point * +static struct point * point(ps, x, y) struct point *ps; int x, y; @@ -258,7 +257,7 @@ point(ps, x, y) } /* Main command loop */ -void +static void mainloop() { int k; @@ -447,7 +446,7 @@ mainloop() /* * setup the board */ -void +static void setup() { int i; @@ -464,7 +463,7 @@ setup() refresh(); } -void +static void drawbox() { int i; @@ -479,7 +478,7 @@ drawbox() } } -void +static void snrand(sp) struct point *sp; { @@ -509,7 +508,7 @@ snrand(sp) *sp = p; } -int +static int post(iscore, flag) int iscore, flag; { @@ -584,24 +583,24 @@ post(iscore, flag) * overshooting. This loses horribly at 9600 baud, but works nicely * if the terminal gets behind. */ -void +static void flushi() { tcflush(0, TCIFLUSH); } -const int mx[8] = { +static const int mx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }; -const int my[8] = { +static const int my[8] = { -1, -1, 0, 1, 1, 1, 0, -1 }; -const float absv[8] = { +static const float absv[8] = { 1, 1.4, 1, 1.4, 1, 1.4, 1, 1.4 }; -int oldw = 0; +static int oldw = 0; -void +static void chase(np, sp) struct point *sp, *np; { @@ -663,7 +662,7 @@ chase(np, sp) point(np, sp->col + mx[w], sp->line + my[w]); } -void +static void spacewarp(w) int w; { @@ -697,7 +696,7 @@ spacewarp(w) winnings(cashvalue); } -void +static void snap() { #if 0 /* This code doesn't really make sense. */ @@ -744,7 +743,7 @@ snap() refresh(); } -int +static int stretch(ps) const struct point *ps; { @@ -792,7 +791,7 @@ stretch(ps) return (0); } -void +static void surround(ps) struct point *ps; { @@ -836,7 +835,7 @@ surround(ps) delay(6); } -void +static void win(ps) const struct point *ps; { @@ -869,7 +868,7 @@ win(ps) } } -int +static int pushsnake() { int i, bonus; @@ -926,7 +925,7 @@ pushsnake() return (0); } -int +static int chk(sp) const struct point *sp; { @@ -964,7 +963,7 @@ chk(sp) return (0); } -void +static void winnings(won) int won; { @@ -973,7 +972,7 @@ winnings(won) } } -void +static void stop(dummy) int dummy __unused; { @@ -983,7 +982,7 @@ stop(dummy) exit(0); } -void +static void suspend() { endwin(); @@ -992,14 +991,14 @@ suspend() winnings(cashvalue); } -void +static void length(num) int num; { printf("You made %d moves.\n", num); } -void +static void logit(msg) const char *msg; { diff --git a/snake/snscore/snscore.c b/snake/snscore/snscore.c index b09d5180..74c840db 100644 --- a/snake/snscore/snscore.c +++ b/snake/snscore/snscore.c @@ -1,4 +1,4 @@ -/* $NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $ */ +/* $NetBSD: snscore.c,v 1.18 2009/08/12 08:48:56 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93"; #else -__RCSID("$NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $"); +__RCSID("$NetBSD: snscore.c,v 1.18 2009/08/12 08:48:56 dholland Exp $"); #endif #endif /* not lint */ @@ -52,14 +52,16 @@ __RCSID("$NetBSD: snscore.c,v 1.17 2008/07/20 01:03:22 lukem Exp $"); #include #include "pathnames.h" -const char *recfile = _PATH_RAWSCORES; +static const char *recfile = _PATH_RAWSCORES; #define MAXPLAYERS 256 struct player { short uids; short scores; char *name; -} players[MAXPLAYERS], temp; +}; + +static struct player players[MAXPLAYERS], temp; int main(void); diff --git a/tetris/screen.c b/tetris/screen.c index edbcddf9..38efd686 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.23 2009/05/25 04:33:53 dholland Exp $ */ +/* $NetBSD: screen.c,v 1.24 2009/08/12 08:51:21 dholland Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -70,7 +70,7 @@ static void stopset(int) __dead; /* * Capabilities from TERMCAP. */ -short ospeed; +extern short ospeed; static char *bcstr, /* backspace char */ @@ -94,7 +94,7 @@ static int MSflag; /* can move in standout mode */ -struct tcsinfo { /* termcap string info; some abbrevs above */ +static struct tcsinfo { /* termcap string info; some abbrevs above */ char tcname[3]; char **tcaddr; } tcstrings[] = { @@ -136,7 +136,7 @@ put(int c) */ #define putstr(s) (void)fputs(s, stdout) -void +static void moveto(int r, int c) { char buf[256]; diff --git a/tetris/screen.h b/tetris/screen.h index 99779e07..c0b39053 100644 --- a/tetris/screen.h +++ b/tetris/screen.h @@ -1,4 +1,4 @@ -/* $NetBSD: screen.h,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ +/* $NetBSD: screen.h,v 1.9 2009/08/12 08:51:21 dholland Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -45,7 +45,6 @@ extern char *SOstr; /* begin standout mode */ */ #define putpad(s) tputs(s, 1, put) -void moveto(int, int); int put(int); /* just calls putchar; for tputs */ void scr_clear(void); void scr_end(void); diff --git a/tetris/tetris.c b/tetris/tetris.c index 69b2312f..9584026a 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.21 2009/05/25 04:33:53 dholland Exp $ */ +/* $NetBSD: tetris.c,v 1.22 2009/08/12 08:51:21 dholland Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -63,7 +63,7 @@ cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ int Rows, Cols; /* current screen size */ -const struct shape *curshape; +static const struct shape *curshape; const struct shape *nextshape; long fallrate; /* less than 1 million; smaller => faster */ @@ -74,11 +74,10 @@ gid_t gid, egid; char key_msg[100]; int showpreview; -static void elide(void); -static void setup_board(void); - int main(int, char **); - void onintr(int) __dead; - void usage(void) __dead; +static void elide(void); +static void setup_board(void); +static void onintr(int) __dead; +static void usage(void) __dead; /* * Set up the initial board. The bottom display row is completely set, @@ -318,7 +317,7 @@ main(int argc, char *argv[]) exit(0); } -void +static void onintr(int signo __unused) { scr_clear(); @@ -326,7 +325,7 @@ onintr(int signo __unused) exit(0); } -void +static void usage(void) { (void)fprintf(stderr, "usage: tetris [-ps] [-k keys] [-l level]\n"); diff --git a/tetris/tetris.h b/tetris/tetris.h index 35a70a3c..37f0d9ba 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.11 2009/05/25 04:33:53 dholland Exp $ */ +/* $NetBSD: tetris.h,v 1.12 2009/08/12 08:51:21 dholland Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -130,7 +130,6 @@ struct shape { extern const struct shape shapes[]; #define randshape() (&shapes[random() % 7]) -extern const struct shape *curshape; extern const struct shape *nextshape; /* -- cgit v1.2.3-56-ge451