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

Function could_move_onto_boulder

src/hack.c:144–163  ·  view source on GitHub ↗

can hero move onto a spot containing one or more boulders? used for m and travel and during boulder push failure */

Source from the content-addressed store, hash-verified

142/* can hero move onto a spot containing one or more boulders?
143 used for m<dir> and travel and during boulder push failure */
144staticfn boolean
145could_move_onto_boulder(coordxy sx, coordxy sy)
146{
147 /* can if able to phaze through rock (must be poly'd, so not riding) */
148 if (Passes_walls)
149 return TRUE;
150 /* can't when riding */
151 if (u.usteed)
152 return FALSE;
153 /* can if a giant, unless doing so allows hero to pass into a
154 diagonal squeeze at the same time */
155 if (throws_rocks(gy.youmonst.data))
156 return (!u.dx || !u.dy || !(IS_OBSTRUCTED(levl[u.ux][sy].typ)
157 && IS_OBSTRUCTED(levl[sx][u.uy].typ)));
158 /* can if tiny (implies carrying very little else couldn't move at all) */
159 if (verysmall(gy.youmonst.data))
160 return TRUE;
161 /* can squeeze to spot if carrying extremely little, otherwise can't */
162 return squeezeablylightinvent();
163}
164
165staticfn void
166dopush(

Callers 4

cannot_pushFunction · 0.85
moverock_coreFunction · 0.85
test_moveFunction · 0.85
findtravelpathFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_moveFunction · 0.68