-/* $NetBSD: hack.do.c,v 1.4 1997/10/19 16:57:41 christos Exp $ */
+/* $NetBSD: hack.do.c,v 1.11 2011/08/06 20:29:37 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.do.c,v 1.4 1997/10/19 16:57:41 christos Exp $");
+__RCSID("$NetBSD: hack.do.c,v 1.11 2011/08/06 20:29:37 dholland Exp $");
#endif /* not lint */
/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */
-#include "hack.h"
-#include "extern.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
+#include "hack.h"
+#include "extern.h"
-static int drop __P((struct obj *));
+static int drop(struct obj *);
+static void dropy(struct obj *);
int
-dodrop()
+dodrop(void)
{
return (drop(getobj("0$#", "drop")));
}
static int
-drop(obj)
- struct obj *obj;
+drop(struct obj *obj)
{
if (!obj)
return (0);
if (Invisible)
newsym(u.ux, u.uy);
}
- free((char *) obj);
+ free(obj);
return (1);
}
if (obj->owornmask & (W_ARMOR | W_RING)) {
/* Called in several places - should not produce texts */
void
-dropx(obj)
- struct obj *obj;
+dropx(struct obj *obj)
{
freeinv(obj);
dropy(obj);
}
-void
-dropy(obj)
- struct obj *obj;
+static void
+dropy(struct obj *obj)
{
if (obj->otyp == CRYSKNIFE)
obj->otyp = WORM_TOOTH;
/* drop several things */
int
-doddrop()
+doddrop(void)
{
return (ggetobj("drop", drop, 0));
}
int
-dodown()
+dodown(void)
{
if (u.ux != xdnstair || u.uy != ydnstair) {
pline("You can't go down here.");
}
int
-doup()
+doup(void)
{
if (u.ux != xupstair || u.uy != yupstair) {
pline("You can't go up here.");
}
void
-goto_level(newlevel, at_stairs)
- int newlevel;
- boolean at_stairs;
+goto_level(int newlevel, boolean at_stairs)
{
int fd;
boolean up = (newlevel < dlevel);
if (!level_exists[dlevel])
mklev();
else {
- if ((fd = open(lock, 0)) < 0) {
+ if ((fd = open(lock, O_RDONLY)) < 0) {
pline("Cannot open %s .", lock);
pline("Probably someone removed it.");
done("tricked");
}
int
-donull()
+donull(void)
{
return (1); /* Do nothing, but let other things happen */
}
int
-dopray()
+dopray(void)
{
nomovemsg = "You finished your prayer.";
nomul(-3);
}
int
-dothrow()
+dothrow(void)
{
struct obj *obj;
struct monst *mon;
mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 :
(!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1,
obj->olet,
- (void (*) __P((struct monst *, struct obj *))) 0,
- (int (*) __P((struct obj *, struct obj *))) 0, obj);
+ (void (*)(struct monst *, struct obj *)) 0,
+ (int (*)(struct obj *, struct obj *)) 0, obj);
}
if (mon) {
/* awake monster if sleeping */
/* split obj so that it gets size num */
/* remainder is put in the object structure delivered by this call */
struct obj *
-splitobj(obj, num)
- struct obj *obj;
- int num;
+splitobj(struct obj *obj, int num)
{
struct obj *otmp;
otmp = newobj(0);
}
void
-more_experienced(exp, rexp)
- int exp, rexp;
+more_experienced(int exp, int rexp)
{
u.uexp += exp;
u.urexp += 4 * exp + rexp;
}
void
-set_wounded_legs(side, timex)
- long side;
- int timex;
+set_wounded_legs(long side, int timex)
{
if (!Wounded_legs || (Wounded_legs & TIMEOUT))
Wounded_legs |= side + timex;
}
void
-heal_legs()
+heal_legs(void)
{
if (Wounded_legs) {
if ((Wounded_legs & BOTH_SIDES) == BOTH_SIDES)