X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/b462731cbc1198051cd39ad2f95b1027e441067d..f10f12c30fc0f088e947a4836f528ac1d880664a:/hack/hack.dog.c diff --git a/hack/hack.dog.c b/hack/hack.dog.c index 3bbda261..a76e7ffe 100644 --- a/hack/hack.dog.c +++ b/hack/hack.dog.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.dog.c,v 1.10 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.dog.c,v 1.12 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.dog.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); +__RCSID("$NetBSD: hack.dog.c,v 1.12 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -79,6 +79,8 @@ const struct permonst dog = const struct permonst la_dog = {"large dog", 'd', 6, 15, 4, 2, 4, sizeof(struct edog)}; +static void initedog(struct monst *); +static int dogfood(struct obj *); void makedog(void) @@ -89,7 +91,7 @@ makedog(void) initedog(mtmp); } -void +static void initedog(struct monst *mtmp) { mtmp->mtame = mtmp->mpeaceful = 1; @@ -159,7 +161,7 @@ fall_down(struct monst *mtmp) #define APPORT 4 #define POISON 5 #define UNDEF 6 -int +static int dogfood(struct obj *obj) { switch (obj->olet) { @@ -175,7 +177,7 @@ dogfood(struct obj *obj) default: if (!obj->cursed) return (APPORT); - /* fall into next case */ + /* FALLTHROUGH */ case BALL_SYM: case CHAIN_SYM: case ROCK_SYM: @@ -473,12 +475,13 @@ int inroom(xchar x, xchar y) { #ifndef QUEST - struct mkroom *croom = &rooms[0]; - while (croom->hx >= 0) { - if (croom->hx >= x - 1 && croom->lx <= x + 1 && - croom->hy >= y - 1 && croom->ly <= y + 1) - return (croom - rooms); - croom++; + int pos = 0; + + while (rooms[pos].hx >= 0) { + if (rooms[pos].hx >= x - 1 && rooms[pos].lx <= x + 1 && + rooms[pos].hy >= y - 1 && rooms[pos].ly <= y + 1) + return pos; + pos++; } #endif /* QUEST */ return (-1); /* not in room or on door */