]> granicus.if.org Git - nethack/commitdiff
kicking coins bit (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 20 Mar 2007 02:47:06 +0000 (02:47 +0000)
committernethack.rankin <nethack.rankin>
Tue, 20 Mar 2007 02:47:06 +0000 (02:47 +0000)
     While looking into the ``NH343 bug - tamed a dog in a shop by kicking
food without being charged'' report (it's reproducible with current code),
I spotted a problem with some post-3.4.3 code.  Ancient compilers can't
handle initializers on auto arrays; this was probably meant to be static in
the first place.

src/dokick.c

index fb90d1690688f31c9da1e1d1c935462989665ed7..0c88a872fc84f734b7c82e8c8db1ac2678604444 100644 (file)
@@ -549,14 +549,16 @@ xchar x, y;
                kickobj = splitobj(kickobj, 1L);
            } else {
                if (rn2(20)) {
-                       const char *flyingcoinmsg[] = {
-                               "scatter the coins",
-                               "knock coins all over the place",
-                               "send coins flying in all directions",
+                       static NEARDATA const char * const flyingcoinmsg[] = {
+                               "scatter the coins",
+                               "knock coins all over the place",
+                               "send coins flying in all directions",
                        };
+
                        pline("Thwwpingg!");
                        You("%s!", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]);
-                       (void) scatter(x, y, rn2(3)+1, VIS_EFFECTS|MAY_HIT, kickobj);
+                       (void)scatter(x, y, rn2(3)+1,
+                                     VIS_EFFECTS|MAY_HIT, kickobj);
                        newsym(x, y);
                        return 1;
                }