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

Function shared_with_room

src/sp_lev.c:1088–1106  ·  view source on GitHub ↗

is x,y right next to room droom? */

Source from the content-addressed store, hash-verified

1086
1087/* is x,y right next to room droom? */
1088staticfn boolean
1089shared_with_room(int x, int y, struct mkroom *droom)
1090{
1091 int rmno = (droom - svr.rooms) + ROOMOFFSET;
1092
1093 if (!isok(x,y))
1094 return FALSE;
1095 if ((int) levl[x][y].roomno == rmno && !levl[x][y].edge)
1096 return FALSE;
1097 if (isok(x-1, y) && (int) levl[x-1][y].roomno == rmno && x-1 <= droom->hx)
1098 return TRUE;
1099 if (isok(x+1, y) && (int) levl[x+1][y].roomno == rmno && x+1 >= droom->lx)
1100 return TRUE;
1101 if (isok(x, y-1) && (int) levl[x][y-1].roomno == rmno && y-1 <= droom->hy)
1102 return TRUE;
1103 if (isok(x, y+1) && (int) levl[x][y+1].roomno == rmno && y+1 >= droom->ly)
1104 return TRUE;
1105 return FALSE;
1106}
1107
1108/* maybe add door at x,y to room droom */
1109staticfn void

Callers 1

maybe_add_doorFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected