-/* $NetBSD: hack.invent.c,v 1.13 2009/06/29 23:05:33 dholland Exp $ */
+/* $NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.invent.c,v 1.13 2009/06/29 23:05:33 dholland Exp $");
+__RCSID("$NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $");
#endif /* not lint */
#include <assert.h>
static int lastinvnr = 51; /* 0 ... 51 */
-static void assigninvlet(struct obj *);
static char *xprname(struct obj *, char);
+static void doinv(const char *);
+static int merged(struct obj *, struct obj *, int);
static void
assigninvlet(struct obj *otmp)
}
gtmp->ngold = gold->ngold;
}
- free((char *) gold);
+ free(gold);
}
void
for (ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap);
ttmp->ntrap = trap->ntrap;
}
- free((char *) trap);
+ free(trap);
}
struct wseg *m_atseg;
}
/* make dummy object structure containing gold - for temporary use only */
-struct obj *
+static struct obj *
mkgoldobj(long q)
{
struct obj *otmp;
continue;
/* he typed a letter (not a space) to more() */
} else if (ilet == '*') {
- doinv((char *) 0);
+ doinv(NULL);
if (!(ilet = morc))
continue;
/* ... */
return (otmp);
}
-int
+static int
ckunpaid(struct obj *otmp)
{
return (otmp->unpaid);
if (ckfn && !(*ckfn) (otmp))
continue;
if (!allflag) {
- pline(xprname(otmp, ilet));
+ pline("%s", xprname(otmp, ilet));
addtopl(" [nyaq]? ");
sym = readchar();
} else
switch (sym) {
case 'a':
allflag = 1;
+ /* FALLTHROUGH */
case 'y':
cnt += (*fn) (otmp);
if (--max == 0)
goto ret;
+ break;
case 'n':
default:
break;
}
/* should of course only be called for things in invent */
-char
+static char
obj_to_let(struct obj *obj)
{
struct obj *otmp;
void
prinv(struct obj *obj)
{
- pline(xprname(obj, obj_to_let(obj)));
+ pline("%s", xprname(obj, obj_to_let(obj)));
}
-static char *
+static char *
xprname(struct obj *obj, char let)
{
static char li[BUFSZ];
int
ddoinv(void)
{
- doinv((char *) 0);
+ doinv(NULL);
return (0);
}
/* called with 0 or "": all objects in inventory */
/* otherwise: all objects with (serial) letter in lets */
-void
-doinv(char *lets)
+static void
+doinv(const char *lets)
{
struct obj *otmp;
char ilet;
pline("Not carrying anything.");
return;
}
- cornline(0, (char *) 0);
+ cornline(0, NULL);
ilet = 'a';
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (flags.invlet_constant)
}
if (ct == 1 && !gold) {
pline("You %s here %s.", verb, doname(otmp0));
- cornline(3, (char *) 0);
+ cornline(3, NULL);
}
if (ct > 1)
- cornline(2, (char *) 0);
+ cornline(2, NULL);
return (!!Blind);
}
}
/* merge obj with otmp and delete obj if types agree */
-int
+static int
merged(struct obj *otmp, struct obj *obj, int lose)
{
if (obj->otyp == otmp->otyp &&
* it may take a while before you have counted it all.
* [Bug: d$ and pickup still tell you how much it was.]
*/
-int
+static int
countgold(void)
{
if ((goldcounted += 100 * (u.ulevel + 1)) >= u.ugold) {