fix #U1206 - Quest artifact in WIZKIT file aborts program
Fix the wizard mode crash From a bug report. Move the WIZKIT
message suppression to a lower level instead of trying to guard against
present and future pline() calls in the wishing code. The way that was
being handling wasn't suitable for dealing with quest feedback.
This also includes a couple of additional wishing synonyms.
This commit is contained in:
@@ -66,6 +66,7 @@ various helmet messages changed to distinguish between "helm" and "hat"
|
|||||||
helmets don't protect against cockatrice eggs thrown straight up
|
helmets don't protect against cockatrice eggs thrown straight up
|
||||||
breaking container contents in a shop didn't always charge for them
|
breaking container contents in a shop didn't always charge for them
|
||||||
some types of shop theft of a stack of items only charged for a single one
|
some types of shop theft of a stack of items only charged for a single one
|
||||||
|
wizard mode: WIZKIT wish for own quest artifact triggered crash at startup
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
+4
-1
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)decl.h 3.4 2001/12/10 */
|
/* SCCS Id: @(#)decl.h 3.4 2004/11/22 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -158,6 +158,9 @@ E NEARDATA struct sinfo {
|
|||||||
#ifdef PANICLOG
|
#ifdef PANICLOG
|
||||||
int in_paniclog;
|
int in_paniclog;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WIZARD
|
||||||
|
int wizkit_wishing;
|
||||||
|
#endif
|
||||||
} program_state;
|
} program_state;
|
||||||
|
|
||||||
E boolean restoring;
|
E boolean restoring;
|
||||||
|
|||||||
+1
-1
@@ -1435,7 +1435,7 @@ E char *FDECL(Ysimple_name2, (struct obj *));
|
|||||||
E char *FDECL(bare_artifactname, (struct obj *));
|
E char *FDECL(bare_artifactname, (struct obj *));
|
||||||
E char *FDECL(makeplural, (const char *));
|
E char *FDECL(makeplural, (const char *));
|
||||||
E char *FDECL(makesingular, (const char *));
|
E char *FDECL(makesingular, (const char *));
|
||||||
E struct obj *FDECL(readobjnam, (char *,struct obj *,BOOLEAN_P));
|
E struct obj *FDECL(readobjnam, (char *,struct obj *));
|
||||||
E int FDECL(rnd_class, (int,int));
|
E int FDECL(rnd_class, (int,int));
|
||||||
E const char *FDECL(cloak_simple_name, (struct obj *));
|
E const char *FDECL(cloak_simple_name, (struct obj *));
|
||||||
E const char *FDECL(helm_simple_name, (struct obj *));
|
E const char *FDECL(helm_simple_name, (struct obj *));
|
||||||
|
|||||||
+4
-2
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)files.c 3.4 2003/11/14 */
|
/* SCCS Id: @(#)files.c 3.4 2004/11/22 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -2149,6 +2149,7 @@ read_wizkit()
|
|||||||
|
|
||||||
if (!wizard || !(fp = fopen_wizkit_file())) return;
|
if (!wizard || !(fp = fopen_wizkit_file())) return;
|
||||||
|
|
||||||
|
program_state.wizkit_wishing = 1;
|
||||||
while (fgets(buf, (int)(sizeof buf), fp)) {
|
while (fgets(buf, (int)(sizeof buf), fp)) {
|
||||||
ep = index(buf, '\n');
|
ep = index(buf, '\n');
|
||||||
if (skip) { /* in case previous line was too long */
|
if (skip) { /* in case previous line was too long */
|
||||||
@@ -2158,7 +2159,7 @@ read_wizkit()
|
|||||||
else *ep = '\0'; /* remove newline */
|
else *ep = '\0'; /* remove newline */
|
||||||
|
|
||||||
if (buf[0]) {
|
if (buf[0]) {
|
||||||
otmp = readobjnam(buf, (struct obj *)0, FALSE);
|
otmp = readobjnam(buf, (struct obj *)0);
|
||||||
if (otmp) {
|
if (otmp) {
|
||||||
if (otmp != &zeroobj)
|
if (otmp != &zeroobj)
|
||||||
otmp = addinv(otmp);
|
otmp = addinv(otmp);
|
||||||
@@ -2170,6 +2171,7 @@ read_wizkit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
program_state.wizkit_wishing = 0;
|
||||||
if (bad_items)
|
if (bad_items)
|
||||||
wait_synch();
|
wait_synch();
|
||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
|
|||||||
+19
-13
@@ -1523,6 +1523,7 @@ STATIC_OVL NEARDATA const struct o_range o_ranges[] = {
|
|||||||
{ "candle", TOOL_CLASS, TALLOW_CANDLE, WAX_CANDLE },
|
{ "candle", TOOL_CLASS, TALLOW_CANDLE, WAX_CANDLE },
|
||||||
{ "horn", TOOL_CLASS, TOOLED_HORN, HORN_OF_PLENTY },
|
{ "horn", TOOL_CLASS, TOOLED_HORN, HORN_OF_PLENTY },
|
||||||
{ "shield", ARMOR_CLASS, SMALL_SHIELD, SHIELD_OF_REFLECTION },
|
{ "shield", ARMOR_CLASS, SMALL_SHIELD, SHIELD_OF_REFLECTION },
|
||||||
|
{ "hat", ARMOR_CLASS, FEDORA, DUNCE_CAP },
|
||||||
{ "helm", ARMOR_CLASS, ELVEN_LEATHER_HELM, HELM_OF_TELEPATHY },
|
{ "helm", ARMOR_CLASS, ELVEN_LEATHER_HELM, HELM_OF_TELEPATHY },
|
||||||
{ "gloves", ARMOR_CLASS, LEATHER_GLOVES, GAUNTLETS_OF_DEXTERITY },
|
{ "gloves", ARMOR_CLASS, LEATHER_GLOVES, GAUNTLETS_OF_DEXTERITY },
|
||||||
{ "gauntlets", ARMOR_CLASS, LEATHER_GLOVES, GAUNTLETS_OF_DEXTERITY },
|
{ "gauntlets", ARMOR_CLASS, LEATHER_GLOVES, GAUNTLETS_OF_DEXTERITY },
|
||||||
@@ -1749,6 +1750,7 @@ struct alt_spellings {
|
|||||||
{ "lantern", BRASS_LANTERN },
|
{ "lantern", BRASS_LANTERN },
|
||||||
{ "mattock", DWARVISH_MATTOCK },
|
{ "mattock", DWARVISH_MATTOCK },
|
||||||
{ "amulet of poison resistance", AMULET_VERSUS_POISON },
|
{ "amulet of poison resistance", AMULET_VERSUS_POISON },
|
||||||
|
{ "potion of sleep", POT_SLEEPING },
|
||||||
{ "stone", ROCK },
|
{ "stone", ROCK },
|
||||||
#ifdef TOURIST
|
#ifdef TOURIST
|
||||||
{ "camera", EXPENSIVE_CAMERA },
|
{ "camera", EXPENSIVE_CAMERA },
|
||||||
@@ -1758,6 +1760,9 @@ struct alt_spellings {
|
|||||||
{ "can opener", TIN_OPENER },
|
{ "can opener", TIN_OPENER },
|
||||||
{ "kelp", KELP_FROND },
|
{ "kelp", KELP_FROND },
|
||||||
{ "eucalyptus", EUCALYPTUS_LEAF },
|
{ "eucalyptus", EUCALYPTUS_LEAF },
|
||||||
|
{ "hook", GRAPPLING_HOOK },
|
||||||
|
{ "grappling iron", GRAPPLING_HOOK },
|
||||||
|
{ "grapnel", GRAPPLING_HOOK },
|
||||||
{ "grapple", GRAPPLING_HOOK },
|
{ "grapple", GRAPPLING_HOOK },
|
||||||
{ (const char *)0, 0 },
|
{ (const char *)0, 0 },
|
||||||
};
|
};
|
||||||
@@ -1768,13 +1773,11 @@ struct alt_spellings {
|
|||||||
* if asking explicitly for "nothing" (or "nil") return no_wish;
|
* if asking explicitly for "nothing" (or "nil") return no_wish;
|
||||||
* if not an object return &zeroobj; if an error (no matching object),
|
* if not an object return &zeroobj; if an error (no matching object),
|
||||||
* return null.
|
* return null.
|
||||||
* If from_user is false, we're reading from the wizkit, nothing was typed in.
|
|
||||||
*/
|
*/
|
||||||
struct obj *
|
struct obj *
|
||||||
readobjnam(bp, no_wish, from_user)
|
readobjnam(bp, no_wish)
|
||||||
register char *bp;
|
register char *bp;
|
||||||
struct obj *no_wish;
|
struct obj *no_wish;
|
||||||
boolean from_user;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
register char *p;
|
||||||
register int i;
|
register int i;
|
||||||
@@ -2126,8 +2129,7 @@ boolean from_user;
|
|||||||
) cnt=5000;
|
) cnt=5000;
|
||||||
if (cnt < 1) cnt=1;
|
if (cnt < 1) cnt=1;
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
if (from_user)
|
pline("%d gold piece%s.", cnt, plur(cnt));
|
||||||
pline("%d gold piece%s.", cnt, plur(cnt));
|
|
||||||
u.ugold += cnt;
|
u.ugold += cnt;
|
||||||
context.botl=1;
|
context.botl=1;
|
||||||
return (&zeroobj);
|
return (&zeroobj);
|
||||||
@@ -2331,11 +2333,12 @@ srch:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
/* Let wizards wish for traps --KAA */
|
/* Let wizards wish for traps and furniture.
|
||||||
/* must come after objects check so wizards can still wish for
|
* Must come after objects check so wizards can still wish for
|
||||||
* trap objects like beartraps
|
* trap objects like beartraps.
|
||||||
|
* Disallow such topology tweaks for WIZKIT startup wishes.
|
||||||
*/
|
*/
|
||||||
if (wizard && from_user) {
|
if (wizard && !program_state.wizkit_wishing) {
|
||||||
int trap;
|
int trap;
|
||||||
|
|
||||||
for (trap = NO_TRAP+1; trap < TRAPNUM; trap++) {
|
for (trap = NO_TRAP+1; trap < TRAPNUM; trap++) {
|
||||||
@@ -2351,7 +2354,8 @@ srch:
|
|||||||
return(&zeroobj);
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* or some other dungeon features -dlc */
|
|
||||||
|
/* furniture and terrain */
|
||||||
p = eos(bp);
|
p = eos(bp);
|
||||||
if(!BSTRCMP(bp, p-8, "fountain")) {
|
if(!BSTRCMP(bp, p-8, "fountain")) {
|
||||||
levl[u.ux][u.uy].typ = FOUNTAIN;
|
levl[u.ux][u.uy].typ = FOUNTAIN;
|
||||||
@@ -2515,11 +2519,13 @@ typfnd:
|
|||||||
if (oclass == VENOM_CLASS) otmp->spe = 1;
|
if (oclass == VENOM_CLASS) otmp->spe = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (spesgn == 0) spe = otmp->spe;
|
if (spesgn == 0) {
|
||||||
|
spe = otmp->spe;
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
else if (wizard) /* no alteration to spe */ ;
|
} else if (wizard) {
|
||||||
|
; /* no alteration to spe */
|
||||||
#endif
|
#endif
|
||||||
else if (oclass == ARMOR_CLASS || oclass == WEAPON_CLASS ||
|
} else if (oclass == ARMOR_CLASS || oclass == WEAPON_CLASS ||
|
||||||
is_weptool(otmp) ||
|
is_weptool(otmp) ||
|
||||||
(oclass==RING_CLASS && objects[typ].oc_charged)) {
|
(oclass==RING_CLASS && objects[typ].oc_charged)) {
|
||||||
if(spe > rnd(5) && spe > otmp->spe) spe = 0;
|
if(spe > rnd(5) && spe > otmp->spe) spe = 0;
|
||||||
|
|||||||
+5
-1
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)pline.c 3.4 2003/11/06 */
|
/* SCCS Id: @(#)pline.c 3.4 2004/11/22 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -49,6 +49,10 @@ pline VA_DECL(const char *, line)
|
|||||||
/* Do NOT use VA_START and VA_END in here... see above */
|
/* Do NOT use VA_START and VA_END in here... see above */
|
||||||
|
|
||||||
if (!line || !*line) return;
|
if (!line || !*line) return;
|
||||||
|
#ifdef WIZARD
|
||||||
|
if (program_state.wizkit_wishing) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (index(line, '%')) {
|
if (index(line, '%')) {
|
||||||
Vsprintf(pbuf,line,VA_ARGS);
|
Vsprintf(pbuf,line,VA_ARGS);
|
||||||
line = pbuf;
|
line = pbuf;
|
||||||
|
|||||||
+24
-1
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)questpgr.c 3.4 2000/05/05 */
|
/* SCCS Id: @(#)questpgr.c 3.4 2004/11/22 */
|
||||||
/* Copyright 1991, M. Stephenson */
|
/* Copyright 1991, M. Stephenson */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ STATIC_DCL void FDECL(convert_arg, (CHAR_P));
|
|||||||
STATIC_DCL void NDECL(convert_line);
|
STATIC_DCL void NDECL(convert_line);
|
||||||
STATIC_DCL void FDECL(deliver_by_pline, (struct qtmsg *));
|
STATIC_DCL void FDECL(deliver_by_pline, (struct qtmsg *));
|
||||||
STATIC_DCL void FDECL(deliver_by_window, (struct qtmsg *,int));
|
STATIC_DCL void FDECL(deliver_by_window, (struct qtmsg *,int));
|
||||||
|
STATIC_DCL boolean FDECL(skip_pager, (BOOLEAN_P));
|
||||||
|
|
||||||
static char in_line[80], cvt_buf[64], out_line[128];
|
static char in_line[80], cvt_buf[64], out_line[128];
|
||||||
static struct qtlists qt_list;
|
static struct qtlists qt_list;
|
||||||
@@ -386,12 +387,32 @@ int how;
|
|||||||
destroy_nhwindow(datawin);
|
destroy_nhwindow(datawin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
skip_pager(common)
|
||||||
|
boolean common;
|
||||||
|
{
|
||||||
|
#ifdef WIZARD
|
||||||
|
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
||||||
|
if (program_state.wizkit_wishing) return TRUE;
|
||||||
|
#endif
|
||||||
|
if (!(common ? qt_list.common : qt_list.chrole)) {
|
||||||
|
panic("%s: no %s quest text data available",
|
||||||
|
common ? "com_pager" : "qt_pager",
|
||||||
|
common ? "common" : "role-specific");
|
||||||
|
/*NOTREACHED*/
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
com_pager(msgnum)
|
com_pager(msgnum)
|
||||||
int msgnum;
|
int msgnum;
|
||||||
{
|
{
|
||||||
struct qtmsg *qt_msg;
|
struct qtmsg *qt_msg;
|
||||||
|
|
||||||
|
if (skip_pager(TRUE)) return;
|
||||||
|
|
||||||
if (!(qt_msg = msg_in(qt_list.common, msgnum))) {
|
if (!(qt_msg = msg_in(qt_list.common, msgnum))) {
|
||||||
impossible("com_pager: message %d not found.", msgnum);
|
impossible("com_pager: message %d not found.", msgnum);
|
||||||
return;
|
return;
|
||||||
@@ -410,6 +431,8 @@ int msgnum;
|
|||||||
{
|
{
|
||||||
struct qtmsg *qt_msg;
|
struct qtmsg *qt_msg;
|
||||||
|
|
||||||
|
if (skip_pager(FALSE)) return;
|
||||||
|
|
||||||
if (!(qt_msg = msg_in(qt_list.chrole, msgnum))) {
|
if (!(qt_msg = msg_in(qt_list.chrole, msgnum))) {
|
||||||
impossible("qt_pager: message %d not found.", msgnum);
|
impossible("qt_pager: message %d not found.", msgnum);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)zap.c 3.4 2004/09/10 */
|
/* SCCS Id: @(#)zap.c 3.4 2004/11/22 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -4232,12 +4232,12 @@ retry:
|
|||||||
* has been denied. Wishing for "nothing" requires a separate
|
* has been denied. Wishing for "nothing" requires a separate
|
||||||
* value to remain distinct.
|
* value to remain distinct.
|
||||||
*/
|
*/
|
||||||
otmp = readobjnam(buf, ¬hing, TRUE);
|
otmp = readobjnam(buf, ¬hing);
|
||||||
if (!otmp) {
|
if (!otmp) {
|
||||||
pline("Nothing fitting that description exists in the game.");
|
pline("Nothing fitting that description exists in the game.");
|
||||||
if (++tries < 5) goto retry;
|
if (++tries < 5) goto retry;
|
||||||
pline(thats_enough_tries);
|
pline(thats_enough_tries);
|
||||||
otmp = readobjnam((char *)0, (struct obj *)0, TRUE);
|
otmp = readobjnam((char *)0, (struct obj *)0);
|
||||||
if (!otmp) return; /* for safety; should never happen */
|
if (!otmp) return; /* for safety; should never happen */
|
||||||
} else if (otmp == ¬hing) {
|
} else if (otmp == ¬hing) {
|
||||||
/* explicitly wished for "nothing", presumeably attempting
|
/* explicitly wished for "nothing", presumeably attempting
|
||||||
|
|||||||
Reference in New Issue
Block a user