]> granicus.if.org Git - nethack/commitdiff
shadowed declaration warning
authornethack.allison <nethack.allison>
Thu, 16 Dec 2004 00:20:54 +0000 (00:20 +0000)
committernethack.allison <nethack.allison>
Thu, 16 Dec 2004 00:20:54 +0000 (00:20 +0000)
<Someone> complained that his compiler was giving these
warnings:
cmd.c:2119: warning: declaration of `expl' shadows a global declaration
dungeon.c:292: warning: declaration of `rand' shadows a global declaration
exper.c:100: warning: declaration of `exp' shadows a global declaration
files.c:278: warning: declaration of `basename' shadows a global declaration
hack.c:1102: warning: declaration of `expl' shadows a global declaration
pickup.c:2081: warning: declaration of `select' shadows a global declaration
role.c:1060: warning: declaration of `conj' shadows a global declaration

src/cmd.c
src/dungeon.c
src/exper.c
src/explode.c
src/files.c
src/hack.c
src/pickup.c
src/role.c

index 7ea03af79fd88a4f349f38b517b57162395e20a5..87b253a5056f124789a4e41f636851da46f15a58 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2202,7 +2202,7 @@ const char *msg;
        char ctrl;
        winid win;
        static const char wiz_only_list[] = "EFGIOVW";
-       char buf[BUFSZ], buf2[BUFSZ], *expl;
+       char buf[BUFSZ], buf2[BUFSZ], *explain;
 
        win = create_nhwindow(NHW_TEXT);
        if (!win) return FALSE;
@@ -2214,7 +2214,7 @@ const char *msg;
        if (letter(sym)) { 
            sym = highc(sym);
            ctrl = (sym - 'A') + 1;
-           if ((expl = dowhatdoes_core(ctrl, buf2))
+           if ((explain = dowhatdoes_core(ctrl, buf2))
                && (!index(wiz_only_list, sym)
 #ifdef WIZARD
                    || wizard
@@ -2225,7 +2225,7 @@ const char *msg;
                        " as specified in the Guidebook");
                putstr(win, 0, buf);
                putstr(win, 0, "");
-               putstr(win, 0, expl);
+               putstr(win, 0, explain);
                putstr(win, 0, "");
                putstr(win, 0, "To use that command, you press");
                Sprintf(buf,
index 2538b7b8aebd42a72d5ef18e7984b55f2c182614..aa72d198cd24281413becdee0e14090332fd5566 100644 (file)
@@ -279,15 +279,15 @@ struct proto_dungeon *pd;
  * or dungeon entrance can occupy.
  *
  * Note: This follows the acouple (instead of the rcouple) rules for a
- *      negative random component (rand < 0).  These rules are found
+ *      negative random component (randc < 0).  These rules are found
  *      in dgn_comp.y.  The acouple [absolute couple] section says that
  *      a negative random component means from the (adjusted) base to the
  *      end of the dungeon.
  */
 STATIC_OVL int
-level_range(dgn, base, rand, chain, pd, adjusted_base)
+level_range(dgn, base, randc, chain, pd, adjusted_base)
        xchar   dgn;
-       int     base, rand, chain;
+       int     base, randc, chain;
        struct proto_dungeon *pd;
        int *adjusted_base;
 {
@@ -308,11 +308,11 @@ level_range(dgn, base, rand, chain, pd, adjusted_base)
 
        *adjusted_base = base;
 
-       if (rand == -1) {       /* from base to end of dungeon */
+       if (randc == -1) {      /* from base to end of dungeon */
            return (lmax - base + 1);
-       } else if (rand) {
+       } else if (randc) {
            /* make sure we don't run off the end of the dungeon */
-           return (((base + rand - 1) > lmax) ? lmax-base+1 : rand);
+           return (((base + randc - 1) > lmax) ? lmax-base+1 : randc);
        } /* else only one choice */
        return 1;
 }
index e3fa4981457423451a5b3a867f0d9c8d515ed766..8472669c83ed965eb708ef3d224878492b69a157 100644 (file)
@@ -97,20 +97,20 @@ experience(mtmp, nk)        /* return # of exp points for mtmp after nk killed */
 }
 
 void
-more_experienced(exp, rexp)
-       register int exp, rexp;
+more_experienced(exper, rexp)
+       register int exper, rexp;
 {
-       long newexp = u.uexp + exp;
-       long rexpincr = 4*exp + rexp;
+       long newexp = u.uexp + exper;
+       long rexpincr = 4*exper + rexp;
        long newrexp = u.urexp + rexpincr;
 
        /* cap experience and score on wraparound */
-       if (newexp < 0 && exp > 0) newexp = LONG_MAX;
+       if (newexp < 0 && exper > 0) newexp = LONG_MAX;
        if (newrexp < 0 && rexpincr > 0) newrexp = LONG_MAX;
        u.uexp = newexp;
        u.urexp = newrexp;
 
-       if(exp
+       if(exper
 #ifdef SCORE_ON_BOTL
           || flags.showscore
 #endif
index 6885a3489df18c33a7323d1d382933b0071beb74..1ebf8715b7b84c2011d9188e808dc417b8ff78d2 100644 (file)
@@ -5,7 +5,7 @@
 #include "hack.h"
 
 /* Note: Arrays are column first, while the screen is row first */
-static int expl[3][3] = {
+static int explosion[3][3] = {
        { S_explode1, S_explode4, S_explode7 },
        { S_explode2, S_explode5, S_explode8 },
        { S_explode3, S_explode6, S_explode9 }
@@ -189,7 +189,7 @@ int expltype;
                for (i=0; i<3; i++) for (j=0; j<3; j++) {
                        if (explmask[i][j] == 2) continue;
                        tmp_at(starting ? DISP_BEAM : DISP_CHANGE,
-                               explosion_to_glyph(expltype,expl[i][j]));
+                               explosion_to_glyph(expltype,explosion[i][j]));
                        tmp_at(i+x-1, j+y-1);
                        starting = 0;
                }
@@ -215,7 +215,7 @@ int expltype;
                    for (i=0; i<3; i++) for (j=0; j<3; j++) {
                        if (explmask[i][j] == 1)
                            show_glyph(i+x-1,j+y-1,
-                                       explosion_to_glyph(expltype, expl[i][j]));
+                                       explosion_to_glyph(expltype, explosion[i][j]));
                    }
 
                } else {                /* delay a little bit. */
index 59bfa6ccda5a98082fbee5ddb10a198a366f844e..5722de0e4066740acfedae0b2902de8ae45b0c64 100644 (file)
@@ -280,30 +280,30 @@ int bufsz;
 /*ARGSUSED*/
 #endif
 const char *
-fqname(basename, whichprefix, buffnum)
-const char *basename;
+fqname(basenam, whichprefix, buffnum)
+const char *basenam;
 int whichprefix, buffnum;
 {
 #ifndef PREFIXES_IN_USE
-       return basename;
+       return basenam;
 #else
-       if (!basename || whichprefix < 0 || whichprefix >= PREFIX_COUNT)
-               return basename;
+       if (!basenam || whichprefix < 0 || whichprefix >= PREFIX_COUNT)
+               return basenam;
        if (!fqn_prefix[whichprefix])
-               return basename;
+               return basenam;
        if (buffnum < 0 || buffnum >= FQN_NUMBUF) {
                impossible("Invalid fqn_filename_buffer specified: %d",
                                                                buffnum);
                buffnum = 0;
        }
-       if (strlen(fqn_prefix[whichprefix]) + strlen(basename) >=
+       if (strlen(fqn_prefix[whichprefix]) + strlen(basenam) >=
                                                    FQN_MAX_FILENAME) {
                impossible("fqname too long: %s + %s", fqn_prefix[whichprefix],
-                                               basename);
-               return basename;        /* XXX */
+                                               basenam);
+               return basenam; /* XXX */
        }
        Strcpy(fqn_filename_buffer[buffnum], fqn_prefix[whichprefix]);
-       return strcat(fqn_filename_buffer[buffnum], basename);
+       return strcat(fqn_filename_buffer[buffnum], basenam);
 #endif
 }
 
index b67ad37eb54be618d8a7a0122c4dd909dade3615..1a960455c449c3bcef803a6eae70f793657852ba 100644 (file)
@@ -1132,17 +1132,17 @@ domove()
        if (context.forcefight ||
            /* remembered an 'I' && didn't use a move command */
            (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
-               boolean expl = (Upolyd && attacktype(youmonst.data, AT_EXPL));
+               boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL));
                char buf[BUFSZ];
                Sprintf(buf,"a vacant spot on the %s", surface(x,y));
                You("%s %s.",
-                   expl ? "explode at" : "attack",
+                   explo ? "explode at" : "attack",
                    !Underwater ? "thin air" :
                    is_pool(x,y) ? "empty water" : buf);
                unmap_object(x, y); /* known empty -- remove 'I' if present */
                newsym(x, y);
                nomul(0);
-               if (expl) {
+               if (explo) {
                    u.mh = -1;          /* dead in the current form */
                    rehumanize();
                }
index cda4f94c4b4d6a3f200890e6f28de7f3d8940774..42fcd597ab3c05a9eb23395db36c2a0f829eb70d 100644 (file)
@@ -2077,7 +2077,7 @@ register int held;
 #endif
        boolean one_by_one, allflag, quantum_cat = FALSE,
                loot_out = FALSE, loot_in = FALSE;
-       char select[MAXOCLASSES+1];
+       char selection[MAXOCLASSES+1];
        char qbuf[BUFSZ], emptymsg[BUFSZ], pbuf[QBUFSZ];
        long loss = 0L;
        int cnt = 0, used = 0,
@@ -2182,7 +2182,7 @@ ask_again2:
                    container_contents(current_container, FALSE, FALSE);
                    goto ask_again2;
                case 'y':
-                   if (query_classes(select, &one_by_one, &allflag,
+                   if (query_classes(selection, &one_by_one, &allflag,
                                      "take out", current_container->cobj,
                                      FALSE,
 #ifndef GOLDOBJ
@@ -2190,7 +2190,7 @@ ask_again2:
 #endif
                                      &menu_on_request)) {
                        if (askchain((struct obj **)&current_container->cobj,
-                                    (one_by_one ? (char *)0 : select),
+                                    (one_by_one ? (char *)0 : selection),
                                     allflag, out_container,
                                     (int FDECL((*),(OBJ_P)))0,
                                     0, "nodot"))
@@ -2273,14 +2273,14 @@ ask_again2:
            } else {
                /* traditional code */
                menu_on_request = 0;
-               if (query_classes(select, &one_by_one, &allflag, "put in",
+               if (query_classes(selection, &one_by_one, &allflag, "put in",
                                   invent, FALSE,
 #ifndef GOLDOBJ
                                   (u.ugold != 0L),
 #endif
                                   &menu_on_request)) {
                    (void) askchain((struct obj **)&invent,
-                                   (one_by_one ? (char *)0 : select), allflag,
+                                   (one_by_one ? (char *)0 : selection), allflag,
                                    in_container, ck_bag, 0, "nodot");
                    used = 1;
                } else if (menu_on_request < 0) {
index c751d10cf324ef42121df9bd3c7fc8d8f8b5f32a..394e8823c63df074fadfd2d945e9d623bc72511c 100644 (file)
@@ -1057,13 +1057,13 @@ promptsep(buf, num_post_attribs)
 char *buf;
 int num_post_attribs;
 {
-       const char *conj = "and ";
+       const char *conjuct = "and ";
        if (num_post_attribs > 1
            && post_attribs < num_post_attribs && post_attribs > 1)
                Strcat(buf, ","); 
        Strcat(buf, " ");
        --post_attribs;
-       if (!post_attribs && num_post_attribs > 1) Strcat(buf, conj);
+       if (!post_attribs && num_post_attribs > 1) Strcat(buf, conjuct);
        return buf;
 }