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

Function cant_squeeze_thru

src/hack.c:952–979  ·  view source on GitHub ↗

caller has already decided that it's a tight diagonal; check whether a monster--who might be the hero--can fit through, and if not then return the reason why: 1: can't fit, 2: possessions won't fit, 3: sokoban returns 0 if we can squeeze through */

Source from the content-addressed store, hash-verified

950 the reason why: 1: can't fit, 2: possessions won't fit, 3: sokoban
951 returns 0 if we can squeeze through */
952int
953cant_squeeze_thru(struct monst *mon)
954{
955 int amt;
956 struct permonst *ptr = mon->data;
957
958 if ((mon == &gy.youmonst) ? Passes_walls : passes_walls(ptr))
959 return 0;
960
961 /* too big? */
962 if (bigmonst(ptr)
963 && !(amorphous(ptr) || is_whirly(ptr) || noncorporeal(ptr)
964 || slithy(ptr) || can_fog(mon)))
965 return 1;
966
967 /* lugging too much junk? */
968 amt = (mon == &gy.youmonst) ? inv_weight() + weight_cap()
969 : curr_mon_load(mon);
970 if (amt > WT_TOOMUCH_DIAGONAL)
971 return 2;
972
973 /* Sokoban restriction applies to hero only */
974 if (mon == &gy.youmonst && Sokoban)
975 return 3;
976
977 /* can squeeze through */
978 return 0;
979}
980
981boolean
982invocation_pos(coordxy x, coordxy y)

Callers 3

test_moveFunction · 0.85
crawl_destinationFunction · 0.85
mfndposFunction · 0.85

Calls 4

can_fogFunction · 0.85
inv_weightFunction · 0.85
weight_capFunction · 0.85
curr_mon_loadFunction · 0.85

Tested by 1

test_moveFunction · 0.68