Merge branch 'win-minor' of https://rodney.nethack.org:20040/git/NHsource into win-minor

This commit is contained in:
Bart House
2018-12-12 21:46:32 -08:00
9 changed files with 144 additions and 66 deletions
+2
View File
@@ -293,6 +293,7 @@ changing Sting's description to be "(weapon in hand) (light blue aura)" was
fix bit-use collision between WC2_TERM_SIZE and WC2_RESET_STATUS in fix bit-use collision between WC2_TERM_SIZE and WC2_RESET_STATUS in
include/winprocs.h following a recent merge include/winprocs.h following a recent merge
fix foxen pluralization again after underflow remedy reintroduced the problem fix foxen pluralization again after underflow remedy reintroduced the problem
fix "placing monster over another?" warning for vault guards
tty: turn off an optimization that is the suspected cause of Windows reported tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status
@@ -405,6 +406,7 @@ for ^X and enlightenment, display the information in a menu rather than a
'<' (menu_previous_page) and '^' (menu_first_page) menu keys; '<' (menu_previous_page) and '^' (menu_first_page) menu keys;
needed for interfaces (tty) without text popup scrollbar support; needed for interfaces (tty) without text popup scrollbar support;
end of game disclosure of attributes remains single-forward-pass end of game disclosure of attributes remains single-forward-pass
for ^X, include current state of 'autopickup'
NetHack Community Patches (or Variation) Included NetHack Community Patches (or Variation) Included
+2 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1544401264 2018/12/10 00:21:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.666 $ */ /* NetHack 3.6 extern.h $NHDT-Date: 1544669659 2018/12/13 02:54:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.667 $ */
/* 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. */
@@ -1730,6 +1730,7 @@ E int FDECL(fruitadd, (char *, struct fruit *));
E int FDECL(choose_classes_menu, (const char *, int, BOOLEAN_P, E int FDECL(choose_classes_menu, (const char *, int, BOOLEAN_P,
char *, char *)); char *, char *));
E boolean FDECL(parsebindings, (char *)); E boolean FDECL(parsebindings, (char *));
E void FDECL(oc_to_str, (char *, char *));
E void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P)); E void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P));
E char FDECL(get_menu_cmd_key, (CHAR_P)); E char FDECL(get_menu_cmd_key, (CHAR_P));
E char FDECL(map_menu_cmd, (CHAR_P)); E char FDECL(map_menu_cmd, (CHAR_P));
+17 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1544050555 2018/12/05 22:55:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.314 $ */ /* NetHack 3.6 cmd.c $NHDT-Date: 1544669664 2018/12/13 02:54:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.315 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2019,6 +2019,22 @@ int final;
enl_msg(Your_wallet, "contains ", "contained ", buf, ""); enl_msg(Your_wallet, "contains ", "contained ", buf, "");
} }
} }
if (flags.pickup) {
char ocl[MAXOCLASSES + 1];
Strcpy(buf, "on");
oc_to_str(flags.pickup_types, ocl);
Sprintf(eos(buf), " for %s%s%s",
*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])
Strcat(buf, ", with exceptions");
} else
Strcpy(buf, "off");
enl_msg("Auto-pickup ", "is ", "was ", buf, "");
} }
/* characteristics: expanded version of bottom line strength, dexterity, &c */ /* characteristics: expanded version of bottom line strength, dexterity, &c */
+15 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1544003110 2018/12/05 09:45:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.156 $ */ /* NetHack 3.6 end.c $NHDT-Date: 1544666123 2018/12/13 01:55:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -577,13 +577,13 @@ VA_DECL(const char *, str)
? "Program initialization has failed." ? "Program initialization has failed."
: "Suddenly, the dungeon collapses."); : "Suddenly, the dungeon collapses.");
#ifndef MICRO #ifndef MICRO
#if defined(NOTIFY_NETHACK_BUGS) #ifdef NOTIFY_NETHACK_BUGS
if (!wizard) if (!wizard)
raw_printf("Report the following error to \"%s\" or at \"%s\".", raw_printf("Report the following error to \"%s\" or at \"%s\".",
DEVTEAM_EMAIL, DEVTEAM_URL); DEVTEAM_EMAIL, DEVTEAM_URL);
else if (program_state.something_worth_saving) else if (program_state.something_worth_saving)
raw_print("\nError save file being written.\n"); raw_print("\nError save file being written.\n");
#else #else /* !NOTIFY_NETHACK_BUGS */
if (!wizard) { if (!wizard) {
const char *maybe_rebuild = !program_state.something_worth_saving const char *maybe_rebuild = !program_state.something_worth_saving
? "." ? "."
@@ -599,7 +599,7 @@ VA_DECL(const char *, str)
raw_printf("Report error to \"%s\"%s", WIZARD_NAME, raw_printf("Report error to \"%s\"%s", WIZARD_NAME,
maybe_rebuild); maybe_rebuild);
} }
#endif #endif /* ?NOTIFY_NETHACK_BUGS */
/* XXX can we move this above the prints? Then we'd be able to /* XXX can we move this above the prints? Then we'd be able to
* suppress "it may be possible to rebuild" based on dosave0() * suppress "it may be possible to rebuild" based on dosave0()
* or say it's NOT possible to rebuild. */ * or say it's NOT possible to rebuild. */
@@ -611,7 +611,7 @@ VA_DECL(const char *, str)
raw_printf("%s", sysopt.recover); raw_printf("%s", sysopt.recover);
} }
} }
#endif #endif /* !MICRO */
{ {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -1055,7 +1055,16 @@ int how;
if (iflags.debug_fuzzer) { if (iflags.debug_fuzzer) {
if (!(program_state.panicking || how == PANICKED)) { if (!(program_state.panicking || how == PANICKED)) {
savelife(how); savelife(how);
killer.name[0] = 0; /* periodically restore characteristics and lost exp levels */
if (!rn2(10)) {
struct obj *potion = mksobj(POT_RESTORE_ABILITY, TRUE, FALSE);
bless(potion);
(void) peffects(potion); /* always -1 for restore ability */
/* not useup(); we haven't put this potion into inventory */
obfree(potion, (struct obj *) 0);
}
killer.name[0] = '\0';
killer.format = 0; killer.format = 0;
return; return;
} }
+28 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1543455827 2018/11/29 01:43:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.272 $ */ /* NetHack 3.6 mon.c $NHDT-Date: 1544658160 2018/12/12 23:42:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.274 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -48,8 +48,6 @@ struct monst *mtmp;
boolean chk_geno; boolean chk_geno;
const char *msg; const char *msg;
{ {
if (DEADMONSTER(mtmp))
return;
if (mtmp->data < &mons[LOW_PM] || mtmp->data >= &mons[NUMMONS]) { if (mtmp->data < &mons[LOW_PM] || mtmp->data >= &mons[NUMMONS]) {
impossible("illegal mon data %s; mnum=%d (%s)", impossible("illegal mon data %s; mnum=%d (%s)",
fmt_ptr((genericptr_t) mtmp->data), mtmp->mnum, msg); fmt_ptr((genericptr_t) mtmp->data), mtmp->mnum, msg);
@@ -61,6 +59,15 @@ const char *msg;
mtmp->mnum, mndx, msg); mtmp->mnum, mndx, msg);
mtmp->mnum = mndx; mtmp->mnum = mndx;
} }
if (DEADMONSTER(mtmp)) {
#if 0
/* bad if not fmons list or if not vault guard */
if (strcmp(msg, "fmon") || !mtmp->isgd)
impossible("dead monster on %s; %s at <%d,%d>",
msg, mons[mndx].mname, mtmp->mx, mtmp->my);
#endif
return;
}
if (chk_geno && (mvitals[mndx].mvflags & G_GENOD) != 0) if (chk_geno && (mvitals[mndx].mvflags & G_GENOD) != 0)
impossible("genocided %s in play (%s)", mons[mndx].mname, msg); impossible("genocided %s in play (%s)", mons[mndx].mname, msg);
} }
@@ -84,9 +91,11 @@ mon_sanity_check()
struct monst *mtmp, *m; struct monst *mtmp, *m;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
/* dead monsters should still have sane data */
sanity_check_single_mon(mtmp, TRUE, "fmon"); sanity_check_single_mon(mtmp, TRUE, "fmon");
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp) && !mtmp->isgd)
continue; continue;
x = mtmp->mx, y = mtmp->my; x = mtmp->mx, y = mtmp->my;
if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0)) { if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0)) {
impossible("mon (%s) claims to be at <%d,%d>?", impossible("mon (%s) claims to be at <%d,%d>?",
@@ -713,10 +722,20 @@ movemon()
break; break;
} }
nmtmp = mtmp->nmon; nmtmp = mtmp->nmon;
/* one dead monster needs to perform a move after death: /* one dead monster needs to perform a move after death: vault
vault guard whose temporary corridor is still on the map */ guard whose temporary corridor is still on the map; live
if (mtmp->isgd && !mtmp->mx && DEADMONSTER(mtmp)) guards who have led the hero back to civilization get moved
(void) gd_move(mtmp); off the map too; gd_move() decides whether the temporary
corridor can be removed and guard discarded (via clearing
mon->isgd flag so that dmonsfree() will get rid of mon) */
if (mtmp->isgd && !mtmp->mx) {
/* parked at <0,0>; eventually isgd should get set to false */
if (monstermoves > mtmp->mlstmv) {
(void) gd_move(mtmp);
mtmp->mlstmv = monstermoves;
}
continue;
}
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
@@ -1766,7 +1785,7 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */ mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */
relobj(mtmp, 0, FALSE); relobj(mtmp, 0, FALSE);
if (onmap) { if (onmap || mtmp == level.monsters[0][0]) {
if (mtmp->wormno) if (mtmp->wormno)
remove_worm(mtmp); remove_worm(mtmp);
else else
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1544492043 2018/12/11 01:34:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.229 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1544520422 2018/12/11 09:27:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.230 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1220,7 +1220,7 @@ unsigned doname_flags;
Strcpy(tmpbuf, prefix + 2); Strcpy(tmpbuf, prefix + 2);
/* set prefix[] to "", "a ", or "an " */ /* set prefix[] to "", "a ", or "an " */
(void) just_an(prefix, *tmpbuf ? tmpbuf : bp); (void) just_an(prefix, *tmpbuf ? tmpbuf : bp);
/* apprend remainder of original prefix */ /* append remainder of original prefix */
Strcat(prefix, tmpbuf); Strcat(prefix, tmpbuf);
} }
@@ -1629,7 +1629,7 @@ const char *str;
impossible("Alphabet soup: 'an(%s)'.", str ? "\"\"" : "<null>"); impossible("Alphabet soup: 'an(%s)'.", str ? "\"\"" : "<null>");
return strcpy(buf, "an []"); return strcpy(buf, "an []");
} }
just_an(buf, str); (void) just_an(buf, str);
return strcat(buf, str); return strcat(buf, str);
} }
+8 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1544396581 2018/12/09 23:03:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.340 $ */ /* NetHack 3.6 options.c $NHDT-Date: 1544669666 2018/12/13 02:54:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.344 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */ /*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -557,7 +557,6 @@ STATIC_DCL int NDECL(count_menucolors);
STATIC_DCL boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *, STATIC_DCL boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *,
char *, char **)); char *, char **));
STATIC_DCL void FDECL(oc_to_str, (char *, char *));
STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int)); STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int, STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int,
char *, int)); char *, int));
@@ -2986,12 +2985,17 @@ boolean tinitial, tfrom_file;
use_menu = TRUE; use_menu = TRUE;
if (flags.menu_style == MENU_TRADITIONAL if (flags.menu_style == MENU_TRADITIONAL
|| flags.menu_style == MENU_COMBINATION) { || flags.menu_style == MENU_COMBINATION) {
boolean wasspace;
use_menu = FALSE; use_menu = FALSE;
Sprintf(qbuf, "New %s: [%s am] (%s)", fullname, ocl, Sprintf(qbuf, "New %s: [%s am] (%s)", fullname, ocl,
*tbuf ? tbuf : "all"); *tbuf ? tbuf : "all");
getlin(qbuf, abuf); getlin(qbuf, abuf);
wasspace = (abuf[0] == ' '); /* before mungspaces */
op = mungspaces(abuf); op = mungspaces(abuf);
if (abuf[0] == '\0' || abuf[0] == '\033') if (wasspace && !abuf[0])
; /* one or more spaces will remove old value */
else if (!abuf[0] || abuf[0] == '\033')
op = tbuf; /* restore */ op = tbuf; /* restore */
else if (abuf[0] == 'm') else if (abuf[0] == 'm')
use_menu = TRUE; use_menu = TRUE;
@@ -4081,7 +4085,7 @@ static NEARDATA const char *sortltype[] = { "none", "loot", "full" };
* Convert the given string of object classes to a string of default object * Convert the given string of object classes to a string of default object
* symbols. * symbols.
*/ */
STATIC_OVL void void
oc_to_str(src, dest) oc_to_str(src, dest)
char *src, *dest; char *src, *dest;
{ {
+8 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 steed.c $NHDT-Date: 1543543362 2018/11/30 02:02:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ /* NetHack 3.6 steed.c $NHDT-Date: 1544666049 2018/12/13 01:54:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */
/* 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,12 @@ place_monster(mon, x, y)
struct monst *mon; struct monst *mon;
int x, y; int x, y;
{ {
/* normal map bounds are <1..COLNO-1,0..ROWNO-1> but sometimes
vault guards (either living or dead) are parked at <0,0> */
if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) {
impossible("trying to place monster at <%d,%d>", x, y);
x = y = 0;
}
if (mon == u.usteed if (mon == u.usteed
/* special case is for convoluted vault guard handling */ /* special case is for convoluted vault guard handling */
|| (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) { || (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
@@ -750,7 +756,7 @@ int x, y;
return; return;
} }
if (level.monsters[x][y]) if (level.monsters[x][y])
impossible("placing monster over another?"); impossible("placing monster over another at <%d,%d>?", x, y);
mon->mx = x, mon->my = y; mon->mx = x, mon->my = y;
level.monsters[x][y] = mon; level.monsters[x][y] = mon;
} }
+61 -40
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 vault.c $NHDT-Date: 1542765368 2018/11/21 01:56:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.55 $ */ /* NetHack 3.6 vault.c $NHDT-Date: 1544608469 2018/12/12 09:54:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.57 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -10,6 +10,7 @@ STATIC_DCL struct monst *NDECL(findgd);
STATIC_DCL boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P)); STATIC_DCL boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P));
STATIC_DCL void FDECL(blackout, (int, int)); STATIC_DCL void FDECL(blackout, (int, int));
STATIC_DCL void FDECL(restfakecorr, (struct monst *)); STATIC_DCL void FDECL(restfakecorr, (struct monst *));
STATIC_DCL void FDECL(parkguard, (struct monst *));
STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int)); STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int));
STATIC_DCL void FDECL(move_gold, (struct obj *, int)); STATIC_DCL void FDECL(move_gold, (struct obj *, int));
STATIC_DCL void FDECL(wallify_vault, (struct monst *)); STATIC_DCL void FDECL(wallify_vault, (struct monst *));
@@ -22,8 +23,8 @@ struct monst *mtmp;
if (!mtmp->mextra) if (!mtmp->mextra)
mtmp->mextra = newmextra(); mtmp->mextra = newmextra();
if (!EGD(mtmp)) { if (!EGD(mtmp)) {
EGD(mtmp) = (struct egd *) alloc(sizeof(struct egd)); EGD(mtmp) = (struct egd *) alloc(sizeof (struct egd));
(void) memset((genericptr_t) EGD(mtmp), 0, sizeof(struct egd)); (void) memset((genericptr_t) EGD(mtmp), 0, sizeof (struct egd));
} }
} }
@@ -38,6 +39,9 @@ struct monst *mtmp;
mtmp->isgd = 0; mtmp->isgd = 0;
} }
/* try to remove the temporary corridor (from vault to rest of map) being
maintained by guard 'grd'; if guard is still in it, removal will fail,
to be tried again later */
STATIC_OVL boolean STATIC_OVL boolean
clear_fcorr(grd, forceshow) clear_fcorr(grd, forceshow)
struct monst *grd; struct monst *grd;
@@ -53,10 +57,14 @@ boolean forceshow;
if (!on_level(&egrd->gdlevel, &u.uz)) if (!on_level(&egrd->gdlevel, &u.uz))
return TRUE; return TRUE;
/* note: guard remains on 'fmons' list (alive or dead, at off-map
coordinate <0,0>), until temporary corridor from vault back to
civilization has been removed */
while ((fcbeg = egrd->fcbeg) < egrd->fcend) { while ((fcbeg = egrd->fcbeg) < egrd->fcend) {
fcx = egrd->fakecorr[fcbeg].fx; fcx = egrd->fakecorr[fcbeg].fx;
fcy = egrd->fakecorr[fcbeg].fy; fcy = egrd->fakecorr[fcbeg].fy;
if ((DEADMONSTER(grd) || !in_fcorridor(grd, u.ux, u.uy)) && egrd->gddone) if ((DEADMONSTER(grd) || !in_fcorridor(grd, u.ux, u.uy))
&& egrd->gddone)
forceshow = TRUE; forceshow = TRUE;
if ((u.ux == fcx && u.uy == fcy && !DEADMONSTER(grd)) if ((u.ux == fcx && u.uy == fcy && !DEADMONSTER(grd))
|| (!forceshow && couldsee(fcx, fcy)) || (!forceshow && couldsee(fcx, fcy))
@@ -137,6 +145,26 @@ struct monst *grd;
} }
} }
/* move guard--dead to alive--to <0,0> until temporary corridor is removed */
STATIC_OVL void
parkguard(grd)
struct monst *grd;
{
/* either guard is dead or will now be treated as if so;
monster traversal loops should skip it */
if (grd == context.polearm.hitmon)
context.polearm.hitmon = 0;
if (grd->mx) {
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, 0, 0);
/* [grd->mx,my just got set to 0,0 by place_monster(), so this
just sets EGD(grd)->ogx,ogy to 0,0 too; is that what we want?] */
EGD(grd)->ogx = grd->mx;
EGD(grd)->ogy = grd->my;
}
}
/* called in mon.c */ /* called in mon.c */
boolean boolean
grddead(grd) grddead(grd)
@@ -147,16 +175,8 @@ struct monst *grd;
if (!dispose) { if (!dispose) {
/* destroy guard's gold; drop any other inventory */ /* destroy guard's gold; drop any other inventory */
relobj(grd, 0, FALSE); relobj(grd, 0, FALSE);
/* guard is dead; monster traversal loops should skip it */
grd->mhp = 0; grd->mhp = 0;
if (grd == context.polearm.hitmon) parkguard(grd);
context.polearm.hitmon = 0;
/* see comment by newpos in gd_move() */
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, 0, 0);
EGD(grd)->ogx = grd->mx;
EGD(grd)->ogy = grd->my;
dispose = clear_fcorr(grd, TRUE); dispose = clear_fcorr(grd, TRUE);
} }
if (dispose) if (dispose)
@@ -226,13 +246,12 @@ invault()
u.uinvault = 0; u.uinvault = 0;
return; return;
} }
vaultroom -= ROOMOFFSET; vaultroom -= ROOMOFFSET;
guard = findgd(); guard = findgd();
if (++u.uinvault % VAULT_GUARD_TIME == 0 && !guard) { if (++u.uinvault % VAULT_GUARD_TIME == 0 && !guard) {
/* if time ok and no guard now. */ /* if time ok and no guard now. */
char buf[BUFSZ] = DUMMY; char buf[BUFSZ];
register int x, y, dd, gx, gy; register int x, y, dd, gx, gy;
int lx = 0, ly = 0; int lx = 0, ly = 0;
long umoney; long umoney;
@@ -387,6 +406,7 @@ invault()
nomul(0); nomul(0);
unmul((char *) 0); unmul((char *) 0);
} }
buf[0] = '\0';
trycount = 5; trycount = 5;
do { do {
getlin(Deaf ? "You are required to supply your name. -" getlin(Deaf ? "You are required to supply your name. -"
@@ -401,7 +421,7 @@ invault()
} }
if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos") if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos")
|| !strcmpi(buf, "Creosote")) { || !strcmpi(buf, "Creosote")) { /* Discworld */
if (!mvitals[PM_CROESUS].died) { if (!mvitals[PM_CROESUS].died) {
if (Deaf) { if (Deaf) {
if (!Blind) if (!Blind)
@@ -468,9 +488,9 @@ invault()
EGD(guard)->fcbeg = 0; EGD(guard)->fcbeg = 0;
EGD(guard)->fakecorr[0].fx = x; EGD(guard)->fakecorr[0].fx = x;
EGD(guard)->fakecorr[0].fy = y; EGD(guard)->fakecorr[0].fy = y;
if (IS_WALL(levl[x][y].typ)) if (IS_WALL(levl[x][y].typ)) {
EGD(guard)->fakecorr[0].ftyp = levl[x][y].typ; EGD(guard)->fakecorr[0].ftyp = levl[x][y].typ;
else { /* the initial guard location is a dug door */ } else { /* the initial guard location is a dug door */
int vlt = EGD(guard)->vroom; int vlt = EGD(guard)->vroom;
xchar lowx = rooms[vlt].lx, hix = rooms[vlt].hx; xchar lowx = rooms[vlt].lx, hix = rooms[vlt].hx;
xchar lowy = rooms[vlt].ly, hiy = rooms[vlt].hy; xchar lowy = rooms[vlt].ly, hiy = rooms[vlt].hy;
@@ -603,27 +623,29 @@ register struct monst *grd;
int x, y, nx, ny, m, n; int x, y, nx, ny, m, n;
int dx, dy, gx, gy, fci; int dx, dy, gx, gy, fci;
uchar typ; uchar typ;
struct rm *crm;
struct fakecorridor *fcp; struct fakecorridor *fcp;
register struct egd *egrd = EGD(grd); register struct egd *egrd = EGD(grd);
struct rm *crm; long umoney = 0L;
boolean goldincorridor = FALSE, boolean goldincorridor = FALSE, u_in_vault = FALSE, grd_in_vault = FALSE,
u_in_vault = vault_occupied(u.urooms) ? TRUE : FALSE, disappear_msg_seen = FALSE, semi_dead = DEADMONSTER(grd),
grd_in_vault = *in_rooms(grd->mx, grd->my, VAULT) ? TRUE : FALSE; u_carry_gold = FALSE, newspot = FALSE, see_guard;
boolean disappear_msg_seen = FALSE, semi_dead = (DEADMONSTER(grd));
long umoney = money_cnt(invent);
register boolean u_carry_gold = ((umoney + hidden_gold()) > 0L);
boolean see_guard, newspot = FALSE;
if (!on_level(&(egrd->gdlevel), &u.uz)) if (!on_level(&(egrd->gdlevel), &u.uz))
return -1; return -1;
nx = ny = m = n = 0; nx = ny = m = n = 0;
if (semi_dead || !grd->mx || egrd->gddone) {
egrd->gddone = 1;
goto cleanup;
}
debugpline1("gd_move: %s guard", grd->mpeaceful ? "peaceful" : "hostile");
u_in_vault = vault_occupied(u.urooms) ? TRUE : FALSE;
grd_in_vault = *in_rooms(grd->mx, grd->my, VAULT) ? TRUE : FALSE;
if (!u_in_vault && !grd_in_vault) if (!u_in_vault && !grd_in_vault)
wallify_vault(grd); wallify_vault(grd);
if (!grd->mpeaceful) { if (!grd->mpeaceful) {
if (semi_dead) {
egrd->gddone = 1;
goto newpos;
}
if (!u_in_vault if (!u_in_vault
&& (grd_in_vault || (in_fcorridor(grd, grd->mx, grd->my) && (grd_in_vault || (in_fcorridor(grd, grd->mx, grd->my)
&& !in_fcorridor(grd, u.ux, u.uy)))) { && !in_fcorridor(grd, u.ux, u.uy)))) {
@@ -647,6 +669,9 @@ register struct monst *grd;
grd->mpeaceful = 0; grd->mpeaceful = 0;
return -1; return -1;
} }
umoney = money_cnt(invent);
u_carry_gold = umoney > 0L || hidden_gold() > 0L;
if (egrd->fcend == 1) { if (egrd->fcend == 1) {
if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) { if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) {
if (egrd->warncnt == 3 && !Deaf) if (egrd->warncnt == 3 && !Deaf)
@@ -696,7 +721,6 @@ register struct monst *grd;
} else { } else {
if (!Deaf) if (!Deaf)
verbalize("Well, begone."); verbalize("Well, begone.");
wallify_vault(grd);
egrd->gddone = 1; egrd->gddone = 1;
goto cleanup; goto cleanup;
} }
@@ -881,7 +905,7 @@ proceed:
fcp->fy = ny; fcp->fy = ny;
fcp->ftyp = typ; fcp->ftyp = typ;
newpos: newpos:
gd_mv_monaway(grd, nx,ny); gd_mv_monaway(grd, nx, ny);
if (egrd->gddone) { if (egrd->gddone) {
/* The following is a kludge. We need to keep */ /* The following is a kludge. We need to keep */
/* the guard around in order to be able to make */ /* the guard around in order to be able to make */
@@ -893,17 +917,14 @@ newpos:
/* At the end of the process, the guard is killed */ /* At the end of the process, the guard is killed */
/* in restfakecorr(). */ /* in restfakecorr(). */
cleanup: cleanup:
x = grd->mx; x = grd->mx, y = grd->my;
y = grd->my;
see_guard = canspotmon(grd); see_guard = canspotmon(grd);
parkguard(grd); /* move to <0,0> */
wallify_vault(grd); wallify_vault(grd);
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, 0, 0);
egrd->ogx = grd->mx;
egrd->ogy = grd->my;
restfakecorr(grd); restfakecorr(grd);
debugpline2("gd_move: %scleanup%s",
grd->isgd ? "" : "final ",
grd->isgd ? " attempt" : "");
if (!semi_dead && (in_fcorridor(grd, u.ux, u.uy) || cansee(x, y))) { if (!semi_dead && (in_fcorridor(grd, u.ux, u.uy) || cansee(x, y))) {
if (!disappear_msg_seen && see_guard) if (!disappear_msg_seen && see_guard)
pline("Suddenly, %s disappears.", noit_mon_nam(grd)); pline("Suddenly, %s disappears.", noit_mon_nam(grd));