E char *FDECL(nh_getenv, (const char *));
E void FDECL(set_duplicate_opt_detection, (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 ### */
-/* SCCS Id: @(#)winprocs.h 3.4 1996/02/18 */
+/* SCCS Id: @(#)winprocs.h 3.4 2003/01/08 */
/* Copyright (c) David Cohrs, 1992 */
/* NetHack may be freely redistributed. See license for details. */
#endif
struct wc_Opt {
- char *wc_name;
+ const char *wc_name;
unsigned long wc_bit;
};
-/* 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. */
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.");
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) {
-/* 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. */
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
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);
-/* 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. */
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))
-/* 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. */
/* 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
-/* 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. */
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))
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];
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));
"quit", "escaped", "ascended"
};
-extern const char *killed_by_prefix[];
-
+extern const char * const killed_by_prefix[]; /* from topten.c */
/*ARGSUSED*/
void
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
int how;
boolean taken;
{
- char c = 0;
+ char c = 0, defquery;
char qbuf[QBUFSZ];
- int defquery;
boolean ask;
if (invent) {
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;
(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);
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++;
}
}
STATIC_OVL void
list_vanquished(defquery, ask)
-int defquery;
+char defquery;
boolean ask;
{
register int i, lev;
* 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, "");
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 {
STATIC_OVL void
list_genocided(defquery, ask)
-int defquery;
+char defquery;
boolean ask;
{
register int i;
/* 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, "");
-/* 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. */
/* 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;
}
}
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));
}
} 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)),
}
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)),
} 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.",
}
} 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)),
-/* 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. */
unsigned *ospecial;
{
register int offset;
+#if defined(TEXTCOLOR) || defined(ROGUE_COLOR)
int color = NO_COLOR;
+#endif
uchar ch;
unsigned special = 0;
-/* 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. */
#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
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();
}
-/* 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. */
*/
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++) {
{
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) {
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,
-/* 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. */
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);
/* 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();
-/* 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. */
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
-/* 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. */
{
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;
-/* 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. */
ESHK(shkp)->debit += value;
if(!silent) {
- char *still = "";
+ const char *still = "";
+
if (credit_use) {
if (ESHK(shkp)->credit) {
You("have %ld %s credit remaining.",
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 {
-/* 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);
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);
}
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 */
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) {
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;
}
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));
-/* 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. */
#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",
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",