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

Function chk_okdoor

src/mklev.c:1197–1219  ·  view source on GitHub ↗

if x,y is door, does it open into solid terrain */

Source from the content-addressed store, hash-verified

1195
1196/* if x,y is door, does it open into solid terrain */
1197staticfn boolean
1198chk_okdoor(coordxy x, coordxy y)
1199{
1200 if (IS_DOOR(levl[x][y].typ)) {
1201 if (levl[x][y].horizontal) {
1202 if ((isok(x, y-1) && (levl[x][y-1].typ > TREE))
1203 && (isok(x, y+1) && (levl[x][y+1].typ <= TREE)))
1204 return FALSE;
1205 if ((isok(x, y-1) && (levl[x][y-1].typ <= TREE))
1206 && (isok(x, y+1) && (levl[x][y+1].typ > TREE)))
1207 return FALSE;
1208 } else {
1209 if ((isok(x-1, y) && (levl[x-1][y].typ > TREE))
1210 && (isok(x+1, y) && (levl[x+1][y].typ <= TREE)))
1211 return FALSE;
1212 if ((isok(x-1, y) && (levl[x-1][y].typ <= TREE))
1213 && (isok(x+1, y) && (levl[x+1][y].typ > TREE)))
1214 return FALSE;
1215 }
1216 return TRUE;
1217 }
1218 return TRUE;
1219}
1220
1221/* check mklev created level sanity */
1222staticfn void

Callers 1

mklev_sanity_checkFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected