Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-01-14 18:16:19 -05:00
9 changed files with 208 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1546565813 2019/01/04 01:36:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.324 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1547486885 2019/01/14 17:28:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.327 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -781,36 +781,88 @@ wiz_identify(VOID_ARGS)
return 0;
}
/* #wizmakemap - discard current dungeon level and replace with a new one */
STATIC_PTR int
wiz_makemap(VOID_ARGS)
{
/* FIXME: doesn't handle riding */
if (wizard) {
struct monst *mtmp;
rm_mapseen(ledger_no(&u.uz));
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (mtmp->isgd) { /* vault is going away; get rid of guard */
mtmp->isgd = 0;
mongone(mtmp);
}
if (DEADMONSTER(mtmp))
continue;
if (mtmp->isshk)
setpaid(mtmp);
/* TODO?
* Reduce 'born' tally for each monster about to be discarded
* by savelev(), otherwise replacing heavily populated levels
* tends to make their inhabitants become extinct.
*/
}
if (Punished) {
ballrelease(FALSE);
unplacebc();
}
reset_utrap(FALSE); /* also done by safe_teleds() for new level */
check_special_room(TRUE);
dmonsfree();
/* reset lock picking unless it's for a carried container */
maybe_reset_pick();
/* reset interrupted digging if it was taking place on this level */
if (on_level(&context.digging.level, &u.uz))
(void) memset((genericptr_t) &context.digging, 0,
sizeof (struct dig_info));
/* reset cached targets */
iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination */
context.polearm.hitmon = (struct monst *) 0; /* polearm target */
/* escape from trap */
reset_utrap(FALSE);
check_special_room(TRUE); /* room exit */
u.ustuck = (struct monst *) 0;
u.uswallow = 0;
u.uinwater = 0;
u.uundetected = 0; /* not hidden, even if means are available */
dmonsfree(); /* purge dead monsters from 'fmon' */
/* keep steed and other adjacent pets after releasing them
from traps, stopping eating, &c as if hero were ascending */
keepdogs(TRUE); /* (pets-only; normally we'd be using 'FALSE' here) */
/* discard current level; "saving" is used to release dynamic data */
savelev(-1, ledger_no(&u.uz), FREE_SAVE);
/* create a new level; various things like bestowing a guardian
angel on Astral or setting off alarm on Ft.Ludios are handled
by goto_level(do.c) so won't occur for replacement levels */
mklev();
vision_reset();
g.vision_full_recalc = 1;
cls();
(void) safe_teleds(TRUE);
/* was using safe_teleds() but that doesn't honor arrival region
on levels which have such; we don't force stairs, just area */
u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */
| (In_W_tower(u.ux, u.uy, &u.uz) ? 2 : 0));
losedogs();
/* 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 */
if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed)
u_collide_m(mtmp);
initrack();
if (Punished) {
unplacebc();
placebc();
}
docrt();
flush_screen(1);
deliver_splev_message(); /* level entry */
check_special_room(FALSE); /* room entry */
#ifdef INSURANCE
save_currentstate();
#endif
} else {
pline(unavailcmd, "#wizmakemap");
}
return 0;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dig.c $NHDT-Date: 1544442710 2018/12/10 11:51:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.116 $ */
/* NetHack 3.6 dig.c $NHDT-Date: 1547421446 2019/01/13 23:17:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.117 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -610,10 +610,16 @@ int ttyp;
You("dig a pit in the %s.", surface_type);
if (shopdoor)
pay_for_damage("ruin", FALSE);
} else if (!madeby_obj && canseemon(madeby))
} else if (!madeby_obj && canseemon(madeby)) {
pline("%s digs a pit in the %s.", Monnam(madeby), surface_type);
else if (cansee(x, y) && flags.verbose)
} else if (cansee(x, y) && flags.verbose) {
pline("A pit appears in the %s.", surface_type);
}
/* in case we're digging down while encased in solid rock
which is blocking levitation or flight */
switch_terrain();
if (Levitation || Flying)
wont_fall = TRUE;
if (at_u) {
if (!wont_fall) {
@@ -642,6 +648,13 @@ int ttyp;
pline("A hole appears in the %s.", surface_type);
if (at_u) {
/* in case we're digging down while encased in solid rock
which is blocking levitation or flight */
switch_terrain();
if (Levitation || Flying)
wont_fall = TRUE;
/* check for leashed pet that can't fall right now */
if (!u.ustuck && !wont_fall && !next_to_u()) {
You("are jerked back by your pet!");
wont_fall = TRUE;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1547086513 2019/01/10 02:15:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.183 $ */
/* NetHack 3.6 do.c $NHDT-Date: 1547486886 2019/01/14 17:28:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.184 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1150,6 +1150,39 @@ register xchar x, y;
}
*/
/* extracted from goto_level(); also used by wiz_makemap() */
void
u_collide_m(mtmp)
struct monst *mtmp;
{
coord cc;
if (!mtmp || mtmp->mx != u.ux || mtmp->my != u.uy)
return;
/* There's a monster at your target destination; it might be one
which accompanied you--see mon_arrive(dogmove.c)--or perhaps
it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
&& distu(cc.x, cc.y) <= 2)
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else
mnexto(mtmp);
if ((mtmp = m_at(u.ux, u.uy)) != 0) {
/* there was an unconditional impossible("mnearto failed")
here, but it's not impossible and we're prepared to cope
with the situation, so only say something when debugging */
if (wizard)
pline("(monster in hero's way)");
if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0)
/* no room to move it; send it away, to return later */
m_into_limbo(mtmp);
}
}
void
goto_level(newlevel, at_stairs, falling, portal)
d_level *newlevel;
@@ -1438,34 +1471,13 @@ boolean at_stairs, falling, portal;
*/
run_timers();
/* hero might be arriving at a spot containing a monster;
if so, move one or the other to another location */
if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed)
u_collide_m(mtmp);
initrack();
if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed) {
/* There's a monster at your target destination; it might be one
which accompanied you--see mon_arrive(dogmove.c)--or perhaps
it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */
coord cc;
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
&& distu(cc.x, cc.y) <= 2)
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else
mnexto(mtmp);
if ((mtmp = m_at(u.ux, u.uy)) != 0) {
/* there was an unconditional impossible("mnearto failed")
here, but it's not impossible and we're prepared to cope
with the situation, so only say something when debugging */
if (wizard)
pline("(monster in hero's way)");
if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0)
/* no room to move it; send it away, to return later */
m_into_limbo(mtmp);
}
}
/* initial movement of bubbles just before vision_recalc */
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
movebubbles();

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1523308357 2018/04/09 21:12:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.6 dungeon.c $NHDT-Date: 1547421449 2019/01/13 23:17:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1197,7 +1197,7 @@ int x, y;
u.ux0 = u.ux, u.uy0 = u.uy;
}
/* place you on a random location */
/* place you on a random location when arriving on a level */
void
u_on_rndspot(upflag)
int upflag;
@@ -1225,6 +1225,9 @@ int upflag;
place_lregion(g.dndest.lx, g.dndest.ly, g.dndest.hx, g.dndest.hy,
g.dndest.nlx, g.dndest.nly, g.dndest.nhx, g.dndest.nhy,
LR_DOWNTELE, (d_level *) 0);
/* might have just left solid rock and unblocked levitation */
switch_terrain();
}
/* place you on the special staircase */