X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/00b8e31689c6400d8ad915067f021b8e246df989..28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6:/hack/hack.trap.c diff --git a/hack/hack.trap.c b/hack/hack.trap.c index ae2da877..55ba9378 100644 --- a/hack/hack.trap.c +++ b/hack/hack.trap.c @@ -1,12 +1,69 @@ -/* $NetBSD: hack.trap.c,v 1.6 2001/03/25 20:44:03 jsm Exp $ */ +/* $NetBSD: hack.trap.c,v 1.10 2011/08/07 06:03:45 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 + * 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 #ifndef lint -__RCSID("$NetBSD: hack.trap.c,v 1.6 2001/03/25 20:44:03 jsm Exp $"); +__RCSID("$NetBSD: hack.trap.c,v 1.10 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -28,9 +85,12 @@ const char *const traps[] = { " mimic" }; +static void vtele(void); +static void teleds(int, int); +static int teleok(int, int); + struct trap * -maketrap(x, y, typ) - int x, y, typ; +maketrap(int x, int y, int typ) { struct trap *ttmp; @@ -46,8 +106,7 @@ maketrap(x, y, typ) } void -dotrap(trap) - struct trap *trap; +dotrap(struct trap *trap) { int ttype = trap->ttyp; @@ -149,8 +208,7 @@ dotrap(trap) } int -mintrap(mtmp) - struct monst *mtmp; +mintrap(struct monst *mtmp) { struct trap *trap = t_at(mtmp->mx, mtmp->my); int wasintrap = mtmp->mtrapped; @@ -242,8 +300,7 @@ mintrap(mtmp) } void -selftouch(arg) - const char *arg; +selftouch(const char *arg) { if (uwep && uwep->otyp == DEAD_COCKATRICE) { pline("%s touch the dead cockatrice.", arg); @@ -254,7 +311,7 @@ selftouch(arg) } void -float_up() +float_up(void) { if (u.utrap) { if (u.utraptype == TT_PIT) { @@ -268,7 +325,7 @@ float_up() } void -float_down() +float_down(void) { struct trap *trap; pline("You float gently to the ground."); @@ -279,15 +336,15 @@ float_down() case TRAPDOOR: if (!xdnstair || u.ustuck) break; - /* fall into next case */ + /* FALLTHROUGH */ default: dotrap(trap); } pickup(1); } -void -vtele() +static void +vtele(void) { struct mkroom *croom; for (croom = &rooms[0]; croom->hx >= 0; croom++) @@ -305,7 +362,7 @@ vtele() } void -tele() +tele(void) { coord cc; int nux, nuy; @@ -330,9 +387,8 @@ tele() teleds(nux, nuy); } -void -teleds(nux, nuy) - int nux, nuy; +static void +teleds(int nux, int nuy) { if (Punished) unplacebc(); @@ -357,9 +413,8 @@ teleds(nux, nuy) read_engr_at(u.ux, u.uy); } -int -teleok(x, y) - int x, y; +static int +teleok(int x, int y) { /* might throw him into a POOL */ return (isok(x, y) && !IS_ROCK(levl[x][y].typ) && !m_at(x, y) && !sobj_at(ENORMOUS_ROCK, x, y) && !t_at(x, y) @@ -368,7 +423,7 @@ teleok(x, y) } int -dotele() +dotele(void) { if ( #ifdef WIZARD @@ -389,8 +444,7 @@ dotele() } void -placebc(attach) - int attach; +placebc(int attach) { if (!uchain || !uball) { impossible("Where are your chain and ball??"); @@ -409,7 +463,7 @@ placebc(attach) } void -unplacebc() +unplacebc(void) { if (!carried(uball)) { freeobj(uball); @@ -420,7 +474,7 @@ unplacebc() } void -level_tele() +level_tele(void) { int newlevel; if (Teleport_control) { @@ -472,7 +526,7 @@ level_tele() } void -drown() +drown(void) { pline("You fall into a pool!"); pline("You can't swim!");