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

Function build_room

src/sp_lev.c:2806–2833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2804}
2805
2806staticfn struct mkroom *
2807build_room(room *r, struct mkroom *mkr)
2808{
2809 boolean okroom;
2810 struct mkroom *aroom;
2811 xint16 rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM;
2812
2813 if (mkr) {
2814 aroom = &gs.subrooms[gn.nsubroom];
2815 okroom = create_subroom(mkr, r->x, r->y, r->w, r->h, rtype, r->rlit);
2816 } else {
2817 aroom = &svr.rooms[svn.nroom];
2818 okroom = create_room(r->x, r->y, r->w, r->h, r->xalign, r->yalign,
2819 rtype, r->rlit);
2820 }
2821
2822 if (okroom) {
2823#ifdef SPECIALIZATION
2824 topologize(aroom, FALSE); /* set roomno */
2825#else
2826 topologize(aroom); /* set roomno */
2827#endif
2828 aroom->needfill = r->needfill;
2829 aroom->needjoining = r->joined;
2830 return aroom;
2831 }
2832 return (struct mkroom *) 0;
2833}
2834
2835/*
2836 * set lighting in a region that will not become a room.

Callers 1

lspo_roomFunction · 0.85

Calls 3

rn2Function · 0.85
create_subroomFunction · 0.85
create_roomFunction · 0.85

Tested by

no test coverage detected