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

Function cardinal_nextto_room

src/mklev.c:680–698  ·  view source on GitHub ↗

is x,y location such that NEWS direction from it is inside aroom, excluding subrooms */

Source from the content-addressed store, hash-verified

678/* is x,y location such that NEWS direction from it is inside aroom,
679 excluding subrooms */
680staticfn boolean
681cardinal_nextto_room(struct mkroom *aroom, coordxy x, coordxy y)
682{
683 int rmno = (int) ((aroom - svr.rooms) + ROOMOFFSET);
684
685 if (isok(x - 1, y) && !levl[x - 1][y].edge
686 && (int) levl[x - 1][y].roomno == rmno)
687 return TRUE;
688 if (isok(x + 1, y) && !levl[x + 1][y].edge
689 && (int) levl[x + 1][y].roomno == rmno)
690 return TRUE;
691 if (isok(x, y - 1) && !levl[x][y - 1].edge
692 && (int) levl[x][y - 1].roomno == rmno)
693 return TRUE;
694 if (isok(x, y + 1) && !levl[x][y + 1].edge
695 && (int) levl[x][y + 1].roomno == rmno)
696 return TRUE;
697 return FALSE;
698}
699
700staticfn boolean
701place_niche(

Callers 1

place_nicheFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected