MCPcopy Index your code
hub / github.com/NetHack/NetHack / crawl_destination

Function crawl_destination

src/hack.c:4078–4101  ·  view source on GitHub ↗

used by drown() to check whether hero can crawl from water to ; also used by findtravelpath() when destination is one step away */

Source from the content-addressed store, hash-verified

4076/* used by drown() to check whether hero can crawl from water to <x,y>;
4077 also used by findtravelpath() when destination is one step away */
4078boolean
4079crawl_destination(coordxy x, coordxy y)
4080{
4081 /* is location ok in general? */
4082 if (!goodpos(x, y, &gy.youmonst, 0))
4083 return FALSE;
4084
4085 /* orthogonal movement is unrestricted when destination is ok */
4086 if (x == u.ux || y == u.uy)
4087 return TRUE;
4088
4089 /* diagonal movement has some restrictions */
4090 if (NODIAG(u.umonnum))
4091 return FALSE; /* poly'd into a grid bug... */
4092 if (Passes_walls)
4093 return TRUE; /* or a xorn... */
4094 /* pool could be next to a door, conceivably even inside a shop */
4095 if (IS_DOOR(levl[x][y].typ) && (!doorless_door(x, y) || block_door(x, y)))
4096 return FALSE;
4097 /* finally, are we trying to squeeze through a too-narrow gap? */
4098 return !(bad_rock(gy.youmonst.data, u.ux, y)
4099 && bad_rock(gy.youmonst.data, x, u.uy)
4100 && cant_squeeze_thru(&gy.youmonst));
4101}
4102
4103/* something like lookaround, but we are not running */
4104/* react only to monsters that might hit us */

Callers 2

findtravelpathFunction · 0.85
rnd_nextto_goodposFunction · 0.85

Calls 5

goodposFunction · 0.85
doorless_doorFunction · 0.85
block_doorFunction · 0.85
bad_rockFunction · 0.85
cant_squeeze_thruFunction · 0.85

Tested by

no test coverage detected