-/* $NetBSD: hack.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
+/* $NetBSD: hack.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */
/*
- * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
+ * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
+ * Amsterdam
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the Stichting Centrum voor Wiskunde en
+ * Informatica, nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
+__RCSID("$NetBSD: hack.c,v 1.9 2009/08/12 07:28:40 dholland Exp $");
#endif /* not lint */
#include "hack.h"
#include "extern.h"
+static void movobj(struct obj *, int, int);
+static int inv_cnt(void);
+
/*
* called on movement: 1. when throwing ball+chain far away 2. when
* teleporting 3. when walking out of a lit room
*/
void
-unsee()
+unsee(void)
{
int x, y;
struct rm *lev;
* hack.do.c: seeoff(1) - go up or down the stairs in hack.trap.c:seeoff(1)
* - fall through trapdoor
*/
+/* mode: */
+ /* 1 to redo @, 0 to leave them *//* 1 means
+ * misc movement, 0 means blindness */
void
-seeoff(mode)
- int mode; /* 1 to redo @, 0 to leave them *//* 1 means
- * misc movement, 0 means blindness */
+seeoff(int mode)
{
int x, y;
struct rm *lev;
}
void
-domove()
+domove(void)
{
xchar oldx, oldy;
struct monst *mtmp = NULL;
read_engr_at(u.ux, u.uy);
}
-void
-movobj(obj, ox, oy)
- struct obj *obj;
- int ox, oy;
+static void
+movobj(struct obj *obj, int ox, int oy)
{
/* Some dirty programming to get display right */
freeobj(obj);
}
int
-dopickup()
+dopickup(void)
{
if (!g_at(u.ux, u.uy) && !o_at(u.ux, u.uy)) {
pline("There is nothing here to pick up.");
}
lift_some:
if (inv_cnt() >= 52) {
- pline("Your knapsack cannot accomodate anymore items.");
+ pline("Your knapsack cannot accommodate anymore items.");
break;
}
if (wt > -5)
/* turn around a corner if that is the only way we can proceed */
/* do not turn left or right twice */
void
-lookaround()
+lookaround(void)
{
int x, y, i, x0 = 0, y0 = 0, m0 = 0, i0 = 9;
int corrct = 0, noturn = 0;
/* something like lookaround, but we are not running */
/* react only to monsters that might hit us */
int
-monster_nearby()
+monster_nearby(void)
{
int x, y;
struct monst *mtmp;
#ifdef QUEST
int
-cansee(x, y)
- xchar x, y;
+cansee(xchar x, xchar y)
{
int dx, dy, adx, ady, sdx, sdy, dmax, d;
if (Blind)
}
int
-rroom(x, y)
- int x, y;
+rroom(int x, int y)
{
return (IS_ROOM(levl[u.ux + x][u.uy + y].typ));
}
#else
int
-cansee(x, y)
- xchar x, y;
+cansee(xchar x, xchar y)
{
if (Blind || u.uswallow)
return (0);
#endif /* QUEST */
int
-sgn(a)
- int a;
+sgn(int a)
{
return ((a > 0) ? 1 : (a == 0) ? 0 : -1);
}
#ifdef QUEST
void
-setsee()
+setsee(void)
{
int x, y;
#else
void
-setsee()
+setsee(void)
{
int x, y;
#endif /* QUEST */
void
-nomul(nval)
- int nval;
+nomul(int nval)
{
if (multi < 0)
return;
}
int
-abon()
+abon(void)
{
if (u.ustr == 3)
return (-3);
}
int
-dbon()
+dbon(void)
{
if (u.ustr < 6)
return (-1);
return (6);
}
+/* may kill you; cause may be poison or */
+/* monster like 'A' */
void
-losestr(num) /* may kill you; cause may be poison or */
- int num; /* monster like 'A' */
+losestr(int num)
{
u.ustr -= num;
while (u.ustr < 3) {
}
void
-losehp(n, knam)
- int n;
- const char *knam;
+losehp(int n, const char *knam)
{
u.uhp -= n;
if (u.uhp > u.uhpmax)
}
void
-losehp_m(n, mtmp)
- int n;
- struct monst *mtmp;
+losehp_m(int n, struct monst *mtmp)
{
u.uhp -= n;
flags.botl = 1;
}
void
-losexp()
+losexp(void)
{ /* hit by V or W */
int num;
}
int
-inv_weight()
+inv_weight(void)
{
struct obj *otmp = invent;
int wt = (u.ugold + 500) / 1000;
return (wt - carrcap);
}
-int
-inv_cnt()
+static int
+inv_cnt(void)
{
struct obj *otmp = invent;
int ct = 0;
}
long
-newuexp()
+newuexp(void)
{
return (10 * (1L << (u.ulevel - 1)));
}