-/* $NetBSD: inventory.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: inventory.c,v 1.15 2011/08/26 06:18:17 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: inventory.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: inventory.c,v 1.15 2011/08/26 06:18:17 dholland Exp $");
#endif
#endif /* not lint */
boolean is_wood[WANDS];
const char *press_space = " --press space to continue--";
-const char *const wand_materials[WAND_MATERIALS] = {
+static const char *const wand_materials[WAND_MATERIALS] = {
"steel ",
"bronze ",
"gold ",
"wooden "
};
-const char *const gems[GEMS] = {
+static const char *const gems[GEMS] = {
"diamond ",
"stibotantalite ",
"lapi-lazuli ",
"garnet "
};
-const char *const syllables[MAXSYLLABLES] = {
+static const char *const syllables[MAXSYLLABLES] = {
"blech ",
"foo ",
"barf ",
const char *com_desc;
};
-const struct id_com_s com_id_tab[COMS] = {
+static const struct id_com_s com_id_tab[COMS] = {
{'?', "? prints help"},
{'r', "r read scroll"},
{'/', "/ identify object"},
{'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(pack, mask)
- const object *pack;
- unsigned short mask;
+inventory(const object *pack, unsigned short mask)
{
object *obj;
short i = 0, j;
short letter;
short sepchar;
char desc[DCOLS];
- char savebuf[DCOLS+8];
+ char savebuf[DCOLS+8];
} descs[MAX_PACK_COUNT+1];
}
descs[row].savebuf[j-col] = 0;
if (row < i) {
- mvprintw(row, col, " %c%c %s",
- descs[row].letter, descs[row].sepchar,
+ mvprintw(row, col, " %c%c %s",
+ descs[row].letter, descs[row].sepchar,
descs[row].desc);
}
else {
}
void
-id_com()
+id_com(void)
{
int ch = 0;
short i, j, k;
}
}
-int
-pr_com_id(ch)
- int ch;
+static int
+pr_com_id(int ch)
{
int i;
return(1);
}
-int
-get_com_id(indexp, ch)
- int *indexp;
- short ch;
+static int
+get_com_id(int *indexp, short ch)
{
short i;
return(0);
}
-int
-pr_motion_char(ch)
- int ch;
+static int
+pr_motion_char(int ch)
{
if ( (ch == 'J') ||
(ch == 'K') ||
ch += 32;
until = "";
}
- (void) get_com_id(&n, ch);
+ (void)get_com_id(&n, ch);
check_message();
messagef(0, "run %s%s", com_id_tab[n].com_desc + 8, until);
return(1);
}
void
-mix_colors()
+mix_colors(void)
{
short i, j, k;
char t[MAX_ID_TITLE_LEN];
}
void
-make_scroll_titles()
+make_scroll_titles(void)
{
short i, j, n;
short sylls, s;
for (i = 0; i < SCROLS; i++) {
sylls = get_rand(2, 5);
- (void) strlcpy(id_scrolls[i].title, "'", maxlen);
+ (void)strlcpy(id_scrolls[i].title, "'", maxlen);
for (j = 0; j < sylls; j++) {
s = get_rand(1, (MAXSYLLABLES-1));
- (void) strlcat(id_scrolls[i].title, syllables[s],
+ (void)strlcat(id_scrolls[i].title, syllables[s],
maxlen);
}
/* trim trailing space */
n = strlen(id_scrolls[i].title);
id_scrolls[i].title[n-1] = 0;
- (void) strlcat(id_scrolls[i].title, "' ", maxlen);
+ (void)strlcat(id_scrolls[i].title, "' ", maxlen);
}
}
size_t maxlen;
};
-static void sbuf_init __P((struct sbuf *s, char *buf, size_t maxlen));
-static void sbuf_addstr __P((struct sbuf *s, const char *str));
-static void sbuf_addf __P((struct sbuf *s, const char *fmt, ...));
-static void desc_count __P((struct sbuf *s, int n));
-static void desc_called __P((struct sbuf *s, const object *));
+static void sbuf_init(struct sbuf *s, char *buf, size_t maxlen);
+static void sbuf_addstr(struct sbuf *s, const char *str);
+static void sbuf_addf(struct sbuf *s, const char *fmt, ...) __printflike(2,3);
+static void desc_count(struct sbuf *s, int n);
+static void desc_called(struct sbuf *s, const object *);
static
void
-sbuf_init(s, buf, maxlen)
- struct sbuf *s;
- char *buf;
- size_t maxlen;
+sbuf_init(struct sbuf *s, char *buf, size_t maxlen)
{
s->buf = buf;
s->maxlen = maxlen;
static
void
-sbuf_addstr(s, str)
- struct sbuf *s;
- const char *str;
+sbuf_addstr(struct sbuf *s, const char *str)
{
strlcat(s->buf, str, s->maxlen);
}
-static void sbuf_addf(struct sbuf *s, const char *fmt, ...)
- __attribute__((__format__(__printf__, 2, 3)));
-
static
void
sbuf_addf(struct sbuf *s, const char *fmt, ...)
static
void
-desc_count(s, n)
- struct sbuf *s;
- int n;
+desc_count(struct sbuf *s, int n)
{
if (n == 1) {
sbuf_addstr(s, "an ");
static
void
-desc_called(s, obj)
- struct sbuf *s;
- const object *obj;
+desc_called(struct sbuf *s, const object *obj)
{
struct id *id_table;
}
void
-get_desc(obj, desc, desclen)
- const object *obj;
- char *desc;
- size_t desclen;
+get_desc(const object *obj, char *desc, size_t desclen)
{
const char *item_name;
struct id *id_table;
unsigned short objtype_id_status;
if (obj->what_is == AMULET) {
- (void) strlcpy(desc, "the amulet of Yendor ", desclen);
+ (void)strlcpy(desc, "the amulet of Yendor ", desclen);
return;
}
}
void
-get_wand_and_ring_materials()
+get_wand_and_ring_materials(void)
{
short i, j;
boolean used[WAND_MATERIALS];
j = get_rand(0, WAND_MATERIALS-1);
} while (used[j]);
used[j] = 1;
- (void) strlcpy(id_wands[i].title, wand_materials[j],
+ (void)strlcpy(id_wands[i].title, wand_materials[j],
sizeof(id_wands[i].title));
is_wood[i] = (j > MAX_METAL);
}
j = get_rand(0, GEMS-1);
} while (used[j]);
used[j] = 1;
- (void) strlcpy(id_rings[i].title, gems[j],
+ (void)strlcpy(id_rings[i].title, gems[j],
sizeof(id_rings[i].title));
}
}
void
-single_inv(ichar)
- short ichar;
+single_inv(short ichar)
{
short ch, ch2;
char desc[DCOLS];
}
struct id *
-get_id_table(obj)
- const object *obj;
+get_id_table(const object *obj)
{
switch(obj->what_is) {
case SCROL:
case ARMOR:
return(id_armors);
}
- return((struct id *) 0);
+ return((struct id *)0);
}
void
-inv_armor_weapon(is_weapon)
- boolean is_weapon;
+inv_armor_weapon(boolean is_weapon)
{
if (is_weapon) {
if (rogue.weapon) {
}
void
-id_type()
+id_type(void)
{
const char *id;
int ch;