]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - hack/hack.eat.c
Fix merge conflicts
[bsdgames-darwin.git] / hack / hack.eat.c
index 9cd24b22ffabeec4f3a3ddea9adae7aa76e5867d..6107f99316f2b888e05f21b45df1194e2d818aff 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: hack.eat.c,v 1.7 2009/06/07 18:30:39 dholland Exp $    */
+/*     $NetBSD: hack.eat.c,v 1.13 2019/02/04 03:33:15 mrg Exp $        */
 
 /*
  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hack.eat.c,v 1.7 2009/06/07 18:30:39 dholland Exp $");
+__RCSID("$NetBSD: hack.eat.c,v 1.13 2019/02/04 03:33:15 mrg Exp $");
 #endif                         /* not lint */
 
 #include "hack.h"
 #include "extern.h"
-char            POISONOUS[] = "ADKSVabhks";
+static char POISONOUS[] = "ADKSVabhks";
 
 /* hunger texts used on bottom line (each 8 chars long) */
 #define        SATIATED        0
@@ -89,6 +89,12 @@ const char           *const hu_stat[] = {
        "Starved "
 };
 
+static int opentin(void);
+static int Meatdone(void);
+static int unfaint(void);
+static void newuhs(boolean);
+static int eatcorpse(struct obj *);
+
 void
 init_uhunger(void)
 {
@@ -97,7 +103,7 @@ init_uhunger(void)
 }
 
 #define        TTSZ    SIZE(tintxts)
-const struct {
+static const struct {
        const char           *txt;
        int             nut;
 }               tintxts[] = {
@@ -114,7 +120,7 @@ static struct {
        int             usedtime, reqtime;
 }               tin;
 
-int
+static int
 opentin(void)
 {
        int             r;
@@ -132,7 +138,7 @@ opentin(void)
        useup(tin.tin);
        r = rn2(2 * TTSZ);
        if (r < TTSZ) {
-               pline(tintxts[r].txt);
+               pline("%s", tintxts[r].txt);
                lesshungry(tintxts[r].nut);
                if (r == 1) {   /* SALMON */
                        Glib = rnd(15);
@@ -150,7 +156,7 @@ opentin(void)
        return (0);
 }
 
-int
+static int
 Meatdone(void)
 {
        u.usym = '@';
@@ -206,7 +212,7 @@ gotit:
                                goto no_opener;
                        }
                        pline("Using your %s you try to open the tin.",
-                             aobjnam(uwep, (char *) 0));
+                             aobjnam(uwep, NULL));
                } else {
        no_opener:
                        pline("It is not so easy to open this tin.");
@@ -330,7 +336,8 @@ gotit:
 eatx:
        if (multi < 0 && !nomovemsg) {
                static char     msgbuf[BUFSZ];
-               (void) sprintf(msgbuf, "You finished eating the %s.",
+               (void) snprintf(msgbuf, sizeof(msgbuf),
+                              "You finished eating the %s.",
                               ftmp->oc_name);
                nomovemsg = msgbuf;
        }
@@ -378,7 +385,7 @@ lesshungry(int num)
        newuhs(FALSE);
 }
 
-int
+static int
 unfaint(void)
 {
        u.uhs = FAINTING;
@@ -386,7 +393,7 @@ unfaint(void)
        return 0;
 }
 
-void
+static void
 newuhs(boolean incr)
 {
        int             newhs, h = u.uhunger;
@@ -452,7 +459,7 @@ poisonous(struct obj *otmp)
 }
 
 /* returns 1 if some text was printed */
-int
+static int
 eatcorpse(struct obj *otmp)
 {
        char            let = CORPSE_I_TO_C(otmp->otyp);
@@ -488,11 +495,11 @@ eatcorpse(struct obj *otmp)
        case 'n':
                u.uhp = u.uhpmax;
                flags.botl = 1;
-               /* fall into next case */
+               /* FALLTHROUGH */
        case '@':
                pline("You cannibal! You will be sorry for this!");
                /* not tp++; */
-               /* fall into next case */
+               /* FALLTHROUGH */
        case 'd':
                Aggravate_monster |= INTRINSIC;
                break;
@@ -505,12 +512,12 @@ eatcorpse(struct obj *otmp)
                        Invis |= INTRINSIC;
                        See_invisible |= INTRINSIC;
                }
-               /* fall into next case */
+               /* FALLTHROUGH */
        case 'y':
 #ifdef QUEST
                u.uhorizon++;
 #endif /* QUEST */
-               /* fall into next case */
+               /* FALLTHROUGH */
        case 'B':
                Confusion = 50;
                break;
@@ -532,7 +539,7 @@ eatcorpse(struct obj *otmp)
                pline("You turn to stone.");
                killer = "dead cockatrice";
                done("died");
-               /* NOTREACHED */
+               break;
        case 'a':
                if (Stoned) {
                        pline("What a pity - you just destroyed a future piece of art!");