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

Function domove_core

src/hack.c:2711–2991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2709}
2710
2711staticfn void
2712domove_core(void)
2713{
2714 struct monst *mtmp;
2715 struct rm *tmpr;
2716 coordxy x, y;
2717 int glyph;
2718 coordxy chainx = 0, chainy = 0,
2719 ballx = 0, bally = 0; /* ball&chain new positions */
2720 int bc_control = 0; /* control for ball&chain */
2721 boolean cause_delay = FALSE, /* dragging ball will skip a move */
2722 displaceu = FALSE; /* involuntary swap */
2723
2724 if (svc.context.travel) {
2725 if (!findtravelpath(TRAVP_TRAVEL))
2726 (void) findtravelpath(TRAVP_GUESS);
2727 svc.context.travel1 = 0;
2728 }
2729
2730 if (carrying_too_much())
2731 return;
2732
2733 if (u.uswallow) {
2734 u.dx = u.dy = 0;
2735 x = u.ustuck->mx, y = u.ustuck->my;
2736 u_on_newpos(x, y); /* set u.ux,uy and handle CLIPPING */
2737 mtmp = u.ustuck;
2738 } else {
2739 if (air_turbulence())
2740 return;
2741
2742 /* check slippery ice */
2743 slippery_ice_fumbling();
2744
2745 x = u.ux + u.dx;
2746 y = u.uy + u.dy;
2747 if (impaired_movement(&x, &y))
2748 return;
2749
2750 /* turbulence might alter your actual destination */
2751 if (water_turbulence(&x, &y))
2752 return;
2753
2754 if (move_out_of_bounds(x, y))
2755 return;
2756
2757 if (avoid_running_into_trap_or_liquid(x, y))
2758 return;
2759
2760 if (escape_from_sticky_mon(x, y))
2761 return;
2762
2763 mtmp = m_at(x, y);
2764 if (mtmp && !is_safemon(mtmp)) {
2765 /* Don't attack if you're running, and can see it */
2766 /* It's fine to displace pets, though */
2767 /* We should never get here if forcefight */
2768 if (svc.context.run && ((!Blind && mon_visible(mtmp)

Callers 1

domoveFunction · 0.85

Calls 15

findtravelpathFunction · 0.85
carrying_too_muchFunction · 0.85
u_on_newposFunction · 0.85
air_turbulenceFunction · 0.85
slippery_ice_fumblingFunction · 0.85
impaired_movementFunction · 0.85
water_turbulenceFunction · 0.85
move_out_of_boundsFunction · 0.85
escape_from_sticky_monFunction · 0.85
is_safemonFunction · 0.85
mon_visibleFunction · 0.85

Tested by

no test coverage detected