Merge branch 'paxed-lua-merged3' into paxed-lua-v2-merged

This commit is contained in:
nhmall
2019-11-06 12:56:21 -05:00
252 changed files with 9504 additions and 6526 deletions

365
src/cmd.c
View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1560789049 2019/06/17 16:30:49 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.336 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1572141702 2019/10/27 02:01:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.347 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -27,7 +27,7 @@
#define unmeta(c) (0x7f & (c))
#ifdef ALTMETA
STATIC_VAR boolean alt_esc = FALSE;
static boolean alt_esc = FALSE;
#endif
extern const char *hu_stat[]; /* hunger status from eat.c */
@@ -129,80 +129,80 @@ extern int NDECL(doorganize); /**/
static int NDECL((*timed_occ_fn));
STATIC_PTR int NDECL(dosuspend_core);
STATIC_PTR int NDECL(dosh_core);
STATIC_PTR int NDECL(doherecmdmenu);
STATIC_PTR int NDECL(dotherecmdmenu);
STATIC_PTR int NDECL(doprev_message);
STATIC_PTR int NDECL(timed_occupation);
STATIC_PTR int NDECL(doextcmd);
STATIC_PTR int NDECL(dotravel);
STATIC_PTR int NDECL(doterrain);
STATIC_PTR int NDECL(wiz_wish);
STATIC_PTR int NDECL(wiz_identify);
STATIC_PTR int NDECL(wiz_intrinsic);
STATIC_PTR int NDECL(wiz_map);
STATIC_PTR int NDECL(wiz_makemap);
STATIC_PTR int NDECL(wiz_genesis);
STATIC_PTR int NDECL(wiz_where);
STATIC_PTR int NDECL(wiz_detect);
STATIC_PTR int NDECL(wiz_panic);
STATIC_PTR int NDECL(wiz_polyself);
static int NDECL(dosuspend_core);
static int NDECL(dosh_core);
static int NDECL(doherecmdmenu);
static int NDECL(dotherecmdmenu);
static int NDECL(doprev_message);
static int NDECL(timed_occupation);
static int NDECL(doextcmd);
static int NDECL(dotravel);
static int NDECL(doterrain);
static int NDECL(wiz_wish);
static int NDECL(wiz_identify);
static int NDECL(wiz_intrinsic);
static int NDECL(wiz_map);
static int NDECL(wiz_makemap);
static int NDECL(wiz_genesis);
static int NDECL(wiz_where);
static int NDECL(wiz_detect);
static int NDECL(wiz_panic);
static int NDECL(wiz_polyself);
STATIC_PTR int NDECL(wiz_load_lua);
STATIC_PTR int NDECL(wiz_level_tele);
STATIC_PTR int NDECL(wiz_level_change);
STATIC_PTR int NDECL(wiz_show_seenv);
STATIC_PTR int NDECL(wiz_show_vision);
STATIC_PTR int NDECL(wiz_smell);
STATIC_PTR int NDECL(wiz_intrinsic);
STATIC_PTR int NDECL(wiz_show_wmodes);
STATIC_DCL void NDECL(wiz_map_levltyp);
STATIC_DCL void NDECL(wiz_levltyp_legend);
static int NDECL(wiz_level_tele);
static int NDECL(wiz_level_change);
static int NDECL(wiz_show_seenv);
static int NDECL(wiz_show_vision);
static int NDECL(wiz_smell);
static int NDECL(wiz_intrinsic);
static int NDECL(wiz_show_wmodes);
static void NDECL(wiz_map_levltyp);
static void NDECL(wiz_levltyp_legend);
#if defined(__BORLANDC__) && !defined(_WIN32)
extern void FDECL(show_borlandc_stats, (winid));
#endif
#ifdef DEBUG_MIGRATING_MONS
STATIC_PTR int NDECL(wiz_migrate_mons);
static int NDECL(wiz_migrate_mons);
#endif
STATIC_DCL int FDECL(size_monst, (struct monst *, BOOLEAN_P));
STATIC_DCL int FDECL(size_obj, (struct obj *));
STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *,
static int FDECL(size_monst, (struct monst *, BOOLEAN_P));
static int FDECL(size_obj, (struct obj *));
static void FDECL(count_obj, (struct obj *, long *, long *,
BOOLEAN_P, BOOLEAN_P));
STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *,
static void FDECL(obj_chain, (winid, const char *, struct obj *,
BOOLEAN_P, long *, long *));
STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *,
static void FDECL(mon_invent_chain, (winid, const char *, struct monst *,
long *, long *));
STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *,
static void FDECL(mon_chain, (winid, const char *, struct monst *,
BOOLEAN_P, long *, long *));
STATIC_DCL void FDECL(contained_stats, (winid, const char *, long *, long *));
STATIC_DCL void FDECL(misc_stats, (winid, long *, long *));
STATIC_PTR int NDECL(wiz_show_stats);
STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*))));
STATIC_PTR int NDECL(wiz_rumor_check);
STATIC_PTR int NDECL(doattributes);
static void FDECL(contained_stats, (winid, const char *, long *, long *));
static void FDECL(misc_stats, (winid, long *, long *));
static int NDECL(wiz_show_stats);
static boolean FDECL(accept_menu_prefix, (int NDECL((*))));
static int NDECL(wiz_rumor_check);
static int NDECL(doattributes);
STATIC_DCL void FDECL(enlght_out, (const char *));
STATIC_DCL void FDECL(enlght_line, (const char *, const char *, const char *,
static void FDECL(enlght_out, (const char *));
static void FDECL(enlght_line, (const char *, const char *, const char *,
const char *));
STATIC_DCL char *FDECL(enlght_combatinc, (const char *, int, int, char *));
STATIC_DCL void FDECL(enlght_halfdmg, (int, int));
STATIC_DCL boolean NDECL(walking_on_water);
STATIC_DCL boolean FDECL(cause_known, (int));
STATIC_DCL char *FDECL(attrval, (int, int, char *));
STATIC_DCL void FDECL(background_enlightenment, (int, int));
STATIC_DCL void FDECL(basics_enlightenment, (int, int));
STATIC_DCL void FDECL(characteristics_enlightenment, (int, int));
STATIC_DCL void FDECL(one_characteristic, (int, int, int));
STATIC_DCL void FDECL(status_enlightenment, (int, int));
STATIC_DCL void FDECL(attributes_enlightenment, (int, int));
static char *FDECL(enlght_combatinc, (const char *, int, int, char *));
static void FDECL(enlght_halfdmg, (int, int));
static boolean NDECL(walking_on_water);
static boolean FDECL(cause_known, (int));
static char *FDECL(attrval, (int, int, char *));
static void FDECL(background_enlightenment, (int, int));
static void FDECL(basics_enlightenment, (int, int));
static void FDECL(characteristics_enlightenment, (int, int));
static void FDECL(one_characteristic, (int, int, int));
static void FDECL(status_enlightenment, (int, int));
static void FDECL(attributes_enlightenment, (int, int));
STATIC_DCL void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)),
static void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)),
const char *));
STATIC_DCL char FDECL(here_cmd_menu, (BOOLEAN_P));
STATIC_DCL char FDECL(there_cmd_menu, (BOOLEAN_P, int, int));
STATIC_DCL char *NDECL(parse);
STATIC_DCL void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P));
STATIC_DCL boolean FDECL(help_dir, (CHAR_P, int, const char *));
static char FDECL(here_cmd_menu, (BOOLEAN_P));
static char FDECL(there_cmd_menu, (BOOLEAN_P, int, int));
static char *NDECL(parse);
static void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P));
static boolean FDECL(help_dir, (CHAR_P, int, const char *));
static const char *readchar_queue = "";
/* for rejecting attempts to use wizard mode commands */
@@ -210,14 +210,14 @@ static const char unavailcmd[] = "Unavailable command '%s'.";
/* for rejecting #if !SHELL, !SUSPEND */
static const char cmdnotavail[] = "'%s' command not available.";
STATIC_PTR int
static int
doprev_message(VOID_ARGS)
{
return nh_doprev_message();
}
/* Count down by decrementing multi */
STATIC_PTR int
static int
timed_occupation(VOID_ARGS)
{
(*timed_occ_fn)();
@@ -267,9 +267,9 @@ int xtime;
return;
}
STATIC_DCL char NDECL(popch);
static char NDECL(popch);
STATIC_OVL char
static char
popch()
{
/* If occupied, return '\0', letting tgetch know a character should
@@ -326,7 +326,7 @@ char ch;
}
/* here after # - now read a full-word command */
STATIC_PTR int
static int
doextcmd(VOID_ARGS)
{
int idx, retval;
@@ -751,7 +751,7 @@ enter_explore_mode(VOID_ARGS)
}
/* ^W command - wish for something */
STATIC_PTR int
static int
wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */
{
if (wizard) {
@@ -767,7 +767,7 @@ wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */
}
/* ^I command - reveal and optionally identify hero's inventory */
STATIC_PTR int
static int
wiz_identify(VOID_ARGS)
{
if (wizard) {
@@ -852,6 +852,7 @@ boolean pre, wiztower;
u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */
| (wiztower ? 2 : 0));
losedogs();
kill_genocided_monsters();
/* u_on_rndspot() might pick a spot that has a monster, or losedogs()
might pick the hero's spot (only if there isn't already a monster
there), so we might have to move hero or the co-located monster */
@@ -891,7 +892,7 @@ wiz_makemap(VOID_ARGS)
}
/* ^F command - reveal the level map and any traps on it */
STATIC_PTR int
static int
wiz_map(VOID_ARGS)
{
if (wizard) {
@@ -912,7 +913,7 @@ wiz_map(VOID_ARGS)
}
/* ^G command - generate monster(s); a count prefix will be honored */
STATIC_PTR int
static int
wiz_genesis(VOID_ARGS)
{
if (wizard)
@@ -923,7 +924,7 @@ wiz_genesis(VOID_ARGS)
}
/* ^O command - display dungeon layout */
STATIC_PTR int
static int
wiz_where(VOID_ARGS)
{
if (wizard)
@@ -934,7 +935,7 @@ wiz_where(VOID_ARGS)
}
/* ^E command - detect unseen (secret doors, traps, hidden monsters) */
STATIC_PTR int
static int
wiz_detect(VOID_ARGS)
{
if (wizard)
@@ -1009,7 +1010,7 @@ wiz_load_splua(VOID_ARGS)
}
/* ^V command - level teleport */
STATIC_PTR int
static int
wiz_level_tele(VOID_ARGS)
{
if (wizard)
@@ -1020,7 +1021,7 @@ wiz_level_tele(VOID_ARGS)
}
/* #levelchange command - adjust hero's experience level */
STATIC_PTR int
static int
wiz_level_change(VOID_ARGS)
{
char buf[BUFSZ] = DUMMY;
@@ -1064,7 +1065,7 @@ wiz_level_change(VOID_ARGS)
}
/* #panic command - test program's panic handling */
STATIC_PTR int
static int
wiz_panic(VOID_ARGS)
{
if (iflags.debug_fuzzer) {
@@ -1072,13 +1073,14 @@ wiz_panic(VOID_ARGS)
u.uen = u.uenmax = 1000;
return 0;
}
if (yn("Do you want to call panic() and end your game?") == 'y')
if (paranoid_query(ParanoidQuit,
"Do you want to call panic() and end your game?"))
panic("Crash test.");
return 0;
}
/* #polyself command - change hero's form */
STATIC_PTR int
static int
wiz_polyself(VOID_ARGS)
{
polyself(1);
@@ -1086,7 +1088,7 @@ wiz_polyself(VOID_ARGS)
}
/* #seenv command */
STATIC_PTR int
static int
wiz_show_seenv(VOID_ARGS)
{
winid win;
@@ -1130,7 +1132,7 @@ wiz_show_seenv(VOID_ARGS)
}
/* #vision command */
STATIC_PTR int
static int
wiz_show_vision(VOID_ARGS)
{
winid win;
@@ -1168,7 +1170,7 @@ wiz_show_vision(VOID_ARGS)
}
/* #wmode command */
STATIC_PTR int
static int
wiz_show_wmodes(VOID_ARGS)
{
winid win;
@@ -1204,7 +1206,7 @@ wiz_show_wmodes(VOID_ARGS)
}
/* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */
STATIC_OVL void
static void
wiz_map_levltyp(VOID_ARGS)
{
winid win;
@@ -1367,7 +1369,7 @@ static const char *levltyp[] = {
};
/* explanation of base-36 output from wiz_map_levltyp() */
STATIC_OVL void
static void
wiz_levltyp_legend(VOID_ARGS)
{
winid win;
@@ -1407,7 +1409,7 @@ wiz_levltyp_legend(VOID_ARGS)
}
/* #wizsmell command - test usmellmon(). */
STATIC_PTR int
static int
wiz_smell(VOID_ARGS)
{
int ans = 0;
@@ -1447,7 +1449,7 @@ wiz_smell(VOID_ARGS)
}
/* #wizinstrinsic command to set some intrinsics for testing */
STATIC_PTR int
static int
wiz_intrinsic(VOID_ARGS)
{
if (wizard) {
@@ -1575,7 +1577,7 @@ wiz_intrinsic(VOID_ARGS)
}
/* #wizrumorcheck command - verify each rumor access */
STATIC_PTR int
static int
wiz_rumor_check(VOID_ARGS)
{
rumor_check();
@@ -1583,7 +1585,7 @@ wiz_rumor_check(VOID_ARGS)
}
/* #terrain command -- show known map, inspired by crawl's '|' command */
STATIC_PTR int
static int
doterrain(VOID_ARGS)
{
winid men;
@@ -1756,7 +1758,7 @@ char *outbuf;
}
/* report half physical or half spell damage */
STATIC_OVL void
static void
enlght_halfdmg(category, final)
int category;
int final;
@@ -1781,7 +1783,7 @@ int final;
}
/* is hero actively using water walking capability on water (or lava)? */
STATIC_OVL boolean
static boolean
walking_on_water()
{
if (u.uinwater || Levitation || Flying)
@@ -1793,7 +1795,7 @@ walking_on_water()
/* check whether hero is wearing something that player definitely knows
confers the target property; item must have been seen and its type
discovered but it doesn't necessarily have to be fully identified */
STATIC_OVL boolean
static boolean
cause_known(propindx)
int propindx; /* index of a property which can be conveyed by worn item */
{
@@ -1813,7 +1815,7 @@ int propindx; /* index of a property which can be conveyed by worn item */
}
/* format a characteristic value, accommodating Strength's strangeness */
STATIC_OVL char *
static char *
attrval(attrindx, attrvalue, resultbuf)
int attrindx, attrvalue;
char resultbuf[]; /* should be at least [7] to hold "18/100\0" */
@@ -1888,7 +1890,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
/*ARGSUSED*/
/* display role, race, alignment and such to en_win */
STATIC_OVL void
static void
background_enlightenment(unused_mode, final)
int unused_mode UNUSED;
int final;
@@ -2054,6 +2056,50 @@ int final;
/* same phrasing for current and final: "entered" is unconditional */
enlght_line(You_, "entered ", buf, "");
}
/* for gameover, these have been obtained in really_done() so that they
won't vary if user leaves a disclosure prompt or --More-- unanswered
long enough for the dynamic value to change between then and now */
if (final ? iflags.at_midnight : midnight()) {
enl_msg("It ", "is ", "was ", "the midnight hour", "");
} else if (final ? iflags.at_night : night()) {
enl_msg("It ", "is ", "was ", "nighttime", "");
}
/* other environmental factors */
if (flags.moonphase == FULL_MOON || flags.moonphase == NEW_MOON) {
/* [This had "tonight" but has been changed to "in effect".
There is a similar issue to Friday the 13th--it's the value
at the start of the current session but that session might
have dragged on for an arbitrary amount of time. We want to
report the values that currently affect play--or affected
play when game ended--rather than actual outside situation.] */
Sprintf(buf, "a %s moon in effect%s",
(flags.moonphase == FULL_MOON) ? "full"
: (flags.moonphase == NEW_MOON) ? "new"
/* showing these would probably just lead to confusion
since they have no effect on game play... */
: (flags.moonphase < FULL_MOON) ? "first quarter"
: "last quarter",
/* we don't have access to 'how' here--aside from survived
vs died--so settle for general platitude */
final ? " when your adventure ended" : "");
enl_msg("There ", "is ", "was ", buf, "");
}
if (flags.friday13) {
/* let player know that friday13 penalty is/was in effect;
we don't say "it is/was Friday the 13th" because that was at
the start of the session and it might be past midnight (or
days later if the game has been paused without save/restore),
so phrase this similar to the start up message */
Sprintf(buf, " Bad things %s on Friday the 13th.",
!final ? "can happen"
: (final == ENL_GAMEOVERALIVE) ? "could have happened"
/* there's no may to tell whether -1 Luck made a
difference but hero has died... */
: "happened");
enlght_out(buf);
}
if (!Upolyd) {
int ulvl = (int) u.ulevel;
/* [flags.showexp currently does not matter; should it?] */
@@ -2094,7 +2140,7 @@ int final;
/* hit points, energy points, armor class -- essential information which
doesn't fit very well in other categories */
/*ARGSUSED*/
STATIC_OVL void
static void
basics_enlightenment(mode, final)
int mode UNUSED;
int final;
@@ -2167,8 +2213,7 @@ int final;
*ocl ? "'" : "", *ocl ? ocl : "all types", *ocl ? "'" : "");
if (flags.pickup_thrown && *ocl) /* *ocl: don't show if 'all types' */
Strcat(buf, " plus thrown");
if (iflags.autopickup_exceptions[AP_GRAB]
|| iflags.autopickup_exceptions[AP_LEAVE])
if (g.apelist)
Strcat(buf, ", with exceptions");
} else
Strcpy(buf, "off");
@@ -2176,7 +2221,7 @@ int final;
}
/* characteristics: expanded version of bottom line strength, dexterity, &c */
STATIC_OVL void
static void
characteristics_enlightenment(mode, final)
int mode;
int final;
@@ -2197,7 +2242,7 @@ int final;
}
/* display one attribute value for characteristics_enlightenment() */
STATIC_OVL void
static void
one_characteristic(mode, final, attrindx)
int mode, final, attrindx;
{
@@ -2292,7 +2337,7 @@ int mode, final, attrindx;
}
/* status: selected obvious capabilities, assorted troubles */
STATIC_OVL void
static void
status_enlightenment(mode, final)
int mode;
int final;
@@ -2361,26 +2406,50 @@ int final;
youhiding(TRUE, final);
/* internal troubles, mostly in the order that prayer ranks them */
if (Stoned)
you_are("turning to stone", "");
if (Slimed)
you_are("turning into slime", "");
if (Stoned) {
if (final && (Stoned & I_SPECIAL))
enlght_out(" You turned into stone.");
else
you_are("turning to stone", "");
}
if (Slimed) {
if (final && (Slimed & I_SPECIAL))
enlght_out(" You turned into slime.");
else
you_are("turning into slime", "");
}
if (Strangled) {
if (u.uburied) {
you_are("buried", "");
} else {
Strcpy(buf, "being strangled");
if (wizard)
Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
you_are(buf, from_what(STRANGLED));
if (final && (Strangled & I_SPECIAL)) {
enlght_out(" You died from strangulation.");
} else {
Strcpy(buf, "being strangled");
if (wizard)
Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
you_are(buf, from_what(STRANGLED));
}
}
}
if (Sick) {
/* prayer lumps these together; botl puts Ill before FoodPois */
if (u.usick_type & SICK_NONVOMITABLE)
you_are("terminally sick from illness", "");
if (u.usick_type & SICK_VOMITABLE)
you_are("terminally sick from food poisoning", "");
/* the two types of sickness are lumped together; hero can be
afflicted by both but there is only one timeout; botl status
puts TermIll before FoodPois and death due to timeout reports
terminal illness if both are in effect, so do the same here */
if (final && (Sick & I_SPECIAL)) {
Sprintf(buf, " %sdied from %s.", You_, /* has trailing space */
(u.usick_type & SICK_NONVOMITABLE)
? "terminal illness" : "food poisoning");
enlght_out(buf);
} else {
/* unlike death due to sickness, report the two cases separately
because it is possible to cure one without curing the other */
if (u.usick_type & SICK_NONVOMITABLE)
you_are("terminally sick from illness", "");
if (u.usick_type & SICK_VOMITABLE)
you_are("terminally sick from food poisoning", "");
}
}
if (Vomiting)
you_are("nauseated", "");
@@ -2604,7 +2673,7 @@ int final;
}
/* attributes: intrinsics and the like, other non-obvious capabilities */
void
static void
attributes_enlightenment(unused_mode, final)
int unused_mode UNUSED;
int final;
@@ -3049,14 +3118,14 @@ int final;
}
#if 0 /* no longer used */
STATIC_DCL boolean NDECL(minimal_enlightenment);
static boolean NDECL(minimal_enlightenment);
/*
* Courtesy function for non-debug, non-explorer mode players
* to help refresh them about who/what they are.
* Returns FALSE if menu cancelled (dismissed with ESC), TRUE otherwise.
*/
STATIC_OVL boolean
static boolean
minimal_enlightenment()
{
winid tmpwin;
@@ -3162,7 +3231,7 @@ minimal_enlightenment()
#endif /*0*/
/* ^X command */
STATIC_PTR int
static int
doattributes(VOID_ARGS)
{
int mode = BASICENLIGHTENMENT;
@@ -3863,7 +3932,7 @@ static const char template[] = "%-27s %4ld %6ld";
static const char stats_hdr[] = " count bytes";
static const char stats_sep[] = "--------------------------- ----- -------";
STATIC_OVL int
static int
size_obj(otmp)
struct obj *otmp;
{
@@ -3885,7 +3954,7 @@ struct obj *otmp;
return sz;
}
STATIC_OVL void
static void
count_obj(chain, total_count, total_size, top, recurse)
struct obj *chain;
long *total_count;
@@ -3908,7 +3977,7 @@ boolean recurse;
*total_size += size;
}
STATIC_OVL void
static void
obj_chain(win, src, chain, force, total_count, total_size)
winid win;
const char *src;
@@ -3930,7 +3999,7 @@ long *total_size;
}
}
STATIC_OVL void
static void
mon_invent_chain(win, src, chain, total_count, total_size)
winid win;
const char *src;
@@ -3953,7 +4022,7 @@ long *total_size;
}
}
STATIC_OVL void
static void
contained_stats(win, src, total_count, total_size)
winid win;
const char *src;
@@ -3983,7 +4052,7 @@ long *total_size;
}
}
STATIC_OVL int
static int
size_monst(mtmp, incl_wsegs)
struct monst *mtmp;
boolean incl_wsegs;
@@ -4012,7 +4081,7 @@ boolean incl_wsegs;
return sz;
}
STATIC_OVL void
static void
mon_chain(win, src, chain, force, total_count, total_size)
winid win;
const char *src;
@@ -4040,7 +4109,7 @@ long *total_size;
}
}
STATIC_OVL void
static void
misc_stats(win, total_count, total_size)
winid win;
long *total_count;
@@ -4595,7 +4664,7 @@ boolean initial;
}
/* non-movement commands which accept 'm' prefix to request menu operation */
STATIC_OVL boolean
static boolean
accept_menu_prefix(cmd_func)
int NDECL((*cmd_func));
{
@@ -5101,7 +5170,7 @@ retry:
return 1;
}
STATIC_OVL void
static void
show_direction_keys(win, centerchar, nodiag)
winid win; /* should specify a window which is using a fixed-width font... */
char centerchar; /* '.' or '@' or ' ' */
@@ -5140,7 +5209,7 @@ boolean nodiag;
/* explain choices if player has asked for getdir() help or has given
an invalid direction after a prefix key ('F', 'g', 'm', &c), which
might be bogus but could be up, down, or self when not applicable */
STATIC_OVL boolean
static boolean
help_dir(sym, spkey, msg)
char sym;
int spkey; /* NHKF_ code for prefix key, if one was used, or for ESC */
@@ -5322,7 +5391,7 @@ register int x, y;
}
/* #herecmdmenu command */
STATIC_PTR int
static int
doherecmdmenu(VOID_ARGS)
{
char ch = here_cmd_menu(TRUE);
@@ -5331,7 +5400,7 @@ doherecmdmenu(VOID_ARGS)
}
/* #therecmdmenu command, a way to test there_cmd_menu without mouse */
STATIC_PTR int
static int
dotherecmdmenu(VOID_ARGS)
{
char ch;
@@ -5347,7 +5416,7 @@ dotherecmdmenu(VOID_ARGS)
return ch ? 1 : 0;
}
STATIC_OVL void
static void
add_herecmd_menuitem(win, func, text)
winid win;
int NDECL((*func));
@@ -5363,7 +5432,7 @@ const char *text;
}
}
STATIC_OVL char
static char
there_cmd_menu(doit, x, y)
boolean doit;
int x, y;
@@ -5466,7 +5535,7 @@ int x, y;
return ch;
}
STATIC_OVL char
static char
here_cmd_menu(doit)
boolean doit;
{
@@ -5761,7 +5830,7 @@ boolean historical; /* whether to include in message history: True => yes */
}
STATIC_OVL char *
static char *
parse()
{
#ifdef LINT /* static char in_line[COLNO]; */
@@ -5880,7 +5949,7 @@ end_of_input()
#ifdef NOSAVEONHANGUP
#ifdef INSURANCE
if (flags.ins_chkpt && g.program_state.something_worth_saving)
program_statue.preserve_locks = 1; /* keep files for recovery */
program_state.preserve_locks = 1; /* keep files for recovery */
#endif
g.program_state.something_worth_saving = 0; /* don't save */
#endif
@@ -5950,7 +6019,7 @@ readchar()
}
/* '_' command, #travel, via keyboard rather than mouse click */
STATIC_PTR int
static int
dotravel(VOID_ARGS)
{
static char cmd[2];
@@ -6029,8 +6098,8 @@ char def;
res = (*windowprocs.win_yn_function)(query, resp, def);
#ifdef DUMPLOG
if (idx == g.saved_pline_index) {
/* when idx is still the same as saved_pline_index, the interface
didn't put the prompt into saved_plines[]; we put a simplified
/* when idx is still the same as g.saved_pline_index, the interface
didn't put the prompt into g.saved_plines[]; we put a simplified
version in there now (without response choices or default) */
Sprintf(dumplog_buf, "%s ", query);
(void) key2txt((uchar) res, eos(dumplog_buf));
@@ -6052,19 +6121,27 @@ const char *prompt;
to give the go-ahead for this query; default is "no" unless the
ParanoidConfirm flag is set in which case there's no default */
if (be_paranoid) {
char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY;
const char *promptprefix = "", *responsetype = ParanoidConfirm
? "(yes|no)"
: "(yes) [no]";
int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
char pbuf[BUFSZ], qbuf[QBUFSZ], ans[BUFSZ];
const char *promptprefix = "",
*responsetype = ParanoidConfirm ? "(yes|no)" : "(yes) [no]";
int k, trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
copynchars(pbuf, prompt, BUFSZ - 1);
/* in addition to being paranoid about this particular
query, we might be even more paranoid about all paranoia
responses (ie, ParanoidConfirm is set) in which case we
require "no" to reject in addition to "yes" to confirm
(except we won't loop if response is ESC; it means no) */
do {
Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype);
/* make sure we won't overflow a QBUFSZ sized buffer */
k = (int) (strlen(promptprefix) + 1 + strlen(responsetype));
if ((int) strlen(pbuf) + k > QBUFSZ - 1) {
/* chop off some at the end */
Strcpy(pbuf + (QBUFSZ - 1) - k - 4, "...?"); /* -4: "...?" */
}
Sprintf(qbuf, "%s%s %s", promptprefix, pbuf, responsetype);
*ans = '\0';
getlin(qbuf, ans);
(void) mungspaces(ans);
confirmed_ok = !strcmpi(ans, "yes");
@@ -6079,7 +6156,7 @@ const char *prompt;
}
/* ^Z command, #suspend */
STATIC_PTR int
static int
dosuspend_core(VOID_ARGS)
{
#ifdef SUSPEND
@@ -6094,7 +6171,7 @@ dosuspend_core(VOID_ARGS)
}
/* '!' command, #shell */
STATIC_PTR int
static int
dosh_core(VOID_ARGS)
{
#ifdef SHELL