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

Function impaired_movement

src/hack.c:2424–2441  ·  view source on GitHub ↗

change movement dir if impaired. return TRUE if can't move */

Source from the content-addressed store, hash-verified

2422
2423/* change movement dir if impaired. return TRUE if can't move */
2424staticfn boolean
2425impaired_movement(coordxy *x, coordxy *y)
2426{
2427 if (u_maybe_impaired()) {
2428 int tries = 0;
2429
2430 do {
2431 if (tries++ > 50) {
2432 nomul(0);
2433 return TRUE;
2434 }
2435 confdir(TRUE);
2436 *x = u.ux + u.dx;
2437 *y = u.uy + u.dy;
2438 } while (!isok(*x, *y) || bad_rock(gy.youmonst.data, *x, *y));
2439 }
2440 return FALSE;
2441}
2442
2443staticfn boolean
2444avoid_moving_on_trap(coordxy x, coordxy y, boolean msg)

Callers 1

domove_coreFunction · 0.85

Calls 5

u_maybe_impairedFunction · 0.85
nomulFunction · 0.85
confdirFunction · 0.85
isokFunction · 0.85
bad_rockFunction · 0.85

Tested by

no test coverage detected