\#wizmakemap followup
Both u_on_rndspot() and losedogs() might result in having a monster and the hero be at the same location. Have wiz_makemap() use the same fixup for that as goto_level().
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 extern.h $NHDT-Date: 1546687295 2019/01/05 11:21:35 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.681 $ */
|
/* NetHack 3.6 extern.h $NHDT-Date: 1547486885 2019/01/14 17:28:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.682 $ */
|
||||||
/* 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. */
|
||||||
|
|
||||||
@@ -384,6 +384,7 @@ E int NDECL(doup);
|
|||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
E void NDECL(save_currentstate);
|
E void NDECL(save_currentstate);
|
||||||
#endif
|
#endif
|
||||||
|
E void FDECL(u_collide_m, (struct monst *));
|
||||||
E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P));
|
E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P));
|
||||||
E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int,
|
E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int,
|
||||||
const char *, const char *));
|
const char *, const char *));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 cmd.c $NHDT-Date: 1547421842 2019/01/13 23:24:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.326 $ */
|
/* 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) 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. */
|
||||||
@@ -857,6 +857,11 @@ wiz_makemap(VOID_ARGS)
|
|||||||
u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */
|
u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */
|
||||||
| (In_W_tower(u.ux, u.uy, &u.uz) ? 2 : 0));
|
| (In_W_tower(u.ux, u.uy, &u.uz) ? 2 : 0));
|
||||||
losedogs();
|
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();
|
initrack();
|
||||||
if (Punished) {
|
if (Punished) {
|
||||||
unplacebc();
|
unplacebc();
|
||||||
|
|||||||
@@ -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) 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. */
|
||||||
@@ -1157,6 +1157,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, 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
|
void
|
||||||
goto_level(newlevel, at_stairs, falling, portal)
|
goto_level(newlevel, at_stairs, falling, portal)
|
||||||
d_level *newlevel;
|
d_level *newlevel;
|
||||||
@@ -1445,34 +1478,13 @@ boolean at_stairs, falling, portal;
|
|||||||
*/
|
*/
|
||||||
run_timers();
|
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();
|
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, 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 */
|
/* initial movement of bubbles just before vision_recalc */
|
||||||
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
||||||
movebubbles();
|
movebubbles();
|
||||||
|
|||||||
Reference in New Issue
Block a user