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

Function mklev_sanity_check

src/mklev.c:1222–1247  ·  view source on GitHub ↗

check mklev created level sanity */

Source from the content-addressed store, hash-verified

1220
1221/* check mklev created level sanity */
1222staticfn void
1223mklev_sanity_check(void)
1224{
1225 coordxy x, y;
1226 int i;
1227 int rmno = -1;
1228
1229 if (!(iflags.sanity_check || iflags.debug_fuzzer))
1230 return;
1231
1232 for (y = 0; y < ROWNO; y++) {
1233 for (x = 1; x < COLNO; x++) {
1234 if (!chk_okdoor(x,y))
1235 impossible("levl[%i][%i] door not ok", x, y);
1236 }
1237 }
1238
1239 for (i = 0; i < svn.nroom; i++) {
1240 if (!svr.rooms[i].needjoining)
1241 continue;
1242 if (rmno == -1)
1243 rmno = gs.smeq[i];
1244 if (rmno != -1 && gs.smeq[i] != rmno)
1245 impossible("room %i not connected?", i);
1246 }
1247}
1248
1249
1250staticfn void

Callers 1

makelevelFunction · 0.85

Calls 2

chk_okdoorFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected