-/* $NetBSD: hack.eat.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */
+/* $NetBSD: hack.eat.c,v 1.12 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.eat.c,v 1.6 2003/04/02 18:36:36 jsm Exp $");
+__RCSID("$NetBSD: hack.eat.c,v 1.12 2011/08/07 06:03:45 dholland Exp $");
#endif /* not lint */
#include "hack.h"
#include "extern.h"
-char POISONOUS[] = "ADKSVabhks";
+static char POISONOUS[] = "ADKSVabhks";
/* hunger texts used on bottom line (each 8 chars long) */
#define SATIATED 0
"Starved "
};
+static int opentin(void);
+static int Meatdone(void);
+static int unfaint(void);
+static void newuhs(boolean);
+static int eatcorpse(struct obj *);
+
void
-init_uhunger()
+init_uhunger(void)
{
u.uhunger = 900;
u.uhs = NOT_HUNGRY;
}
#define TTSZ SIZE(tintxts)
-const struct {
+static const struct {
const char *txt;
int nut;
} tintxts[] = {
int usedtime, reqtime;
} tin;
-int
-opentin()
+static int
+opentin(void)
{
int r;
useup(tin.tin);
r = rn2(2 * TTSZ);
if (r < TTSZ) {
- pline(tintxts[r].txt);
+ pline("%s", tintxts[r].txt);
lesshungry(tintxts[r].nut);
if (r == 1) { /* SALMON */
Glib = rnd(15);
return (0);
}
-int
-Meatdone()
+static int
+Meatdone(void)
{
u.usym = '@';
prme();
}
int
-doeat()
+doeat(void)
{
struct obj *otmp;
struct objclass *ftmp;
goto no_opener;
}
pline("Using your %s you try to open the tin.",
- aobjnam(uwep, (char *) 0));
+ aobjnam(uwep, NULL));
} else {
no_opener:
pline("It is not so easy to open this tin.");
eatx:
if (multi < 0 && !nomovemsg) {
static char msgbuf[BUFSZ];
- (void) sprintf(msgbuf, "You finished eating the %s.",
+ (void) snprintf(msgbuf, sizeof(msgbuf),
+ "You finished eating the %s.",
ftmp->oc_name);
nomovemsg = msgbuf;
}
/* called in hack.main.c */
void
-gethungry()
+gethungry(void)
{
--u.uhunger;
if (moves % 2) {
/* called after vomiting and after performing feats of magic */
void
-morehungry(num)
- int num;
+morehungry(int num)
{
u.uhunger -= num;
newuhs(TRUE);
/* called after eating something (and after drinking fruit juice) */
void
-lesshungry(num)
- int num;
+lesshungry(int num)
{
u.uhunger += num;
newuhs(FALSE);
}
-int
-unfaint()
+static int
+unfaint(void)
{
u.uhs = FAINTING;
flags.botl = 1;
return 0;
}
-void
-newuhs(incr)
- boolean incr;
+static void
+newuhs(boolean incr)
{
int newhs, h = u.uhunger;
? 'a' + (otyp - DEAD_ACID_BLOB)\
: '@' + (otyp - DEAD_HUMAN))
int
-poisonous(otmp)
- struct obj *otmp;
+poisonous(struct obj *otmp)
{
return (strchr(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0);
}
/* returns 1 if some text was printed */
-int
-eatcorpse(otmp)
- struct obj *otmp;
+static int
+eatcorpse(struct obj *otmp)
{
char let = CORPSE_I_TO_C(otmp->otyp);
int tp = 0;
case 'n':
u.uhp = u.uhpmax;
flags.botl = 1;
- /* fall into next case */
+ /* FALLTHROUGH */
case '@':
pline("You cannibal! You will be sorry for this!");
/* not tp++; */
- /* fall into next case */
+ /* FALLTHROUGH */
case 'd':
Aggravate_monster |= INTRINSIC;
break;
Invis |= INTRINSIC;
See_invisible |= INTRINSIC;
}
- /* fall into next case */
+ /* FALLTHROUGH */
case 'y':
#ifdef QUEST
u.uhorizon++;
#endif /* QUEST */
- /* fall into next case */
+ /* FALLTHROUGH */
case 'B':
Confusion = 50;
break;