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

Function isclearpath

src/trap.c:3694–3722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3692}
3693
3694staticfn boolean
3695isclearpath(
3696 coord *cc,
3697 int distance,
3698 schar dx,
3699 schar dy)
3700{
3701 struct trap *t;
3702 uchar typ;
3703 coordxy x, y;
3704
3705 x = cc->x;
3706 y = cc->y;
3707 while (distance-- > 0) {
3708 x += dx;
3709 y += dy;
3710 if (!isok(x, y))
3711 return FALSE;
3712 typ = levl[x][y].typ;
3713 if (!ZAP_POS(typ) || closed_door(x, y))
3714 return FALSE;
3715 if ((t = t_at(x, y)) != 0
3716 && (is_pit(t->ttyp) || is_hole(t->ttyp) || is_xport(t->ttyp)))
3717 return FALSE;
3718 }
3719 cc->x = x;
3720 cc->y = y;
3721 return TRUE;
3722}
3723
3724/* can monster escape from a pit easily */
3725staticfn boolean

Callers 1

find_random_launch_coordFunction · 0.85

Calls 3

isokFunction · 0.85
closed_doorFunction · 0.85
t_atFunction · 0.85

Tested by

no test coverage detected