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

Function place_niche

src/mklev.c:700–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700staticfn boolean
701place_niche(
702 struct mkroom *aroom,
703 int *dy,
704 coordxy *xx, coordxy *yy)
705{
706 coord dd;
707
708 if (rn2(2)) {
709 *dy = 1;
710 if (!finddpos(&dd, DIR_S, aroom))
711 return FALSE;
712 } else {
713 *dy = -1;
714 if (!finddpos(&dd, DIR_N, aroom))
715 return FALSE;
716 }
717 *xx = dd.x;
718 *yy = dd.y;
719 return (boolean) ((isok(*xx, *yy + *dy)
720 && levl[*xx][*yy + *dy].typ == STONE)
721 && (isok(*xx, *yy - *dy)
722 && !IS_POOL(levl[*xx][*yy - *dy].typ)
723 && !IS_FURNITURE(levl[*xx][*yy - *dy].typ))
724 && cardinal_nextto_room(aroom, *xx, *yy));
725}
726
727/* there should be one of these per trap, in the same order as trap.h */
728static NEARDATA const char *trap_engravings[TRAPNUM] = {

Callers 1

makenicheFunction · 0.85

Calls 4

rn2Function · 0.85
finddposFunction · 0.85
isokFunction · 0.85
cardinal_nextto_roomFunction · 0.85

Tested by

no test coverage detected