some lint cleanup

Building with an old version of gcc with various warnings enabled
generated a lot of noise.  Most of it was due to not guarding string
literals with `const', but there were a couple of actual problems too.
This commit is contained in:
nethack.rankin
2003-01-09 09:18:14 +00:00
parent 5336419465
commit ea400a778d
21 changed files with 139 additions and 131 deletions

View File

@@ -1379,7 +1379,7 @@ E void FDECL(assign_warnings, (uchar *));
E char *FDECL(nh_getenv, (const char *)); E char *FDECL(nh_getenv, (const char *));
E void FDECL(set_duplicate_opt_detection, (int)); E void FDECL(set_duplicate_opt_detection, (int));
E void FDECL(set_wc_option_mod_status, (unsigned long, int)); E void FDECL(set_wc_option_mod_status, (unsigned long, int));
E void FDECL(set_option_mod_status, (char *, int)); E void FDECL(set_option_mod_status, (const char *,int));
/* ### pager.c ### */ /* ### pager.c ### */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)winprocs.h 3.4 1996/02/18 */ /* SCCS Id: @(#)winprocs.h 3.4 2003/01/08 */
/* Copyright (c) David Cohrs, 1992 */ /* Copyright (c) David Cohrs, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -202,7 +202,7 @@ extern NEARDATA struct window_procs windowprocs;
#endif #endif
struct wc_Opt { struct wc_Opt {
char *wc_name; const char *wc_name;
unsigned long wc_bit; unsigned long wc_bit;
}; };

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)apply.c 3.4 2002/11/07 */ /* SCCS Id: @(#)apply.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -874,7 +874,7 @@ STATIC_OVL void
use_candelabrum(obj) use_candelabrum(obj)
register struct obj *obj; register struct obj *obj;
{ {
char *s = obj->spe != 1 ? "candles" : "candle"; const char *s = (obj->spe != 1) ? "candles" : "candle";
if(Underwater) { if(Underwater) {
You("cannot make fire under water."); You("cannot make fire under water.");
@@ -926,7 +926,7 @@ use_candle(obj)
register struct obj *obj; register struct obj *obj;
{ {
register struct obj *otmp; register struct obj *otmp;
char *s = obj->quan != 1 ? "candles" : "candle"; const char *s = (obj->quan != 1) ? "candles" : "candle";
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
if(u.uswallow) { if(u.uswallow) {

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)cmd.c 3.4 2002/10/18 */ /* SCCS Id: @(#)cmd.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -149,7 +149,7 @@ static void NDECL(end_of_input);
static const char* readchar_queue=""; static const char* readchar_queue="";
STATIC_DCL char *NDECL(parse); STATIC_DCL char *NDECL(parse);
STATIC_DCL boolean FDECL(help_dir, (CHAR_P, char *)); STATIC_DCL boolean FDECL(help_dir, (CHAR_P,const char *));
#ifdef OVL1 #ifdef OVL1
@@ -2035,11 +2035,11 @@ const char *s;
STATIC_OVL boolean STATIC_OVL boolean
help_dir(sym, msg) help_dir(sym, msg)
char sym; char sym;
char *msg; const char *msg;
{ {
char ctrl; char ctrl;
winid win; winid win;
char *wiz_only_list = "EFGIOVW"; const char wiz_only_list[] = "EFGIOVW";
char buf[BUFSZ], buf2[BUFSZ], *expl; char buf[BUFSZ], buf2[BUFSZ], *expl;
win = create_nhwindow(NHW_TEXT); win = create_nhwindow(NHW_TEXT);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dig.c 3.4 2002/12/18 */ /* SCCS Id: @(#)dig.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1037,7 +1037,8 @@ watch_dig(mtmp, x, y, zap)
verbalize("Halt, vandal! You're under arrest!"); verbalize("Halt, vandal! You're under arrest!");
(void) angry_guards(!(flags.soundok)); (void) angry_guards(!(flags.soundok));
} else { } else {
char *str; const char *str;
if (IS_DOOR(lev->typ)) if (IS_DOOR(lev->typ))
str = "door"; str = "door";
else if (IS_TREE(lev->typ)) else if (IS_TREE(lev->typ))

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dokick.c 3.4 2002/09/18 */ /* SCCS Id: @(#)dokick.c 3.4 2003/01/08 */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1314,7 +1314,8 @@ boolean shop_floor_obj;
/* some things break rather than ship */ /* some things break rather than ship */
if (breaktest(otmp)) { if (breaktest(otmp)) {
char *result; const char *result;
if (objects[otmp->otyp].oc_material == GLASS if (objects[otmp->otyp].oc_material == GLASS
#ifdef TOURIST #ifdef TOURIST
|| otmp->otyp == EXPENSIVE_CAMERA || otmp->otyp == EXPENSIVE_CAMERA

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dothrow.c 3.4 2002/03/29 */ /* SCCS Id: @(#)dothrow.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -443,7 +443,7 @@ hurtle_step(arg, x, y)
if (!Passes_walls || !(may_pass = may_passwall(x, y))) { if (!Passes_walls || !(may_pass = may_passwall(x, y))) {
if (IS_ROCK(levl[x][y].typ) || closed_door(x,y)) { if (IS_ROCK(levl[x][y].typ) || closed_door(x,y)) {
char *s; const char *s;
pline("Ouch!"); pline("Ouch!");
if (IS_TREE(levl[x][y].typ)) if (IS_TREE(levl[x][y].typ))

133
src/end.c
View File

@@ -18,7 +18,7 @@
struct valuable_data { long count; int typ; }; struct valuable_data { long count; int typ; };
struct valuable_data static struct valuable_data
gems[LAST_GEM+1 - FIRST_GEM + 1], /* 1 extra for glass */ gems[LAST_GEM+1 - FIRST_GEM + 1], /* 1 extra for glass */
amulets[LAST_AMULET+1 - FIRST_AMULET]; amulets[LAST_AMULET+1 - FIRST_AMULET];
@@ -39,9 +39,9 @@ STATIC_DCL void FDECL(get_valuables, (struct obj *));
STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *,int)); STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *,int));
STATIC_DCL void FDECL(artifact_score, (struct obj *,BOOLEAN_P,winid)); STATIC_DCL void FDECL(artifact_score, (struct obj *,BOOLEAN_P,winid));
STATIC_DCL void FDECL(savelife, (int)); STATIC_DCL void FDECL(savelife, (int));
STATIC_DCL void FDECL(list_vanquished, (int, BOOLEAN_P)); STATIC_DCL void FDECL(list_vanquished, (CHAR_P,BOOLEAN_P));
STATIC_DCL void FDECL(list_genocided, (int, BOOLEAN_P)); STATIC_DCL void FDECL(list_genocided, (CHAR_P,BOOLEAN_P));
STATIC_DCL boolean FDECL(should_query_disclose_option, (int, int*)); STATIC_DCL boolean FDECL(should_query_disclose_option, (int,char *));
#if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2) #if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2)
extern void FDECL(nethack_exit,(int)); extern void FDECL(nethack_exit,(int));
@@ -84,8 +84,7 @@ static NEARDATA const char *ends[] = { /* "when you..." */
"quit", "escaped", "ascended" "quit", "escaped", "ascended"
}; };
extern const char *killed_by_prefix[]; extern const char * const killed_by_prefix[]; /* from topten.c */
/*ARGSUSED*/ /*ARGSUSED*/
void void
@@ -308,36 +307,39 @@ panic VA_DECL(const char *, str)
STATIC_OVL boolean STATIC_OVL boolean
should_query_disclose_option(category, defquery) should_query_disclose_option(category, defquery)
int category; int category;
int *defquery; char *defquery;
{ {
int idx; int idx;
char *dop = index(disclosure_options, category); char *dop = index(disclosure_options, category);
if (dop && defquery) {
idx = (dop - disclosure_options) / sizeof(char); if (dop && defquery) {
if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) { idx = dop - disclosure_options;
impossible( if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) {
"should_query_disclose_option: bad disclosure index %d %c", impossible(
idx, category); "should_query_disclose_option: bad disclosure index %d %c",
*defquery = DISCLOSE_PROMPT_DEFAULT_YES; idx, category);
return TRUE; *defquery = DISCLOSE_PROMPT_DEFAULT_YES;
} return TRUE;
if (flags.end_disclose[idx] == DISCLOSE_YES_WITHOUT_PROMPT) {
*defquery = 'y';
return FALSE;
} else if (flags.end_disclose[idx] == DISCLOSE_NO_WITHOUT_PROMPT) {
*defquery = 'n';
return FALSE;
} else if (flags.end_disclose[idx] == DISCLOSE_PROMPT_DEFAULT_YES) {
*defquery = 'y';
return TRUE;
} else if (flags.end_disclose[idx] == DISCLOSE_PROMPT_DEFAULT_NO) {
*defquery = 'n';
return TRUE;
}
} }
if (defquery)impossible("should_query_disclose_option: bad category %c", category); if (flags.end_disclose[idx] == DISCLOSE_YES_WITHOUT_PROMPT) {
else impossible("should_query_disclose_option: null defquery"); *defquery = 'y';
return TRUE; return FALSE;
} else if (flags.end_disclose[idx] == DISCLOSE_NO_WITHOUT_PROMPT) {
*defquery = 'n';
return FALSE;
} else if (flags.end_disclose[idx] == DISCLOSE_PROMPT_DEFAULT_YES) {
*defquery = 'y';
return TRUE;
} else if (flags.end_disclose[idx] == DISCLOSE_PROMPT_DEFAULT_NO) {
*defquery = 'n';
return TRUE;
}
}
if (defquery)
impossible("should_query_disclose_option: bad category %c", category);
else
impossible("should_query_disclose_option: null defquery");
return TRUE;
} }
STATIC_OVL void STATIC_OVL void
@@ -345,9 +347,8 @@ disclose(how,taken)
int how; int how;
boolean taken; boolean taken;
{ {
char c = 0; char c = 0, defquery;
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
int defquery;
boolean ask; boolean ask;
if (invent) { if (invent) {
@@ -359,12 +360,10 @@ boolean taken;
ask = should_query_disclose_option('i', &defquery); ask = should_query_disclose_option('i', &defquery);
if (!done_stopprint) { if (!done_stopprint) {
if (ask) c = ask ? yn_function(qbuf, ynqchars, defquery) : defquery;
c = yn_function(qbuf, ynqchars, defquery); if (c == 'y') {
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
/* New dump format by maartenj@cs.vu.nl */
struct obj *obj; struct obj *obj;
for (obj = invent; obj; obj = obj->nobj) { for (obj = invent; obj; obj = obj->nobj) {
makeknown(obj->otyp); makeknown(obj->otyp);
obj->known = obj->bknown = obj->dknown = obj->rknown = 1; obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
@@ -372,17 +371,17 @@ boolean taken;
(void) display_inventory((char *)0, TRUE); (void) display_inventory((char *)0, TRUE);
container_contents(invent, TRUE, TRUE); container_contents(invent, TRUE, TRUE);
} }
if (ask && c == 'q') done_stopprint++; if (c == 'q') done_stopprint++;
} }
} }
ask = should_query_disclose_option('a', &defquery); ask = should_query_disclose_option('a', &defquery);
if (!done_stopprint) { if (!done_stopprint) {
if (ask) c = ask ? yn_function("Do you want to see your attributes?",
c = yn_function("Do you want to see your attributes?",ynqchars, defquery); ynqchars, defquery) : defquery;
if ((!ask && defquery == 'y') || (ask && c == 'y')) if (c == 'y')
enlightenment(how >= PANICKED ? 1 : 2); /* final */ enlightenment(how >= PANICKED ? 1 : 2); /* final */
if (ask && c == 'q') done_stopprint++; if (c == 'q') done_stopprint++;
} }
ask = should_query_disclose_option('v', &defquery); ask = should_query_disclose_option('v', &defquery);
@@ -395,11 +394,11 @@ boolean taken;
ask = should_query_disclose_option('c', &defquery); ask = should_query_disclose_option('c', &defquery);
if (!done_stopprint) { if (!done_stopprint) {
if (ask) c = ask ? yn_function("Do you want to see your conduct?",
c = yn_function("Do you want to see your conduct?",ynqchars,defquery); ynqchars, defquery) : defquery;
if ((!ask && defquery == 'y') || (ask && c == 'y')) if (c == 'y')
show_conduct(how >= PANICKED ? 1 : 2); show_conduct(how >= PANICKED ? 1 : 2);
if (ask && c == 'q') done_stopprint++; if (c == 'q') done_stopprint++;
} }
} }
@@ -969,7 +968,7 @@ int status;
STATIC_OVL void STATIC_OVL void
list_vanquished(defquery, ask) list_vanquished(defquery, ask)
int defquery; char defquery;
boolean ask; boolean ask;
{ {
register int i, lev; register int i, lev;
@@ -990,11 +989,10 @@ boolean ask;
* includes all dead monsters, not just those killed by the player * includes all dead monsters, not just those killed by the player
*/ */
if (ntypes != 0) { if (ntypes != 0) {
if (ask) c = ask ? yn_function("Do you want an account of creatures vanquished?",
c = yn_function("Do you want an account of creatures vanquished?", ynqchars, defquery) : defquery;
ynqchars, defquery); if (c == 'q') done_stopprint++;
if (ask && c == 'q') done_stopprint++; if (c == 'y') {
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
klwin = create_nhwindow(NHW_MENU); klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Vanquished creatures:"); putstr(klwin, 0, "Vanquished creatures:");
putstr(klwin, 0, ""); putstr(klwin, 0, "");
@@ -1009,11 +1007,11 @@ boolean ask;
mons[i].mname); mons[i].mname);
if (nkilled > 1) { if (nkilled > 1) {
switch (nkilled) { switch (nkilled) {
case 2: Sprintf(eos(buf)," (twice)"); break; case 2: Sprintf(eos(buf)," (twice)"); break;
case 3: Sprintf(eos(buf)," (thrice)"); break; case 3: Sprintf(eos(buf)," (thrice)"); break;
default: Sprintf(eos(buf)," (%d time%s)", default: Sprintf(eos(buf)," (%d time%s)",
nkilled, plur(nkilled)); nkilled, plur(nkilled));
break; break;
} }
} }
} else { } else {
@@ -1056,7 +1054,7 @@ num_genocides()
STATIC_OVL void STATIC_OVL void
list_genocided(defquery, ask) list_genocided(defquery, ask)
int defquery; char defquery;
boolean ask; boolean ask;
{ {
register int i; register int i;
@@ -1069,11 +1067,10 @@ boolean ask;
/* genocided species list */ /* genocided species list */
if (ngenocided != 0) { if (ngenocided != 0) {
if (ask) c = ask ? yn_function("Do you want a list of species genocided?",
c = yn_function("Do you want a list of species genocided?", ynqchars, defquery) : defquery;
ynqchars, defquery); if (c == 'q') done_stopprint++;
if (ask && c == 'q') done_stopprint++; if (c == 'y') {
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
klwin = create_nhwindow(NHW_MENU); klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Genocided species:"); putstr(klwin, 0, "Genocided species:");
putstr(klwin, 0, ""); putstr(klwin, 0, "");

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hack.c 3.4 2002/09/14 */ /* SCCS Id: @(#)hack.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -787,15 +787,15 @@ boolean guess;
/* if guessing, find best location in travel matrix and go there */ /* if guessing, find best location in travel matrix and go there */
if (guess) { if (guess) {
int px = tx, py = ty; /* pick location */ int px = tx, py = ty; /* pick location */
int dist, d; int dist, nxtdist;
dist = distmin(ux, uy, tx, ty); dist = distmin(ux, uy, tx, ty);
for (tx = 1; tx < COLNO; ++tx) for (tx = 1; tx < COLNO; ++tx)
for (ty = 0; ty < ROWNO; ++ty) for (ty = 0; ty < ROWNO; ++ty)
if (travel[tx][ty]) { if (travel[tx][ty]) {
d = distmin(ux, uy, tx, ty); nxtdist = distmin(ux, uy, tx, ty);
if (d < dist && couldsee(tx, ty)) { if (nxtdist < dist && couldsee(tx, ty)) {
px = tx; py = ty; dist = d; px = tx; py = ty; dist = nxtdist;
} }
} }
@@ -838,6 +838,7 @@ domove()
xchar chainx, chainy, ballx, bally; /* ball&chain new positions */ xchar chainx, chainy, ballx, bally; /* ball&chain new positions */
int bc_control; /* control for ball&chain */ int bc_control; /* control for ball&chain */
boolean cause_delay = FALSE; /* dragging ball will skip a move */ boolean cause_delay = FALSE; /* dragging ball will skip a move */
const char *predicament;
u_wipe_engr(rnd(5)); u_wipe_engr(rnd(5));
@@ -1128,7 +1129,7 @@ domove()
} }
} else if (u.utraptype == TT_LAVA) { } else if (u.utraptype == TT_LAVA) {
if(flags.verbose) { if(flags.verbose) {
char *predicament = "stuck in the lava"; predicament = "stuck in the lava";
#ifdef STEED #ifdef STEED
if (u.usteed) if (u.usteed)
Norep("%s is %s.", upstart(y_monnam(u.usteed)), Norep("%s is %s.", upstart(y_monnam(u.usteed)),
@@ -1159,7 +1160,7 @@ domove()
} }
if(--u.utrap) { if(--u.utrap) {
if(flags.verbose) { if(flags.verbose) {
char *predicament = "stuck to the web"; predicament = "stuck to the web";
#ifdef STEED #ifdef STEED
if (u.usteed) if (u.usteed)
Norep("%s is %s.", upstart(y_monnam(u.usteed)), Norep("%s is %s.", upstart(y_monnam(u.usteed)),
@@ -1180,7 +1181,7 @@ domove()
} else if (u.utraptype == TT_INFLOOR) { } else if (u.utraptype == TT_INFLOOR) {
if(--u.utrap) { if(--u.utrap) {
if(flags.verbose) { if(flags.verbose) {
char *predicament = "stuck in the"; predicament = "stuck in the";
#ifdef STEED #ifdef STEED
if (u.usteed) if (u.usteed)
Norep("%s is %s %s.", Norep("%s is %s %s.",
@@ -1202,7 +1203,7 @@ domove()
} }
} else { } else {
if(flags.verbose) { if(flags.verbose) {
char *predicament = "caught in a bear trap"; predicament = "caught in a bear trap";
#ifdef STEED #ifdef STEED
if (u.usteed) if (u.usteed)
Norep("%s is %s.", upstart(y_monnam(u.usteed)), Norep("%s is %s.", upstart(y_monnam(u.usteed)),

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mapglyph.c 3.4 2002/07/17 */ /* SCCS Id: @(#)mapglyph.c 3.4 2003/01/08 */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -65,7 +65,9 @@ int *ochar;
unsigned *ospecial; unsigned *ospecial;
{ {
register int offset; register int offset;
#if defined(TEXTCOLOR) || defined(ROGUE_COLOR)
int color = NO_COLOR; int color = NO_COLOR;
#endif
uchar ch; uchar ch;
unsigned special = 0; unsigned special = 0;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mcastu.c 3.4 2002/02/07 */ /* SCCS Id: @(#)mcastu.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -40,7 +40,7 @@ STATIC_DCL boolean FDECL(spell_would_be_useless,(struct monst *,unsigned int,int
#ifdef OVL0 #ifdef OVL0
extern const char *flash_types[]; /* from zap.c */ extern const char * const flash_types[]; /* from zap.c */
/* feedback when frustrated monster couldn't cast a spell */ /* feedback when frustrated monster couldn't cast a spell */
STATIC_OVL STATIC_OVL

View File

@@ -1636,7 +1636,7 @@ gulpmu(mtmp, mattk) /* monster swallows you, or damage if u.uswallow */
i = number_leashed(); i = number_leashed();
if (i > 0) { if (i > 0) {
char *s = (i > 1) ? "leashes" : "leash"; const char *s = (i > 1) ? "leashes" : "leash";
pline_The("%s %s loose.", s, vtense(s, "snap")); pline_The("%s %s loose.", s, vtense(s, "snap"));
unleash_all(); unleash_all();
} }

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)options.c 3.4 2002/08/24 */ /* SCCS Id: @(#)options.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3207,12 +3207,13 @@ struct wc_Opt wc_options[] = {
*/ */
void void
set_option_mod_status(optnam, status) set_option_mod_status(optnam, status)
char *optnam; const char *optnam;
int status; int status;
{ {
int k; int k;
if (status < SET_IN_FILE || status > SET_IN_GAME) { if (status < SET_IN_FILE || status > SET_IN_GAME) {
impossible("set_option_mod_status: status out of range %d.", status); impossible("set_option_mod_status: status out of range %d.",
status);
return; return;
} }
for (k = 0; boolopt[k].name; k++) { for (k = 0; boolopt[k].name; k++) {
@@ -3244,7 +3245,8 @@ int status;
{ {
int k = 0; int k = 0;
if (status < SET_IN_FILE || status > SET_IN_GAME) { if (status < SET_IN_FILE || status > SET_IN_GAME) {
impossible("set_option_mod_status: status out of range %d.", status); impossible("set_option_mod_status: status out of range %d.",
status);
return; return;
} }
while (wc_options[k].wc_name) { while (wc_options[k].wc_name) {
@@ -3327,8 +3329,8 @@ char *op;
int j; int j;
char buf[BUFSZ]; char buf[BUFSZ];
char *wn, *tfg, *tbg, *newop; char *wn, *tfg, *tbg, *newop;
static char *wnames[] = {"menu", "message", "status", "text"}; static const char *wnames[] = { "menu", "message", "status", "text" };
static char *shortnames[] = {"mnu", "msg", "sts", "txt"}; static const char *shortnames[] = { "mnu", "msg", "sts", "txt" };
static char **fgp[] = { static char **fgp[] = {
&iflags.wc_foregrnd_menu, &iflags.wc_foregrnd_menu,
&iflags.wc_foregrnd_message, &iflags.wc_foregrnd_message,

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pickup.c 3.4 2002/09/08 */ /* SCCS Id: @(#)pickup.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2226,7 +2226,7 @@ boolean outokay, inokay;
menu_item *pick_list; menu_item *pick_list;
char buf[BUFSZ]; char buf[BUFSZ];
int n; int n;
char *menuselector = iflags.lootabc ? "abc" : "oib"; const char *menuselector = iflags.lootabc ? "abc" : "oib";
any.a_void = 0; any.a_void = 0;
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);

View File

@@ -619,7 +619,7 @@ break_armor()
/* Future possiblities: This could damage/destroy helmet */ /* Future possiblities: This could damage/destroy helmet */
Sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data))); Sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data)));
Your("%s %s through %s %s.", vtense(hornbuf, "pierce"), Your("%s through %s %s.", vtense(hornbuf, "pierce"),
shk_your(yourbuf, otmp), xname(otmp)); shk_your(yourbuf, otmp), xname(otmp));
} else { } else {
if (donning(otmp)) cancel_don(); if (donning(otmp)) cancel_don();

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)rip.c 3.4 2001/09/24 */ /* SCCS Id: @(#)rip.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -6,7 +6,7 @@
STATIC_DCL void FDECL(center, (int, char *)); STATIC_DCL void FDECL(center, (int, char *));
extern const char *killed_by_prefix[]; extern const char * const killed_by_prefix[]; /* from topten.c */
#if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS) #if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS)
# define TEXT_TOMBSTONE # define TEXT_TOMBSTONE

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)role.c 3.4 2000/08/20 */ /* SCCS Id: @(#)role.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1100,7 +1100,7 @@ int buflen, rolenum, racenum, gendnum, alignnum;
{ {
int k, gendercount = 0, aligncount = 0; int k, gendercount = 0, aligncount = 0;
char buf[BUFSZ]; char buf[BUFSZ];
char *err_ret = " character's"; static char err_ret[] = " character's";
boolean donefirst = FALSE; boolean donefirst = FALSE;
if (!suppliedbuf || buflen < 1) return err_ret; if (!suppliedbuf || buflen < 1) return err_ret;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)shk.c 3.4 2002/11/20 */ /* SCCS Id: @(#)shk.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2441,7 +2441,8 @@ register boolean peaceful, silent;
ESHK(shkp)->debit += value; ESHK(shkp)->debit += value;
if(!silent) { if(!silent) {
char *still = ""; const char *still = "";
if (credit_use) { if (credit_use) {
if (ESHK(shkp)->credit) { if (ESHK(shkp)->credit) {
You("have %ld %s credit remaining.", You("have %ld %s credit remaining.",
@@ -2454,10 +2455,11 @@ register boolean peaceful, silent;
still = "still "; still = "still ";
} }
if(obj->oclass == COIN_CLASS) if(obj->oclass == COIN_CLASS)
You("%sowe %s %ld %s!", still, mon_nam(shkp), value, currency(value)); You("%sowe %s %ld %s!", still,
else You("%sowe %s %ld %s for %s!", still, mon_nam(shkp), value, currency(value));
mon_nam(shkp), else
value, currency(value), You("%sowe %s %ld %s for %s!", still,
mon_nam(shkp), value, currency(value),
obj->quan > 1L ? "them" : "it"); obj->quan > 1L ? "them" : "it");
} }
} else { } else {

View File

@@ -1,10 +1,10 @@
/* SCCS Id: @(#)trap.c 3.4 2002/10/12 */ /* SCCS Id: @(#)trap.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
extern const char *destroy_strings[]; extern const char * const destroy_strings[]; /* from zap.c */
STATIC_DCL void FDECL(dofiretrap, (struct obj *)); STATIC_DCL void FDECL(dofiretrap, (struct obj *));
STATIC_DCL void NDECL(domagictrap); STATIC_DCL void NDECL(domagictrap);
@@ -793,13 +793,14 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
u.umonnum == PM_PIT_FIEND) u.umonnum == PM_PIT_FIEND)
pline("How pitiful. Isn't that the pits?"); pline("How pitiful. Isn't that the pits?");
if (ttype == SPIKED_PIT) { if (ttype == SPIKED_PIT) {
char *predicament = "on a set of sharp iron spikes"; const char *predicament = "on a set of sharp iron spikes";
#ifdef STEED #ifdef STEED
if (u.usteed) { if (u.usteed) {
pline("%s lands %s!", pline("%s lands %s!",
upstart(x_monnam(u.usteed, upstart(x_monnam(u.usteed,
u.usteed->mnamelth ? ARTICLE_NONE : ARTICLE_THE, u.usteed->mnamelth ? ARTICLE_NONE : ARTICLE_THE,
"poor", SUPPRESS_SADDLE, FALSE)), predicament); "poor", SUPPRESS_SADDLE, FALSE)),
predicament);
} else } else
#endif #endif
You("land %s!", predicament); You("land %s!", predicament);
@@ -1360,13 +1361,14 @@ int style;
} }
if (otyp == BOULDER && if (otyp == BOULDER &&
(otmp2 = sobj_at(BOULDER, bhitpos.x, bhitpos.y)) != 0) { (otmp2 = sobj_at(BOULDER, bhitpos.x, bhitpos.y)) != 0) {
char *bmsg = " as one boulder sets another in motion"; const char *bmsg =
" as one boulder sets another in motion";
if (!isok(bhitpos.x + dx, bhitpos.y + dy) || !dist || if (!isok(bhitpos.x + dx, bhitpos.y + dy) || !dist ||
IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ)) IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ))
bmsg = " as one boulder hits another"; bmsg = " as one boulder hits another";
You_hear("a loud crash%s!", You_hear("a loud crash%s!",
cansee(bhitpos.x, bhitpos.y) ? bmsg : ""); cansee(bhitpos.x, bhitpos.y) ? bmsg : "");
obj_extract_self(otmp2); obj_extract_self(otmp2);
/* pass off the otrapped flag to the next boulder */ /* pass off the otrapped flag to the next boulder */

View File

@@ -147,7 +147,7 @@ int adjust; /* positive => increase speed, negative => decrease */
struct obj *obj; /* item to make known if effect can be seen */ struct obj *obj; /* item to make known if effect can be seen */
{ {
struct obj *otmp; struct obj *otmp;
boolean give_msg = !in_mklev, stoned = FALSE; boolean give_msg = !in_mklev, petrify = FALSE;
unsigned int oldspeed = mon->mspeed; unsigned int oldspeed = mon->mspeed;
switch (adjust) { switch (adjust) {
@@ -172,7 +172,7 @@ struct obj *obj; /* item to make known if effect can be seen */
case -3: /* petrification */ case -3: /* petrification */
/* take away intrinsic speed but don't reduce normal speed */ /* take away intrinsic speed but don't reduce normal speed */
if (mon->permspeed == MFAST) mon->permspeed = 0; if (mon->permspeed == MFAST) mon->permspeed = 0;
stoned = TRUE; petrify = TRUE;
break; break;
} }
@@ -184,12 +184,12 @@ struct obj *obj; /* item to make known if effect can be seen */
else else
mon->mspeed = mon->permspeed; mon->mspeed = mon->permspeed;
if (give_msg && (mon->mspeed != oldspeed || stoned) && canseemon(mon)) { if (give_msg && (mon->mspeed != oldspeed || petrify) && canseemon(mon)) {
/* fast to slow (skipping intermediate state) or vice versa */ /* fast to slow (skipping intermediate state) or vice versa */
const char *howmuch = (mon->mspeed + oldspeed == MFAST + MSLOW) ? const char *howmuch = (mon->mspeed + oldspeed == MFAST + MSLOW) ?
"much " : ""; "much " : "";
if (stoned) { if (petrify) {
/* mimic the player's petrification countdown; "slowing down" /* mimic the player's petrification countdown; "slowing down"
even if fast movement rate retained via worn speed boots */ even if fast movement rate retained via worn speed boots */
if (flags.verbose) pline("%s is slowing down.", Monnam(mon)); if (flags.verbose) pline("%s is slowing down.", Monnam(mon));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)zap.c 3.4 2002/11/07 */ /* SCCS Id: @(#)zap.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -58,11 +58,11 @@ STATIC_DCL int FDECL(spell_hit_bonus, (int));
#ifndef OVLB #ifndef OVLB
STATIC_VAR const char are_blinded_by_the_flash[]; STATIC_VAR const char are_blinded_by_the_flash[];
extern const char *flash_types[]; extern const char * const flash_types[];
#else #else
STATIC_VAR const char are_blinded_by_the_flash[] = "are blinded by the flash!"; STATIC_VAR const char are_blinded_by_the_flash[] = "are blinded by the flash!";
const char * const flash_types[] = { /* also used in buzzmu(mcastu.c) */ const char * const flash_types[] = { /* also used in buzzmu(mcastu.c) */
"magic missile", /* Wands must be 0-9 */ "magic missile", /* Wands must be 0-9 */
"bolt of fire", "bolt of fire",
"bolt of cold", "bolt of cold",
@@ -3763,7 +3763,7 @@ register struct obj *obj;
return TRUE; return TRUE;
} }
const char * const destroy_strings[] = { const char * const destroy_strings[] = { /* also used in trap.c */
"freezes and shatters", "freeze and shatter", "shattered potion", "freezes and shatters", "freeze and shatter", "shattered potion",
"boils and explodes", "boil and explode", "boiling potion", "boils and explodes", "boil and explode", "boiling potion",
"catches fire and burns", "catch fire and burn", "burning scroll", "catches fire and burns", "catch fire and burn", "burning scroll",