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

@@ -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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -874,7 +874,7 @@ STATIC_OVL void
use_candelabrum(obj)
register struct obj *obj;
{
char *s = obj->spe != 1 ? "candles" : "candle";
const char *s = (obj->spe != 1) ? "candles" : "candle";
if(Underwater) {
You("cannot make fire under water.");
@@ -926,7 +926,7 @@ use_candle(obj)
register struct obj *obj;
{
register struct obj *otmp;
char *s = obj->quan != 1 ? "candles" : "candle";
const char *s = (obj->quan != 1) ? "candles" : "candle";
char qbuf[QBUFSZ];
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. */
/* 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_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
@@ -2035,11 +2035,11 @@ const char *s;
STATIC_OVL boolean
help_dir(sym, msg)
char sym;
char *msg;
const char *msg;
{
char ctrl;
winid win;
char *wiz_only_list = "EFGIOVW";
const char wiz_only_list[] = "EFGIOVW";
char buf[BUFSZ], buf2[BUFSZ], *expl;
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. */
/* 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!");
(void) angry_guards(!(flags.soundok));
} else {
char *str;
const char *str;
if (IS_DOOR(lev->typ))
str = "door";
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1314,7 +1314,8 @@ boolean shop_floor_obj;
/* some things break rather than ship */
if (breaktest(otmp)) {
char *result;
const char *result;
if (objects[otmp->otyp].oc_material == GLASS
#ifdef TOURIST
|| 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. */
/* 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 (IS_ROCK(levl[x][y].typ) || closed_door(x,y)) {
char *s;
const char *s;
pline("Ouch!");
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
static struct valuable_data
gems[LAST_GEM+1 - FIRST_GEM + 1], /* 1 extra for glass */
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(artifact_score, (struct obj *,BOOLEAN_P,winid));
STATIC_DCL void FDECL(savelife, (int));
STATIC_DCL void FDECL(list_vanquished, (int, BOOLEAN_P));
STATIC_DCL void FDECL(list_genocided, (int, BOOLEAN_P));
STATIC_DCL boolean FDECL(should_query_disclose_option, (int, int*));
STATIC_DCL void FDECL(list_vanquished, (CHAR_P,BOOLEAN_P));
STATIC_DCL void FDECL(list_genocided, (CHAR_P,BOOLEAN_P));
STATIC_DCL boolean FDECL(should_query_disclose_option, (int,char *));
#if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2)
extern void FDECL(nethack_exit,(int));
@@ -84,8 +84,7 @@ static NEARDATA const char *ends[] = { /* "when you..." */
"quit", "escaped", "ascended"
};
extern const char *killed_by_prefix[];
extern const char * const killed_by_prefix[]; /* from topten.c */
/*ARGSUSED*/
void
@@ -308,36 +307,39 @@ panic VA_DECL(const char *, str)
STATIC_OVL boolean
should_query_disclose_option(category, defquery)
int category;
int *defquery;
char *defquery;
{
int idx;
char *dop = index(disclosure_options, category);
if (dop && defquery) {
idx = (dop - disclosure_options) / sizeof(char);
if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) {
impossible(
"should_query_disclose_option: bad disclosure index %d %c",
idx, category);
*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;
}
int idx;
char *dop = index(disclosure_options, category);
if (dop && defquery) {
idx = dop - disclosure_options;
if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) {
impossible(
"should_query_disclose_option: bad disclosure index %d %c",
idx, category);
*defquery = DISCLOSE_PROMPT_DEFAULT_YES;
return TRUE;
}
if (defquery)impossible("should_query_disclose_option: bad category %c", category);
else impossible("should_query_disclose_option: null defquery");
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);
else
impossible("should_query_disclose_option: null defquery");
return TRUE;
}
STATIC_OVL void
@@ -345,9 +347,8 @@ disclose(how,taken)
int how;
boolean taken;
{
char c = 0;
char c = 0, defquery;
char qbuf[QBUFSZ];
int defquery;
boolean ask;
if (invent) {
@@ -359,12 +360,10 @@ boolean taken;
ask = should_query_disclose_option('i', &defquery);
if (!done_stopprint) {
if (ask)
c = yn_function(qbuf, ynqchars, defquery);
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
/* New dump format by maartenj@cs.vu.nl */
c = ask ? yn_function(qbuf, ynqchars, defquery) : defquery;
if (c == 'y') {
struct obj *obj;
for (obj = invent; obj; obj = obj->nobj) {
makeknown(obj->otyp);
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
@@ -372,17 +371,17 @@ boolean taken;
(void) display_inventory((char *)0, 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 (ask)
c = yn_function("Do you want to see your attributes?",ynqchars, defquery);
if ((!ask && defquery == 'y') || (ask && c == 'y'))
c = ask ? yn_function("Do you want to see your attributes?",
ynqchars, defquery) : defquery;
if (c == 'y')
enlightenment(how >= PANICKED ? 1 : 2); /* final */
if (ask && c == 'q') done_stopprint++;
if (c == 'q') done_stopprint++;
}
ask = should_query_disclose_option('v', &defquery);
@@ -395,11 +394,11 @@ boolean taken;
ask = should_query_disclose_option('c', &defquery);
if (!done_stopprint) {
if (ask)
c = yn_function("Do you want to see your conduct?",ynqchars,defquery);
if ((!ask && defquery == 'y') || (ask && c == 'y'))
c = ask ? yn_function("Do you want to see your conduct?",
ynqchars, defquery) : defquery;
if (c == 'y')
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
list_vanquished(defquery, ask)
int defquery;
char defquery;
boolean ask;
{
register int i, lev;
@@ -990,11 +989,10 @@ boolean ask;
* includes all dead monsters, not just those killed by the player
*/
if (ntypes != 0) {
if (ask)
c = yn_function("Do you want an account of creatures vanquished?",
ynqchars, defquery);
if (ask && c == 'q') done_stopprint++;
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
c = ask ? yn_function("Do you want an account of creatures vanquished?",
ynqchars, defquery) : defquery;
if (c == 'q') done_stopprint++;
if (c == 'y') {
klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Vanquished creatures:");
putstr(klwin, 0, "");
@@ -1009,11 +1007,11 @@ boolean ask;
mons[i].mname);
if (nkilled > 1) {
switch (nkilled) {
case 2: Sprintf(eos(buf)," (twice)"); break;
case 3: Sprintf(eos(buf)," (thrice)"); break;
default: Sprintf(eos(buf)," (%d time%s)",
nkilled, plur(nkilled));
break;
case 2: Sprintf(eos(buf)," (twice)"); break;
case 3: Sprintf(eos(buf)," (thrice)"); break;
default: Sprintf(eos(buf)," (%d time%s)",
nkilled, plur(nkilled));
break;
}
}
} else {
@@ -1056,7 +1054,7 @@ num_genocides()
STATIC_OVL void
list_genocided(defquery, ask)
int defquery;
char defquery;
boolean ask;
{
register int i;
@@ -1069,11 +1067,10 @@ boolean ask;
/* genocided species list */
if (ngenocided != 0) {
if (ask)
c = yn_function("Do you want a list of species genocided?",
ynqchars, defquery);
if (ask && c == 'q') done_stopprint++;
if ((!ask && defquery == 'y') || (ask && c == 'y')) {
c = ask ? yn_function("Do you want a list of species genocided?",
ynqchars, defquery) : defquery;
if (c == 'q') done_stopprint++;
if (c == 'y') {
klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Genocided species:");
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. */
/* 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 (guess) {
int px = tx, py = ty; /* pick location */
int dist, d;
int dist, nxtdist;
dist = distmin(ux, uy, tx, ty);
for (tx = 1; tx < COLNO; ++tx)
for (ty = 0; ty < ROWNO; ++ty)
if (travel[tx][ty]) {
d = distmin(ux, uy, tx, ty);
if (d < dist && couldsee(tx, ty)) {
px = tx; py = ty; dist = d;
nxtdist = distmin(ux, uy, tx, ty);
if (nxtdist < dist && couldsee(tx, ty)) {
px = tx; py = ty; dist = nxtdist;
}
}
@@ -838,6 +838,7 @@ domove()
xchar chainx, chainy, ballx, bally; /* ball&chain new positions */
int bc_control; /* control for ball&chain */
boolean cause_delay = FALSE; /* dragging ball will skip a move */
const char *predicament;
u_wipe_engr(rnd(5));
@@ -1128,7 +1129,7 @@ domove()
}
} else if (u.utraptype == TT_LAVA) {
if(flags.verbose) {
char *predicament = "stuck in the lava";
predicament = "stuck in the lava";
#ifdef STEED
if (u.usteed)
Norep("%s is %s.", upstart(y_monnam(u.usteed)),
@@ -1159,7 +1160,7 @@ domove()
}
if(--u.utrap) {
if(flags.verbose) {
char *predicament = "stuck to the web";
predicament = "stuck to the web";
#ifdef STEED
if (u.usteed)
Norep("%s is %s.", upstart(y_monnam(u.usteed)),
@@ -1180,7 +1181,7 @@ domove()
} else if (u.utraptype == TT_INFLOOR) {
if(--u.utrap) {
if(flags.verbose) {
char *predicament = "stuck in the";
predicament = "stuck in the";
#ifdef STEED
if (u.usteed)
Norep("%s is %s %s.",
@@ -1202,7 +1203,7 @@ domove()
}
} else {
if(flags.verbose) {
char *predicament = "caught in a bear trap";
predicament = "caught in a bear trap";
#ifdef STEED
if (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 */
/* NetHack may be freely redistributed. See license for details. */
@@ -65,7 +65,9 @@ int *ochar;
unsigned *ospecial;
{
register int offset;
#if defined(TEXTCOLOR) || defined(ROGUE_COLOR)
int color = NO_COLOR;
#endif
uchar ch;
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. */
/* 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
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 */
STATIC_OVL

View File

@@ -1636,7 +1636,7 @@ gulpmu(mtmp, mattk) /* monster swallows you, or damage if u.uswallow */
i = number_leashed();
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"));
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3207,12 +3207,13 @@ struct wc_Opt wc_options[] = {
*/
void
set_option_mod_status(optnam, status)
char *optnam;
const char *optnam;
int status;
{
int k;
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;
}
for (k = 0; boolopt[k].name; k++) {
@@ -3244,7 +3245,8 @@ int status;
{
int k = 0;
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;
}
while (wc_options[k].wc_name) {
@@ -3327,8 +3329,8 @@ char *op;
int j;
char buf[BUFSZ];
char *wn, *tfg, *tbg, *newop;
static char *wnames[] = {"menu", "message", "status", "text"};
static char *shortnames[] = {"mnu", "msg", "sts", "txt"};
static const char *wnames[] = { "menu", "message", "status", "text" };
static const char *shortnames[] = { "mnu", "msg", "sts", "txt" };
static char **fgp[] = {
&iflags.wc_foregrnd_menu,
&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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2226,7 +2226,7 @@ boolean outokay, inokay;
menu_item *pick_list;
char buf[BUFSZ];
int n;
char *menuselector = iflags.lootabc ? "abc" : "oib";
const char *menuselector = iflags.lootabc ? "abc" : "oib";
any.a_void = 0;
win = create_nhwindow(NHW_MENU);

View File

@@ -619,7 +619,7 @@ break_armor()
/* Future possiblities: This could damage/destroy helmet */
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));
} else {
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -6,7 +6,7 @@
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)
# 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. */
/* 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;
char buf[BUFSZ];
char *err_ret = " character's";
static char err_ret[] = " character's";
boolean donefirst = FALSE;
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2441,7 +2441,8 @@ register boolean peaceful, silent;
ESHK(shkp)->debit += value;
if(!silent) {
char *still = "";
const char *still = "";
if (credit_use) {
if (ESHK(shkp)->credit) {
You("have %ld %s credit remaining.",
@@ -2454,10 +2455,11 @@ register boolean peaceful, silent;
still = "still ";
}
if(obj->oclass == COIN_CLASS)
You("%sowe %s %ld %s!", still, mon_nam(shkp), value, currency(value));
else You("%sowe %s %ld %s for %s!", still,
mon_nam(shkp),
value, currency(value),
You("%sowe %s %ld %s!", still,
mon_nam(shkp), value, currency(value));
else
You("%sowe %s %ld %s for %s!", still,
mon_nam(shkp), value, currency(value),
obj->quan > 1L ? "them" : "it");
}
} 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. */
/* NetHack may be freely redistributed. See license for details. */
#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 NDECL(domagictrap);
@@ -793,13 +793,14 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
u.umonnum == PM_PIT_FIEND)
pline("How pitiful. Isn't that the pits?");
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
if (u.usteed) {
pline("%s lands %s!",
upstart(x_monnam(u.usteed,
u.usteed->mnamelth ? ARTICLE_NONE : ARTICLE_THE,
"poor", SUPPRESS_SADDLE, FALSE)), predicament);
"poor", SUPPRESS_SADDLE, FALSE)),
predicament);
} else
#endif
You("land %s!", predicament);
@@ -1360,13 +1361,14 @@ int style;
}
if (otyp == BOULDER &&
(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 ||
IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ))
bmsg = " as one boulder hits another";
You_hear("a loud crash%s!",
You_hear("a loud crash%s!",
cansee(bhitpos.x, bhitpos.y) ? bmsg : "");
obj_extract_self(otmp2);
/* 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 *otmp;
boolean give_msg = !in_mklev, stoned = FALSE;
boolean give_msg = !in_mklev, petrify = FALSE;
unsigned int oldspeed = mon->mspeed;
switch (adjust) {
@@ -172,7 +172,7 @@ struct obj *obj; /* item to make known if effect can be seen */
case -3: /* petrification */
/* take away intrinsic speed but don't reduce normal speed */
if (mon->permspeed == MFAST) mon->permspeed = 0;
stoned = TRUE;
petrify = TRUE;
break;
}
@@ -184,12 +184,12 @@ struct obj *obj; /* item to make known if effect can be seen */
else
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 */
const char *howmuch = (mon->mspeed + oldspeed == MFAST + MSLOW) ?
"much " : "";
if (stoned) {
if (petrify) {
/* mimic the player's petrification countdown; "slowing down"
even if fast movement rate retained via worn speed boots */
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -58,11 +58,11 @@ STATIC_DCL int FDECL(spell_hit_bonus, (int));
#ifndef OVLB
STATIC_VAR const char are_blinded_by_the_flash[];
extern const char *flash_types[];
extern const char * const flash_types[];
#else
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 */
"bolt of fire",
"bolt of cold",
@@ -3763,7 +3763,7 @@ register struct obj *obj;
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",
"boils and explodes", "boil and explode", "boiling potion",
"catches fire and burns", "catch fire and burn", "burning scroll",