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

Function fill_special_room

src/sp_lev.c:2730–2804  ·  view source on GitHub ↗

* Fill a room (shop, zoo, etc...) with appropriate stuff. */

Source from the content-addressed store, hash-verified

2728 * Fill a room (shop, zoo, etc...) with appropriate stuff.
2729 */
2730void
2731fill_special_room(struct mkroom *croom)
2732{
2733 int i;
2734
2735 if (!croom)
2736 return;
2737
2738 /* First recurse into subrooms. We don't want to block an ordinary room
2739 * with a special subroom from having the subroom filled, or an unfilled
2740 * outer room preventing a special subroom from being filled. */
2741 for (i = 0; i < croom->nsubrooms; ++i) {
2742 fill_special_room(croom->sbrooms[i]);
2743 }
2744
2745 if (croom->rtype == OROOM || croom->rtype == THEMEROOM
2746 || croom->needfill == FILL_NONE)
2747 return;
2748
2749 if (croom->needfill == FILL_NORMAL) {
2750 int x, y;
2751
2752 /* Shop ? */
2753 if (croom->rtype >= SHOPBASE) {
2754 stock_room(croom->rtype - SHOPBASE, croom);
2755 svl.level.flags.has_shop = TRUE;
2756 return;
2757 }
2758
2759 switch (croom->rtype) {
2760 case VAULT:
2761 for (x = croom->lx; x <= croom->hx; x++)
2762 for (y = croom->ly; y <= croom->hy; y++)
2763 (void) mkgold((long) rn1(abs(depth(&u.uz)) * 100, 51),
2764 x, y);
2765 break;
2766 case COURT:
2767 case ZOO:
2768 case BEEHIVE:
2769 case ANTHOLE:
2770 case COCKNEST:
2771 case LEPREHALL:
2772 case MORGUE:
2773 case BARRACKS:
2774 fill_zoo(croom);
2775 break;
2776 }
2777 }
2778 switch (croom->rtype) {
2779 case VAULT:
2780 svl.level.flags.has_vault = TRUE;
2781 break;
2782 case ZOO:
2783 svl.level.flags.has_zoo = TRUE;
2784 break;
2785 case COURT:
2786 svl.level.flags.has_court = TRUE;
2787 break;

Callers 2

makelevelFunction · 0.85
lspo_finalize_levelFunction · 0.85

Calls 4

stock_roomFunction · 0.85
mkgoldFunction · 0.85
depthFunction · 0.85
fill_zooFunction · 0.85

Tested by

no test coverage detected