Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-11-16 17:09:44 -05:00
4 changed files with 130 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.740 $ */ /* NetHack 3.6 extern.h $NHDT-Date: 1573940539 2019/11/16 21:42:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.741 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -452,6 +452,7 @@ E char *FDECL(Amonnam, (struct monst *));
E char *FDECL(a_monnam, (struct monst *)); E char *FDECL(a_monnam, (struct monst *));
E char *FDECL(distant_monnam, (struct monst *, int, char *)); E char *FDECL(distant_monnam, (struct monst *, int, char *));
E char *FDECL(mon_nam_too, (struct monst *, struct monst *)); E char *FDECL(mon_nam_too, (struct monst *, struct monst *));
E char *FDECL(minimal_monnam, (struct monst *, BOOLEAN_P));
E char *FDECL(rndmonnam, (char *)); E char *FDECL(rndmonnam, (char *));
E const char *FDECL(hcolor, (const char *)); E const char *FDECL(hcolor, (const char *));
E const char *NDECL(rndcolor); E const char *NDECL(rndcolor);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 ball.c $NHDT-Date: 1570566373 2019/10/08 20:26:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.43 $ */ /* NetHack 3.6 ball.c $NHDT-Date: 1573940835 2019/11/16 21:47:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) David Cohrs, 2006. */ /*-Copyright (c) David Cohrs, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -194,8 +194,7 @@ placebc()
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
char panicbuf[BUFSZ]; char panicbuf[BUFSZ];
Sprintf(panicbuf, Sprintf(panicbuf, "placebc denied, restriction in effect");
"placebc denied, restriction in effect");
paniclog("placebc", panicbuf); paniclog("placebc", panicbuf);
#endif #endif
return; return;
@@ -239,10 +238,9 @@ int pin;
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
char panicbuf[BUFSZ]; char panicbuf[BUFSZ];
Sprintf(panicbuf, Sprintf(panicbuf, "lift_covet_and_placebc denied, %s",
"lift_covet_and_placebc denied, %s", (pin != bcrestriction) ? "pin mismatch"
(pin != bcrestriction) ? : "restriction in effect");
"pin mismatch" : "restriction in effect");
paniclog("placebc", panicbuf); paniclog("placebc", panicbuf);
#endif #endif
return; return;
@@ -265,8 +263,7 @@ int linenum;
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
char panicbuf[BUFSZ]; char panicbuf[BUFSZ];
Sprintf(panicbuf, Sprintf(panicbuf, "Placebc denied to %s:%d, restricted by %s:%d",
"Placebc denied to %s:%d, restricted by %s:%d",
funcnm, linenum, funcnm, linenum,
bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum); bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum);
paniclog("Placebc", panicbuf); paniclog("Placebc", panicbuf);
@@ -296,10 +293,9 @@ int linenum;
if (bcrestriction) { if (bcrestriction) {
char panicbuf[BUFSZ]; char panicbuf[BUFSZ];
Sprintf(panicbuf, Sprintf(panicbuf, "Unplacebc from %s:%d, when restricted to %s:%d",
"Unplacebc from %s:%d, when restricted to %s:%d", funcnm, linenum,
funcnm, linenum, bcubreadcrumbs.funcnm, bcubreadcrumbs.linenum);
bcubreadcrumbs.funcnm, bcubreadcrumbs.linenum);
paniclog("Unplacebc", panicbuf); paniclog("Unplacebc", panicbuf);
} }
bcpbreadcrumbs.in_effect = FALSE; bcpbreadcrumbs.in_effect = FALSE;
@@ -343,7 +339,7 @@ int linenum;
char panicbuf[BUFSZ]; char panicbuf[BUFSZ];
Sprintf(panicbuf, Sprintf(panicbuf,
"Lift_covet_and_placebc denied to %s:%d, restricted by %s:%d", "Lift_covet_and_placebc denied to %s:%d, restricted by %s:%d",
funcnm, linenum, funcnm, linenum,
bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum); bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum);
paniclog("Lift_covet_and_placebc", panicbuf); paniclog("Lift_covet_and_placebc", panicbuf);

View File

@@ -5,26 +5,26 @@
#include "hack.h" #include "hack.h"
static char *NDECL(nextmbuf); STATIC_DCL char *NDECL(nextmbuf);
static void FDECL(getpos_help, (BOOLEAN_P, const char *)); STATIC_DCL void FDECL(getpos_help, (BOOLEAN_P, const char *));
static int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *)); STATIC_DCL int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *));
static boolean FDECL(gather_locs_interesting, (int, int, int)); STATIC_DCL boolean FDECL(gather_locs_interesting, (int, int, int));
static void FDECL(gather_locs, (coord **, int *, int)); STATIC_DCL void FDECL(gather_locs, (coord **, int *, int));
static int FDECL(gloc_filter_floodfill_matcharea, (int, int)); STATIC_DCL int FDECL(gloc_filter_floodfill_matcharea, (int, int));
static void FDECL(auto_describe, (int, int)); STATIC_DCL void FDECL(auto_describe, (int, int));
static void NDECL(do_mname); STATIC_DCL void NDECL(do_mname);
static boolean FDECL(alreadynamed, (struct monst *, char *, char *)); STATIC_DCL boolean FDECL(alreadynamed, (struct monst *, char *, char *));
static void FDECL(do_oname, (struct obj *)); STATIC_DCL void FDECL(do_oname, (struct obj *));
static char *FDECL(docall_xname, (struct obj *)); STATIC_PTR char *FDECL(docall_xname, (struct obj *));
static void NDECL(namefloorobj); STATIC_DCL void NDECL(namefloorobj);
static char *FDECL(bogusmon, (char *,char *)); STATIC_DCL char *FDECL(bogusmon, (char *,char *));
extern const char what_is_an_unknown_object[]; /* from pager.c */ extern const char what_is_an_unknown_object[]; /* from pager.c */
#define NUMMBUF 5 #define NUMMBUF 5
/* manage a pool of BUFSZ buffers, so callers don't have to */ /* manage a pool of BUFSZ buffers, so callers don't have to */
static char * STATIC_OVL char *
nextmbuf() nextmbuf()
{ {
static char NEARDATA bufs[NUMMBUF][BUFSZ]; static char NEARDATA bufs[NUMMBUF][BUFSZ];
@@ -87,7 +87,7 @@ int gloc;
} }
/* the response for '?' help request in getpos() */ /* the response for '?' help request in getpos() */
static void STATIC_OVL void
getpos_help(force, goal) getpos_help(force, goal)
boolean force; boolean force;
const char *goal; const char *goal;
@@ -100,7 +100,7 @@ const char *goal;
Sprintf(sbuf, Sprintf(sbuf,
"Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */ "Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */
g.Cmd.move_W, g.Cmd.move_S, g.Cmd.move_N, g.Cmd.move_E, goal); Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E, goal);
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
"Use 'H', 'J', 'K', 'L' to fast-move the cursor, %s.", "Use 'H', 'J', 'K', 'L' to fast-move the cursor, %s.",
@@ -108,47 +108,47 @@ const char *goal;
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
putstr(tmpwin, 0, "Or enter a background symbol (ex. '<')."); putstr(tmpwin, 0, "Or enter a background symbol (ex. '<').");
Sprintf(sbuf, "Use '%s' to move the cursor on yourself.", Sprintf(sbuf, "Use '%s' to move the cursor on yourself.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_SELF])); visctrl(Cmd.spkeys[NHKF_GETPOS_SELF]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_MON_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_PREV]), visctrl(Cmd.spkeys[NHKF_GETPOS_MON_PREV]),
GLOC_MONS); GLOC_MONS);
} }
if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) {
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_PREV]), visctrl(Cmd.spkeys[NHKF_GETPOS_OBJ_PREV]),
GLOC_OBJS); GLOC_OBJS);
} }
if (!iflags.terrainmode || (iflags.terrainmode & TER_MAP) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_MAP) != 0) {
/* these are primarily useful when choosing a travel /* these are primarily useful when choosing a travel
destination for the '_' command */ destination for the '_' command */
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_DOOR_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_DOOR_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_DOOR_PREV]), visctrl(Cmd.spkeys[NHKF_GETPOS_DOOR_PREV]),
GLOC_DOOR); GLOC_DOOR);
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_UNEX_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_UNEX_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_UNEX_PREV]), visctrl(Cmd.spkeys[NHKF_GETPOS_UNEX_PREV]),
GLOC_EXPLORE); GLOC_EXPLORE);
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_INTERESTING_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_INTERESTING_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_INTERESTING_PREV]), visctrl(Cmd.spkeys[NHKF_GETPOS_INTERESTING_PREV]),
GLOC_INTERESTING); GLOC_INTERESTING);
} }
Sprintf(sbuf, "Use '%s' to change fast-move mode to %s.", Sprintf(sbuf, "Use '%s' to change fast-move mode to %s.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]), visctrl(Cmd.spkeys[NHKF_GETPOS_MOVESKIP]),
fastmovemode[!iflags.getloc_moveskip]); fastmovemode[!iflags.getloc_moveskip]);
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode || (iflags.terrainmode & TER_DETECT) == 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_DETECT) == 0) {
Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.", Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MENU])); visctrl(Cmd.spkeys[NHKF_GETPOS_MENU]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
"Use '%s' to change the mode of limiting possible targets.", "Use '%s' to change the mode of limiting possible targets.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW])); visctrl(Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
} }
if (!iflags.terrainmode) { if (!iflags.terrainmode) {
@@ -156,56 +156,56 @@ const char *goal;
if (getpos_getvalid) { if (getpos_getvalid) {
Sprintf(sbuf, "Use '%s' or '%s' to move to valid locations.", Sprintf(sbuf, "Use '%s' or '%s' to move to valid locations.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_VALID_NEXT]), visctrl(Cmd.spkeys[NHKF_GETPOS_VALID_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_VALID_PREV])); visctrl(Cmd.spkeys[NHKF_GETPOS_VALID_PREV]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
} }
if (getpos_hilitefunc) { if (getpos_hilitefunc) {
Sprintf(sbuf, "Use '%s' to display valid locations.", Sprintf(sbuf, "Use '%s' to display valid locations.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_SHOWVALID])); visctrl(Cmd.spkeys[NHKF_GETPOS_SHOWVALID]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
} }
Sprintf(sbuf, "Use '%s' to toggle automatic description.", Sprintf(sbuf, "Use '%s' to toggle automatic description.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC])); visctrl(Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (iflags.cmdassist) { /* assisting the '/' command, I suppose... */ if (iflags.cmdassist) { /* assisting the '/' command, I suppose... */
Sprintf(sbuf, Sprintf(sbuf,
(iflags.getpos_coords == GPCOORDS_NONE) (iflags.getpos_coords == GPCOORDS_NONE)
? "(Set 'whatis_coord' option to include coordinates with '%s' text.)" ? "(Set 'whatis_coord' option to include coordinates with '%s' text.)"
: "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)", : "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC])); visctrl(Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
} }
/* disgusting hack; the alternate selection characters work for any /* disgusting hack; the alternate selection characters work for any
getpos call, but only matter for dowhatis (and doquickwhatis) */ getpos call, but only matter for dowhatis (and doquickwhatis) */
doing_what_is = (goal == what_is_an_unknown_object); doing_what_is = (goal == what_is_an_unknown_object);
if (doing_what_is) { if (doing_what_is) {
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'", Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]), visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_Q]), visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_Q]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_O]), visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_O]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_V])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V]));
} else { } else {
Sprintf(kbuf, "'%s'", visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK])); Sprintf(kbuf, "'%s'", visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]));
} }
Sprintf(sbuf, "Type a %s when you are at the right place.", kbuf); Sprintf(sbuf, "Type a %s when you are at the right place.", kbuf);
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (doing_what_is) { if (doing_what_is) {
Sprintf(sbuf, Sprintf(sbuf,
" '%s' describe current spot, show 'more info', move to another spot.", " '%s' describe current spot, show 'more info', move to another spot.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_V])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
" '%s' describe current spot,%s move to another spot;", " '%s' describe current spot,%s move to another spot;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]), visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
flags.help ? " prompt if 'more info'," : ""); flags.help ? " prompt if 'more info'," : "");
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
" '%s' describe current spot, move to another spot;", " '%s' describe current spot, move to another spot;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_Q])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_Q]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
" '%s' describe current spot, stop looking at things;", " '%s' describe current spot, stop looking at things;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_O])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_O]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
} }
} }
@@ -216,7 +216,7 @@ const char *goal;
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
} }
static int STATIC_OVL int
cmp_coord_distu(a, b) cmp_coord_distu(a, b)
const void *a; const void *a;
const void *b; const void *b;
@@ -244,9 +244,13 @@ const void *b;
&& glyph_to_cmap(levl[(x)][(y)].glyph) == S_stone \ && glyph_to_cmap(levl[(x)][(y)].glyph) == S_stone \
&& !levl[(x)][(y)].seenv) && !levl[(x)][(y)].seenv)
static struct opvar *gloc_filter_map = (struct opvar *) 0;
#define GLOC_SAME_AREA(x,y) \ #define GLOC_SAME_AREA(x,y) \
(isok((x), (y)) \ (isok((x), (y)) \
&& (selection_getpoint((x),(y), g.gloc_filter_map))) && (selection_getpoint((x),(y), gloc_filter_map)))
static int gloc_filter_floodfill_match_glyph;
int int
gloc_filter_classify_glyph(glyph) gloc_filter_classify_glyph(glyph)
@@ -272,7 +276,7 @@ int glyph;
return 0; return 0;
} }
static int STATIC_OVL int
gloc_filter_floodfill_matcharea(x, y) gloc_filter_floodfill_matcharea(x, y)
int x, y; int x, y;
{ {
@@ -281,11 +285,11 @@ int x, y;
if (!levl[x][y].seenv) if (!levl[x][y].seenv)
return FALSE; return FALSE;
if (glyph == g.gloc_filter_floodfill_match_glyph) if (glyph == gloc_filter_floodfill_match_glyph)
return TRUE; return TRUE;
if (gloc_filter_classify_glyph(glyph) if (gloc_filter_classify_glyph(glyph)
== gloc_filter_classify_glyph(g.gloc_filter_floodfill_match_glyph)) == gloc_filter_classify_glyph(gloc_filter_floodfill_match_glyph))
return TRUE; return TRUE;
return FALSE; return FALSE;
@@ -295,18 +299,18 @@ void
gloc_filter_floodfill(x, y) gloc_filter_floodfill(x, y)
int x, y; int x, y;
{ {
g.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y); gloc_filter_floodfill_match_glyph = back_to_glyph(x, y);
set_selection_floodfillchk(gloc_filter_floodfill_matcharea); set_selection_floodfillchk(gloc_filter_floodfill_matcharea);
selection_floodfill(g.gloc_filter_map, x, y, FALSE); selection_floodfill(gloc_filter_map, x, y, FALSE);
} }
void void
gloc_filter_init() gloc_filter_init()
{ {
if (iflags.getloc_filter == GFILTER_AREA) { if (iflags.getloc_filter == GFILTER_AREA) {
if (!g.gloc_filter_map) { if (!gloc_filter_map) {
g.gloc_filter_map = selection_new(); gloc_filter_map = selection_opvar((char *) 0);
} }
/* special case: if we're in a doorway, try to figure out which /* special case: if we're in a doorway, try to figure out which
direction we're moving, and use that side of the doorway */ direction we're moving, and use that side of the doorway */
@@ -325,14 +329,13 @@ gloc_filter_init()
void void
gloc_filter_done() gloc_filter_done()
{ {
if (g.gloc_filter_map) { if (gloc_filter_map) {
selection_free(g.gloc_filter_map); opvar_free_x(gloc_filter_map);
g.gloc_filter_map = (struct selectionvar *) 0; gloc_filter_map = (struct opvar *) 0;
} }
} }
static boolean STATIC_OVL boolean
gather_locs_interesting(x, y, gloc) gather_locs_interesting(x, y, gloc)
int x, y, gloc; int x, y, gloc;
{ {
@@ -404,7 +407,7 @@ int x, y, gloc;
} }
/* gather locations for monsters or objects shown on the map */ /* gather locations for monsters or objects shown on the map */
static void STATIC_OVL void
gather_locs(arr_p, cnt_p, gloc) gather_locs(arr_p, cnt_p, gloc)
coord **arr_p; coord **arr_p;
int *cnt_p; int *cnt_p;
@@ -531,7 +534,7 @@ char *outbuf, cmode;
return outbuf; return outbuf;
} }
static void STATIC_OVL void
auto_describe(cx, cy) auto_describe(cx, cy)
int cx, cy; int cx, cy;
{ {
@@ -582,7 +585,7 @@ int gloc;
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin); start_menu(tmpwin);
any = cg.zeroany; any = zeroany;
/* gather_locs returns array[0] == you. skip it. */ /* gather_locs returns array[0] == you. skip it. */
for (i = 1; i < gcount; i++) { for (i = 1; i < gcount; i++) {
@@ -663,18 +666,18 @@ const char *goal;
int gidx[NUM_GLOCS] = DUMMY; int gidx[NUM_GLOCS] = DUMMY;
for (i = 0; i < SIZE(pick_chars_def); i++) for (i = 0; i < SIZE(pick_chars_def); i++)
pick_chars[i] = g.Cmd.spkeys[pick_chars_def[i].nhkf]; pick_chars[i] = Cmd.spkeys[pick_chars_def[i].nhkf];
pick_chars[SIZE(pick_chars_def)] = '\0'; pick_chars[SIZE(pick_chars_def)] = '\0';
for (i = 0; i < SIZE(mMoOdDxX_def); i++) for (i = 0; i < SIZE(mMoOdDxX_def); i++)
mMoOdDxX[i] = g.Cmd.spkeys[mMoOdDxX_def[i]]; mMoOdDxX[i] = Cmd.spkeys[mMoOdDxX_def[i]];
mMoOdDxX[SIZE(mMoOdDxX_def)] = '\0'; mMoOdDxX[SIZE(mMoOdDxX_def)] = '\0';
if (!goal) if (!goal)
goal = "desired location"; goal = "desired location";
if (flags.verbose) { if (flags.verbose) {
pline("(For instructions type a '%s')", pline("(For instructions type a '%s')",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_HELP])); visctrl(Cmd.spkeys[NHKF_GETPOS_HELP]));
msg_given = TRUE; msg_given = TRUE;
} }
cx = ccp->x; cx = ccp->x;
@@ -709,7 +712,7 @@ const char *goal;
if (iflags.autodescribe) if (iflags.autodescribe)
msg_given = FALSE; msg_given = FALSE;
if (c == g.Cmd.spkeys[NHKF_ESC]) { if (c == Cmd.spkeys[NHKF_ESC]) {
cx = cy = -10; cx = cy = -10;
msg_given = TRUE; /* force clear */ msg_given = TRUE; /* force clear */
result = -1; result = -1;
@@ -731,12 +734,12 @@ const char *goal;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
int dx, dy; int dx, dy;
if (g.Cmd.dirchars[i] == c) { if (Cmd.dirchars[i] == c) {
/* a normal movement letter or digit */ /* a normal movement letter or digit */
dx = xdir[i]; dx = xdir[i];
dy = ydir[i]; dy = ydir[i];
} else if (g.Cmd.alphadirchars[i] == lowc((char) c) } else if (Cmd.alphadirchars[i] == lowc((char) c)
|| (g.Cmd.num_pad && g.Cmd.dirchars[i] == (c & 0177))) { || (Cmd.num_pad && Cmd.dirchars[i] == (c & 0177))) {
/* a shifted movement letter or Meta-digit */ /* a shifted movement letter or Meta-digit */
if (iflags.getloc_moveskip) { if (iflags.getloc_moveskip) {
/* skip same glyphs */ /* skip same glyphs */
@@ -779,15 +782,15 @@ const char *goal;
goto nxtc; goto nxtc;
} }
if (c == g.Cmd.spkeys[NHKF_GETPOS_HELP] || redraw_cmd(c)) { if (c == Cmd.spkeys[NHKF_GETPOS_HELP] || redraw_cmd(c)) {
if (c == g.Cmd.spkeys[NHKF_GETPOS_HELP]) if (c == Cmd.spkeys[NHKF_GETPOS_HELP])
getpos_help(force, goal); getpos_help(force, goal);
else /* ^R */ else /* ^R */
docrt(); /* redraw */ docrt(); /* redraw */
/* update message window to reflect that we're still targetting */ /* update message window to reflect that we're still targetting */
show_goal_msg = TRUE; show_goal_msg = TRUE;
msg_given = TRUE; msg_given = TRUE;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_SHOWVALID] } else if (c == Cmd.spkeys[NHKF_GETPOS_SHOWVALID]
&& getpos_hilitefunc) { && getpos_hilitefunc) {
if (!hilite_state) { if (!hilite_state) {
(*getpos_hilitefunc)(0); (*getpos_hilitefunc)(0);
@@ -795,7 +798,7 @@ const char *goal;
hilite_state = TRUE; hilite_state = TRUE;
} }
goto nxtc; goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]) { } else if (c == Cmd.spkeys[NHKF_GETPOS_AUTODESC]) {
iflags.autodescribe = !iflags.autodescribe; iflags.autodescribe = !iflags.autodescribe;
pline("Automatic description %sis %s.", pline("Automatic description %sis %s.",
flags.verbose ? "of features under cursor " : "", flags.verbose ? "of features under cursor " : "",
@@ -804,7 +807,7 @@ const char *goal;
show_goal_msg = TRUE; show_goal_msg = TRUE;
msg_given = TRUE; msg_given = TRUE;
goto nxtc; goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) { } else if (c == Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) {
static const char *const view_filters[NUM_GFILTER] = { static const char *const view_filters[NUM_GFILTER] = {
"Not limiting targets", "Not limiting targets",
"Limiting targets to those in sight", "Limiting targets to those in sight",
@@ -822,7 +825,7 @@ const char *goal;
pline("%s.", view_filters[iflags.getloc_filter]); pline("%s.", view_filters[iflags.getloc_filter]);
msg_given = TRUE; msg_given = TRUE;
goto nxtc; goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_MENU]) { } else if (c == Cmd.spkeys[NHKF_GETPOS_MENU]) {
iflags.getloc_usemenu = !iflags.getloc_usemenu; iflags.getloc_usemenu = !iflags.getloc_usemenu;
pline("%s a menu to show possible targets%s.", pline("%s a menu to show possible targets%s.",
iflags.getloc_usemenu ? "Using" : "Not using", iflags.getloc_usemenu ? "Using" : "Not using",
@@ -830,7 +833,7 @@ const char *goal;
? " for 'm|M', 'o|O', 'd|D', and 'x|X'" : ""); ? " for 'm|M', 'o|O', 'd|D', and 'x|X'" : "");
msg_given = TRUE; msg_given = TRUE;
goto nxtc; goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_SELF]) { } else if (c == Cmd.spkeys[NHKF_GETPOS_SELF]) {
/* reset 'm&M', 'o&O', &c; otherwise, there's no way for player /* reset 'm&M', 'o&O', &c; otherwise, there's no way for player
to achieve that except by manually cycling through all spots */ to achieve that except by manually cycling through all spots */
for (i = 0; i < NUM_GLOCS; i++) for (i = 0; i < NUM_GLOCS; i++)
@@ -838,7 +841,7 @@ const char *goal;
cx = u.ux; cx = u.ux;
cy = u.uy; cy = u.uy;
goto nxtc; goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]) { } else if (c == Cmd.spkeys[NHKF_GETPOS_MOVESKIP]) {
iflags.getloc_moveskip = !iflags.getloc_moveskip; iflags.getloc_moveskip = !iflags.getloc_moveskip;
pline("%skipping over similar terrain when fastmoving the cursor.", pline("%skipping over similar terrain when fastmoving the cursor.",
iflags.getloc_moveskip ? "S" : "Not s"); iflags.getloc_moveskip ? "S" : "Not s");
@@ -884,7 +887,7 @@ const char *goal;
|| glyph_to_cmap(k) == S_corr || glyph_to_cmap(k) == S_corr
|| glyph_to_cmap(k) == S_litcorr) || glyph_to_cmap(k) == S_litcorr)
continue; continue;
if (c == defsyms[sidx].sym || c == (int) g.showsyms[sidx]) if (c == defsyms[sidx].sym || c == (int) showsyms[sidx])
matching[sidx] = (char) ++k; matching[sidx] = (char) ++k;
} }
if (k) { if (k) {
@@ -905,7 +908,7 @@ const char *goal;
goto foundc; goto foundc;
/* next, try glyph that's remembered here /* next, try glyph that's remembered here
(might be trap or object) */ (might be trap or object) */
if (g.level.flags.hero_memory if (level.flags.hero_memory
/* !terrainmode: don't move to remembered /* !terrainmode: don't move to remembered
trap or object if not currently shown */ trap or object if not currently shown */
&& !iflags.terrainmode) { && !iflags.terrainmode) {
@@ -915,7 +918,7 @@ const char *goal;
goto foundc; goto foundc;
} }
/* last, try actual terrain here (shouldn't /* last, try actual terrain here (shouldn't
we be using g.lastseentyp[][] instead?) */ we be using lastseentyp[][] instead?) */
if (levl[tx][ty].seenv) { if (levl[tx][ty].seenv) {
k = back_to_glyph(tx, ty); k = back_to_glyph(tx, ty);
if (glyph_is_cmap(k) if (glyph_is_cmap(k)
@@ -943,8 +946,8 @@ const char *goal;
Strcpy(note, "aborted"); Strcpy(note, "aborted");
else /* hjkl */ else /* hjkl */
Sprintf(note, "use '%c', '%c', '%c', '%c' or '%s'", Sprintf(note, "use '%c', '%c', '%c', '%c' or '%s'",
g.Cmd.move_W, g.Cmd.move_S, g.Cmd.move_N, g.Cmd.move_E, Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]));
pline("Unknown direction: '%s' (%s).", visctrl((char) c), pline("Unknown direction: '%s' (%s).", visctrl((char) c),
note); note);
msg_given = TRUE; msg_given = TRUE;
@@ -1068,7 +1071,7 @@ const char *name;
int lth; int lth;
char buf[PL_PSIZ]; char buf[PL_PSIZ];
/* g.dogname & g.catname are PL_PSIZ arrays; object names have same limit */ /* dogname & catname are PL_PSIZ arrays; object names have same limit */
lth = (name && *name) ? ((int) strlen(name) + 1) : 0; lth = (name && *name) ? ((int) strlen(name) + 1) : 0;
if (lth > PL_PSIZ) { if (lth > PL_PSIZ) {
lth = PL_PSIZ; lth = PL_PSIZ;
@@ -1083,7 +1086,7 @@ const char *name;
/* check whether user-supplied name matches or nearly matches an unnameable /* check whether user-supplied name matches or nearly matches an unnameable
monster's name; if so, give an alternate reject message for do_mname() */ monster's name; if so, give an alternate reject message for do_mname() */
static boolean STATIC_OVL boolean
alreadynamed(mtmp, monnambuf, usrbuf) alreadynamed(mtmp, monnambuf, usrbuf)
struct monst *mtmp; struct monst *mtmp;
char *monnambuf, *usrbuf; char *monnambuf, *usrbuf;
@@ -1113,7 +1116,7 @@ char *monnambuf, *usrbuf;
} }
/* allow player to assign a name to some chosen monster */ /* allow player to assign a name to some chosen monster */
static void STATIC_OVL void
do_mname() do_mname()
{ {
char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ]; char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ];
@@ -1137,7 +1140,7 @@ do_mname()
mtmp = u.usteed; mtmp = u.usteed;
} else { } else {
pline("This %s creature is called %s and cannot be renamed.", pline("This %s creature is called %s and cannot be renamed.",
beautiful(), g.plname); beautiful(), plname);
return; return;
} }
} else } else
@@ -1192,12 +1195,14 @@ do_mname()
(void) christen_monst(mtmp, buf); (void) christen_monst(mtmp, buf);
} }
STATIC_VAR int via_naming = 0;
/* /*
* This routine used to change the address of 'obj' so be unsafe if not * This routine used to change the address of 'obj' so be unsafe if not
* used with extreme care. Applying a name to an object no longer * used with extreme care. Applying a name to an object no longer
* allocates a replacement object, so that old risk is gone. * allocates a replacement object, so that old risk is gone.
*/ */
static STATIC_OVL
void void
do_oname(obj) do_oname(obj)
register struct obj *obj; register struct obj *obj;
@@ -1269,9 +1274,9 @@ register struct obj *obj;
a valid artifact name */ a valid artifact name */
u.uconduct.literate++; u.uconduct.literate++;
} }
++g.via_naming; /* This ought to be an argument rather than a static... */ ++via_naming; /* This ought to be an argument rather than a static... */
obj = oname(obj, buf); obj = oname(obj, buf);
--g.via_naming; /* ...but oname() is used in a lot of places, so defer. */ --via_naming; /* ...but oname() is used in a lot of places, so defer. */
} }
struct obj * struct obj *
@@ -1311,7 +1316,7 @@ const char *name;
/* if obj is owned by a shop, increase your bill */ /* if obj is owned by a shop, increase your bill */
if (obj->unpaid) if (obj->unpaid)
alter_cost(obj, 0L); alter_cost(obj, 0L);
if (g.via_naming) { if (via_naming) {
/* violate illiteracy conduct since successfully wrote arti-name */ /* violate illiteracy conduct since successfully wrote arti-name */
u.uconduct.literate++; u.uconduct.literate++;
} }
@@ -1349,11 +1354,11 @@ docallcmd()
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win); start_menu(win);
any = cg.zeroany; any = zeroany;
any.a_char = 'm'; /* group accelerator 'C' */ any.a_char = 'm'; /* group accelerator 'C' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE,
"a monster", MENU_UNSELECTED); "a monster", MENU_UNSELECTED);
if (g.invent) { if (invent) {
/* we use y and n as accelerators so that we can accept user's /* we use y and n as accelerators so that we can accept user's
response keyed to old "name an individual object?" prompt */ response keyed to old "name an individual object?" prompt */
any.a_char = 'i'; /* group accelerator 'y' */ any.a_char = 'i'; /* group accelerator 'y' */
@@ -1427,7 +1432,7 @@ docallcmd()
} }
/* for use by safe_qbuf() */ /* for use by safe_qbuf() */
static char * STATIC_PTR char *
docall_xname(obj) docall_xname(obj)
struct obj *obj; struct obj *obj;
{ {
@@ -1507,7 +1512,7 @@ struct obj *obj;
} }
} }
static void STATIC_OVL void
namefloorobj() namefloorobj()
{ {
coord cc; coord cc;
@@ -1521,7 +1526,7 @@ namefloorobj()
been moved off the hero's '@' yet, but there's no way to adjust been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */ the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)", Sprintf(buf, "object on map (or '.' for one %s you)",
(u.uundetected && hides_under(g.youmonst.data)) ? "over" : "under"); (u.uundetected && hides_under(youmonst.data)) ? "over" : "under");
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0) if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return; return;
if (cc.x == u.ux && cc.y == u.uy) { if (cc.x == u.ux && cc.y == u.uy) {
@@ -1552,9 +1557,9 @@ namefloorobj()
char tmpbuf[BUFSZ]; char tmpbuf[BUFSZ];
/* straight role name */ /* straight role name */
unames[0] = ((Upolyd ? u.mfemale : flags.female) && g.urole.name.f) unames[0] = ((Upolyd ? u.mfemale : flags.female) && urole.name.f)
? g.urole.name.f ? urole.name.f
: g.urole.name.m; : urole.name.m;
/* random rank title for hero's role /* random rank title for hero's role
note: the 30 is hardcoded in xlev_to_rank, so should be note: the 30 is hardcoded in xlev_to_rank, so should be
@@ -1602,7 +1607,7 @@ static const char *const ghostnames[] = {
const char * const char *
rndghostname() rndghostname()
{ {
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) g.plname; return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) plname;
} }
/* /*
@@ -1652,7 +1657,7 @@ boolean called;
boolean name_at_start, has_adjectives; boolean name_at_start, has_adjectives;
char *bp; char *bp;
if (g.program_state.gameover) if (program_state.gameover)
suppress |= SUPPRESS_HALLUCINATION; suppress |= SUPPRESS_HALLUCINATION;
if (article == ARTICLE_YOUR && !mtmp->mtame) if (article == ARTICLE_YOUR && !mtmp->mtame)
article = ARTICLE_THE; article = ARTICLE_THE;
@@ -1660,7 +1665,7 @@ boolean called;
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION); do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE); do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
&& !g.program_state.gameover && mtmp != u.usteed && !program_state.gameover && mtmp != u.usteed
&& !(u.uswallow && mtmp == u.ustuck) && !(suppress & SUPPRESS_IT); && !(u.uswallow && mtmp == u.ustuck) && !(suppress & SUPPRESS_IT);
do_saddle = !(suppress & SUPPRESS_SADDLE); do_saddle = !(suppress & SUPPRESS_SADDLE);
do_name = !(suppress & SUPPRESS_NAME) || type_is_pname(mdat); do_name = !(suppress & SUPPRESS_NAME) || type_is_pname(mdat);
@@ -1974,7 +1979,7 @@ struct monst *mon, *other_mon;
} }
/* fake monsters used to be in a hard-coded array, now in a data file */ /* fake monsters used to be in a hard-coded array, now in a data file */
static char * STATIC_OVL char *
bogusmon(buf, code) bogusmon(buf, code)
char *buf, *code; char *buf, *code;
{ {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 steed.c $NHDT-Date: 1559670610 2019/06/04 17:50:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ /* NetHack 3.6 steed.c $NHDT-Date: 1573940541 2019/11/16 21:42:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */ /* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -742,6 +742,8 @@ place_monster(mon, x, y)
struct monst *mon; struct monst *mon;
int x, y; int x, y;
{ {
struct monst *othermon;
const char *monnm, *othnm;
char buf[QBUFSZ]; char buf[QBUFSZ];
buf[0] = '\0'; buf[0] = '\0';
@@ -749,8 +751,8 @@ int x, y;
vault guards (either living or dead) are parked at <0,0> */ vault guards (either living or dead) are parked at <0,0> */
if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) { if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) {
describe_level(buf); describe_level(buf);
impossible("trying to place monster at <%d,%d> mstate:%lx on %s", impossible("trying to place %s at <%d,%d> mstate:%lx on %s",
x, y, mon->mstate, buf); minimal_monnam(mon, TRUE), x, y, mon->mstate, buf);
x = y = 0; x = y = 0;
} }
if (mon == u.usteed if (mon == u.usteed
@@ -762,10 +764,12 @@ int x, y;
mon->mstate, buf); mon->mstate, buf);
return; return;
} }
if (g.level.monsters[x][y]) { if ((othermon = g.level.monsters[x][y]) != 0) {
describe_level(buf); describe_level(buf);
impossible("placing monster over another at <%d,%d>, mstates:%lx %lx on %s?", monnm = minimal_monnam(mon, FALSE);
x, y, g.level.monsters[x][y]->mstate, mon->mstate, buf); othnm = (mon != othermon) ? minimal_monnam(othermon, TRUE) : "itself";
impossible("placing %s over %s at <%d,%d>, mstates:%lx %lx on %s?",
monnm, othnm, x, y, othermon->mstate, mon->mstate, buf);
} }
mon->mx = x, mon->my = y; mon->mx = x, mon->my = y;
g.level.monsters[x][y] = mon; g.level.monsters[x][y] = mon;