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

Function is_ok_location

src/sp_lev.c:1279–1308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1277}
1278
1279staticfn boolean
1280is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity)
1281{
1282 int typ = levl[x][y].typ;
1283
1284 if (Is_waterlevel(&u.uz))
1285 return TRUE; /* accept any spot */
1286
1287 if (is_ok_location_func)
1288 return is_ok_location_func(x, y);
1289
1290 /* TODO: Should perhaps check if wall is diggable/passwall? */
1291 if (humidity & ANY_LOC)
1292 return TRUE;
1293
1294 if ((humidity & SOLID) && IS_OBSTRUCTED(typ))
1295 return TRUE;
1296
1297 if ((humidity & (DRY|SPACELOC)) && SPACE_POS(typ)) {
1298 boolean bould = (sobj_at(BOULDER, x, y) != NULL);
1299
1300 if (!bould || (bould && (humidity & SOLID)))
1301 return TRUE;
1302 }
1303 if ((humidity & WET) && is_pool(x, y))
1304 return TRUE;
1305 if ((humidity & HOT) && is_lava(x, y))
1306 return TRUE;
1307 return FALSE;
1308}
1309
1310boolean
1311pm_good_location(coordxy x, coordxy y, struct permonst *pm)

Callers 3

get_locationFunction · 0.85
pm_good_locationFunction · 0.85
maze1xyFunction · 0.85

Calls 3

sobj_atFunction · 0.85
is_poolFunction · 0.85
is_lavaFunction · 0.85

Tested by

no test coverage detected