-/* $NetBSD: hack.fight.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */
+/* $NetBSD: hack.fight.c,v 1.12 2009/08/12 07:28:40 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.fight.c,v 1.8 2008/01/28 06:55:41 dholland Exp $");
+__RCSID("$NetBSD: hack.fight.c,v 1.12 2009/08/12 07:28:40 dholland Exp $");
#endif /* not lint */
#include "hack.h"
static boolean far_noise;
static long noisetime;
+static void monstone(struct monst *);
+
/* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */
int
-hitmm(magr, mdef)
- struct monst *magr, *mdef;
+hitmm(struct monst *magr, struct monst *mdef)
{
const struct permonst *pa = magr->data, *pd = mdef->data;
int didhit;
seemimic(mdef);
if (magr->mimic)
seemimic(magr);
- (void) sprintf(buf, "%s %s", Monnam(magr),
+ (void) snprintf(buf, sizeof(buf), "%s %s", Monnam(magr),
didhit ? "hits" : "misses");
pline("%s %s.", buf, monnam(mdef));
} else {
/* drop (perhaps) a cadaver and remove monster */
void
-mondied(mdef)
- struct monst *mdef;
+mondied(struct monst *mdef)
{
const struct permonst *pd = mdef->data;
if (letter(pd->mlet) && rn2(3)) {
}
/* drop a rock and remove monster */
-void
-monstone(mdef)
- struct monst *mdef;
+static void
+monstone(struct monst *mdef)
{
if (strchr(mlarge, mdef->data->mlet))
mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my);
int
-fightm(mtmp)
- struct monst *mtmp;
+fightm(struct monst *mtmp)
{
struct monst *mon;
for (mon = fmon; mon; mon = mon->nmon)
/* u is hit by sth, but not a monster */
int
-thitu(tlev, dam, name)
- int tlev, dam;
- const char *name;
+thitu(int tlev, int dam, const char *name)
{
char buf[BUFSZ];
- setan(name, buf);
+
+ setan(name, buf, sizeof(buf));
if (u.uac + tlev <= rnd(20)) {
if (Blind)
pline("It misses.");
}
}
-char mlarge[] = "bCDdegIlmnoPSsTUwY',&";
+const char mlarge[] = "bCDdegIlmnoPSsTUwY',&";
+/* return TRUE if mon still alive */
boolean
-hmon(mon, obj, thrown) /* return TRUE if mon still alive */
- struct monst *mon;
- struct obj *obj;
- int thrown;
+hmon(struct monst *mon, struct obj *obj, int thrown)
{
int tmp;
boolean hittxt = FALSE;
/* try to attack; return FALSE if monster evaded */
/* u.dx and u.dy must be set */
int
-attack(mtmp)
- struct monst *mtmp;
+attack(struct monst *mtmp)
{
schar tmp;
boolean malive = TRUE;