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

Function move_out_of_bounds

src/hack.c:2585–2612  ·  view source on GitHub ↗

trying to move out-of-bounds? */

Source from the content-addressed store, hash-verified

2583
2584/* trying to move out-of-bounds? */
2585staticfn boolean
2586move_out_of_bounds(coordxy x, coordxy y)
2587{
2588 if (!isok(x, y)) {
2589 if (svc.context.forcefight)
2590 return domove_fight_empty(x, y);
2591
2592 if (flags.mention_walls) {
2593 coordxy dx = u.dx, dy = u.dy;
2594
2595 if (dx && dy) { /* diagonal */
2596 /* only as far as possible diagonally if in very
2597 corner; otherwise just report whichever of the
2598 cardinal directions has reached its limit */
2599 if (isok(x, u.uy))
2600 dx = 0;
2601 else if (isok(u.ux, y))
2602 dy = 0;
2603 }
2604 You("have already gone as far %s as possible.",
2605 directionname(xytodir(dx, dy)));
2606 }
2607 nomul(0);
2608 svc.context.move = 0;
2609 return TRUE;
2610 }
2611 return FALSE;
2612}
2613
2614/* carrying too much to be able to move? */
2615staticfn boolean

Callers 1

domove_coreFunction · 0.85

Calls 6

isokFunction · 0.85
domove_fight_emptyFunction · 0.85
YouFunction · 0.85
directionnameFunction · 0.85
xytodirFunction · 0.85
nomulFunction · 0.85

Tested by

no test coverage detected