| 217 | |
| 218 | /* pick an unused room, preferably with only one door */ |
| 219 | staticfn struct mkroom * |
| 220 | pick_room(boolean strict) |
| 221 | { |
| 222 | struct mkroom *sroom; |
| 223 | int i = svn.nroom; |
| 224 | |
| 225 | for (sroom = &svr.rooms[rn2(svn.nroom)]; i--; sroom++) { |
| 226 | if (sroom == &svr.rooms[svn.nroom]) |
| 227 | sroom = &svr.rooms[0]; |
| 228 | if (sroom->hx < 0) |
| 229 | return (struct mkroom *) 0; |
| 230 | if (sroom->rtype != OROOM) |
| 231 | continue; |
| 232 | if (!strict) { |
| 233 | if (has_upstairs(sroom) || (has_dnstairs(sroom) && rn2(3))) |
| 234 | continue; |
| 235 | } else if (has_upstairs(sroom) || has_dnstairs(sroom)) |
| 236 | continue; |
| 237 | if (sroom->doorct == 1 || !rn2(5) || wizard) |
| 238 | return sroom; |
| 239 | } |
| 240 | return (struct mkroom *) 0; |
| 241 | } |
| 242 | |
| 243 | staticfn void |
| 244 | mkzoo(int type) |
no test coverage detected