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

Function check_jump

src/apply.c:1861–1890  ·  view source on GitHub ↗

callback routine for walk_path() */

Source from the content-addressed store, hash-verified

1859
1860/* callback routine for walk_path() */
1861staticfn boolean
1862check_jump(genericptr arg, coordxy x, coordxy y)
1863{
1864 int traj = *(int *) arg;
1865 struct rm *lev = &levl[x][y];
1866
1867 if (Passes_walls)
1868 return TRUE;
1869 if (IS_STWALL(lev->typ))
1870 return FALSE;
1871 if (IS_DOOR(lev->typ)) {
1872 if (closed_door(x, y))
1873 return FALSE;
1874 if ((lev->doormask & D_ISOPEN) != 0 && traj != jAny
1875 /* reject diagonal jump into or out-of or through open door */
1876 && (traj == jDiag
1877 /* reject horizontal jump through horizontal open door
1878 and non-horizontal (ie, vertical) jump through
1879 non-horizontal (vertical) open door */
1880 || ((traj & jHorz) != 0) == (lev->horizontal != 0)))
1881 return FALSE;
1882 /* empty doorways aren't restricted */
1883 }
1884 /* let giants jump over boulders (what about Flying?
1885 and is there really enough head room for giants to jump
1886 at all, let alone over something tall?) */
1887 if (sobj_at(BOULDER, x, y) && !throws_rocks(gy.youmonst.data))
1888 return FALSE;
1889 return TRUE;
1890}
1891
1892staticfn boolean
1893is_valid_jump_pos(coordxy x, coordxy y, int magic, boolean showmsg)

Callers

nothing calls this directly

Calls 2

closed_doorFunction · 0.85
sobj_atFunction · 0.85

Tested by

no test coverage detected