-/* $NetBSD: object.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: object.c,v 1.14 2009/08/12 08:44:45 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: object.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: object.c,v 1.14 2009/08/12 08:44:45 dholland Exp $");
#endif
#endif /* not lint */
object level_objects;
unsigned short dungeon[DROWS][DCOLS];
short foods = 0;
-object *free_list = (object *) 0;
-char *fruit = (char *) 0;
+char *fruit = NULL;
+
+static object *free_list = NULL;
fighter rogue = {
INIT_AW, /* armor */
{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()
+put_objects(void)
{
short i, n;
object *obj;
put_gold();
}
-void
-put_gold()
+static void
+put_gold(void)
{
short i, j;
short row,col;
}
}
-void
-plant_gold(row, col, is_maze)
- short row, col;
- boolean is_maze;
+static void
+plant_gold(short row, short col, boolean is_maze)
{
object *obj;
obj->quantity += obj->quantity / 2;
}
dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
+ (void)add_to_pack(obj, &level_objects, 0);
}
void
-place_at(obj, row, col)
- object *obj;
- int row, col;
+place_at(object *obj, int row, int col)
{
obj->row = row;
obj->col = col;
dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
+ (void)add_to_pack(obj, &level_objects, 0);
}
object *
-object_at(pack, row, col)
- object *pack;
- short row, col;
+object_at(object *pack, short row, short col)
{
- object *obj = (object *) 0;
+ object *obj = NULL;
if (dungeon[row][col] & (MONSTER | OBJECT)) {
obj = pack->next_object;
}
object *
-get_letter_object(ch)
- int ch;
+get_letter_object(int ch)
{
object *obj;
}
void
-free_stuff(objlist)
- object *objlist;
+free_stuff(object *objlist)
{
object *obj;
}
const char *
-name_of(obj)
- const object *obj;
+name_of(const object *obj)
{
const char *retstring;
}
object *
-gr_object()
+gr_object(void)
{
object *obj;
return(obj);
}
-unsigned short
-gr_what_is()
+static unsigned short
+gr_what_is(void)
{
short percent;
unsigned short what_is;
return(what_is);
}
-void
-gr_scroll(obj)
- object *obj;
+static void
+gr_scroll(object *obj)
{
short percent;
}
}
-void
-gr_potion(obj)
- object *obj;
+static void
+gr_potion(object *obj)
{
short percent;
}
}
-void
-gr_weapon(obj, assign_wk)
- object *obj;
- int assign_wk;
+static void
+gr_weapon(object *obj, int assign_wk)
{
short percent;
short i;
obj->which_kind = get_rand(0, (WEAPONS - 1));
}
if ((obj->which_kind == ARROW) || (obj->which_kind == DAGGER) ||
- (obj->which_kind == SHURIKEN) | (obj->which_kind == DART)) {
+ (obj->which_kind == SHURIKEN) || (obj->which_kind == DART)) {
obj->quantity = get_rand(3, 15);
obj->quiver = get_rand(0, 126);
} else {
}
}
-void
-gr_armor(obj)
- object *obj;
+static void
+gr_armor(object *obj)
{
short percent;
short blessing;
}
}
-void
-gr_wand(obj)
- object *obj;
+static void
+gr_wand(object *obj)
{
obj->what_is = WAND;
obj->which_kind = get_rand(0, (WANDS - 1));
}
void
-get_food(obj, force_ration)
- object *obj;
- boolean force_ration;
+get_food(object *obj, boolean force_ration)
{
obj->what_is = FOOD;
}
void
-put_stairs()
+put_stairs(void)
{
short row, col;
}
int
-get_armor_class(obj)
- const object *obj;
+get_armor_class(const object *obj)
{
if (obj) {
return(obj->class + obj->d_enchant);
}
object *
-alloc_object()
+alloc_object(void)
{
object *obj;
if (free_list) {
obj = free_list;
free_list = free_list->next_object;
- } else if (!(obj = (object *) md_malloc(sizeof(object)))) {
+ } else if (!(obj = md_malloc(sizeof(object)))) {
messagef(0, "cannot allocate object, saving game");
save_into_file(error_file);
clean_up("alloc_object: save failed");
}
void
-free_object(obj)
- object *obj;
+free_object(object *obj)
{
obj->next_object = free_list;
free_list = obj;
}
-void
-make_party()
+static void
+make_party(void)
{
short n;
}
void
-show_objects()
+show_objects(void)
{
object *obj;
short mc, rc, row, col;
while (monster) {
if (monster->m_flags & IMITATES) {
- mvaddch(monster->row, monster->col, (int) monster->disguise);
+ mvaddch(monster->row, monster->col, (int)monster->disguise);
}
monster = monster->next_monster;
}
}
void
-put_amulet()
+put_amulet(void)
{
object *obj;
rand_place(obj);
}
-void
-rand_place(obj)
- object *obj;
+static void
+rand_place(object *obj)
{
short row, col;
}
void
-c_object_for_wizard()
+c_object_for_wizard(void)
{
short ch, max, wk;
object *obj;
char buf[80];
max = 0;
- if (pack_count((object *) 0) >= MAX_PACK_COUNT) {
+ if (pack_count(NULL) >= MAX_PACK_COUNT) {
messagef(0, "pack full");
return;
}
if (get_input_line("which kind?", "", buf, sizeof(buf), "", 0, 1)) {
wk = get_number(buf);
if ((wk >= 0) && (wk <= max)) {
- obj->which_kind = (unsigned short) wk;
+ obj->which_kind = wk;
if (obj->what_is == RING) {
gr_ring(obj, 0);
}
}
get_desc(obj, buf, sizeof(buf));
messagef(0, "%s", buf);
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
}