shadowed declaration warning

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