MCPcopy Create free account
hub / github.com/NetHack/NetHack / mnexto

Function mnexto

src/mon.c:3954–3983  ·  view source on GitHub ↗

make monster mtmp next to you (if possible); might place monst on far side of a wall or boulder */

Source from the content-addressed store, hash-verified

3952/* make monster mtmp next to you (if possible);
3953 might place monst on far side of a wall or boulder */
3954void
3955mnexto(struct monst *mtmp, unsigned int rlocflags)
3956{
3957 coord mm;
3958
3959 if (mtmp == u.usteed) {
3960 /* Keep your steed in sync with you instead */
3961 mtmp->mx = u.ux;
3962 mtmp->my = u.uy;
3963 return;
3964 }
3965
3966 if (!enexto(&mm, u.ux, u.uy, mtmp->data) || !isok(mm.x, mm.y)) {
3967 deal_with_overcrowding(mtmp);
3968 return;
3969 }
3970 /* wizard-mode player can choose destination by setting 'montelecontrol'
3971 option; enexto()'s value for 'mm' will be the default; 'savemm' is
3972 used to make sure player doesn't choose hero's location and then
3973 answer 'y' to the 'override invalid spot' prompt */
3974 if (iflags.mon_telecontrol) {
3975 coord savemm = mm;
3976
3977 if (!control_mon_tele(mtmp, &mm, rlocflags, FALSE))
3978 mm = savemm;
3979 }
3980
3981 rloc_to_flag(mtmp, mm.x, mm.y, rlocflags);
3982 return;
3983}
3984
3985void
3986deal_with_overcrowding(struct monst *mtmp)

Callers 14

newgameFunction · 0.85
u_collide_mFunction · 0.85
spoteffectsFunction · 0.85
tacticsFunction · 0.85
gd_moveFunction · 0.85
paygdFunction · 0.85
mon_arriveFunction · 0.85
m_moveFunction · 0.85
expelsFunction · 0.85
magic_whistledFunction · 0.85
mleashed_next2uFunction · 0.85
mv_bubbleFunction · 0.85

Calls 5

enextoFunction · 0.85
isokFunction · 0.85
deal_with_overcrowdingFunction · 0.85
control_mon_teleFunction · 0.85
rloc_to_flagFunction · 0.85

Tested by

no test coverage detected