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

Function fill_zoo

src/mkroom.c:275–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void
276fill_zoo(struct mkroom *sroom)
277{
278 struct monst *mon;
279 int sx, sy, i;
280 int sh, goldlim = 0, type = sroom->rtype;
281 coordxy tx = 0, ty = 0;
282 int rmno = (int) ((sroom - svr.rooms) + ROOMOFFSET);
283 coord mm;
284
285 /* Note: This doesn't check needfill; it assumes the caller has already
286 done that. */
287 sh = sroom->fdoor;
288 switch (type) {
289 case COURT:
290 if (svl.level.flags.is_maze_lev) {
291 for (tx = sroom->lx; tx <= sroom->hx; tx++)
292 for (ty = sroom->ly; ty <= sroom->hy; ty++)
293 if (IS_THRONE(levl[tx][ty].typ))
294 goto throne_placed;
295 }
296 i = 100;
297 do { /* don't place throne on top of stairs */
298 (void) somexyspace(sroom, &mm);
299 tx = mm.x;
300 ty = mm.y;
301 } while (occupied(tx, ty) && --i > 0);
302 throne_placed:
303 mk_zoo_thronemon(tx, ty);
304 break;
305 case BEEHIVE:
306 tx = sroom->lx + (sroom->hx - sroom->lx + 1) / 2;
307 ty = sroom->ly + (sroom->hy - sroom->ly + 1) / 2;
308 if (sroom->irregular) {
309 /* center might not be valid, so put queen elsewhere */
310 if ((int) levl[tx][ty].roomno != rmno || levl[tx][ty].edge) {
311 (void) somexyspace(sroom, &mm);
312 tx = mm.x;
313 ty = mm.y;
314 }
315 }
316 break;
317 case ZOO:
318 case LEPREHALL:
319 goldlim = 500 * level_difficulty();
320 break;
321 }
322
323 for (sx = sroom->lx; sx <= sroom->hx; sx++)
324 for (sy = sroom->ly; sy <= sroom->hy; sy++) {
325 if (sroom->irregular) {
326 if ((int) levl[sx][sy].roomno != rmno || levl[sx][sy].edge
327 || (sroom->doorct
328 && (distmin(sx, sy, svd.doors[sh].x, svd.doors[sh].y)
329 <= 1)))
330 continue;
331 } else if (!SPACE_POS(levl[sx][sy].typ)
332 || (sroom->doorct

Callers 1

fill_special_roomFunction · 0.85

Calls 15

somexyspaceFunction · 0.85
occupiedFunction · 0.85
mk_zoo_thronemonFunction · 0.85
level_difficultyFunction · 0.85
distminFunction · 0.85
makemonFunction · 0.85
courtmonFunction · 0.85
squadmonFunction · 0.85
morguemonFunction · 0.85
antholemonFunction · 0.85
set_malignFunction · 0.85
dist2Function · 0.85

Tested by

no test coverage detected