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

Function populate_maze

src/mkmaze.c:1096–1124  ·  view source on GitHub ↗

add objects and monsters to random maze */

Source from the content-addressed store, hash-verified

1094
1095/* add objects and monsters to random maze */
1096staticfn void
1097populate_maze(void)
1098{
1099 int i;
1100 coord mm;
1101
1102 for (i = rn1(8, 11); i; i--) {
1103 mazexy(&mm);
1104 (void) mkobj_at(rn2(2) ? GEM_CLASS : RANDOM_CLASS, mm.x, mm.y, TRUE);
1105 }
1106 for (i = rn1(10, 2); i; i--) {
1107 mazexy(&mm);
1108 (void) mksobj_at(BOULDER, mm.x, mm.y, TRUE, FALSE);
1109 }
1110 for (i = rn2(3); i; i--) {
1111 mazexy(&mm);
1112 (void) makemon(&mons[PM_MINOTAUR], mm.x, mm.y, NO_MM_FLAGS);
1113 }
1114 for (i = rn1(5, 7); i; i--) {
1115 mazexy(&mm);
1116 (void) makemon((struct permonst *) 0, mm.x, mm.y, NO_MM_FLAGS);
1117 }
1118 for (i = rn1(6, 7); i; i--) {
1119 mazexy(&mm);
1120 (void) mkgold(0L, mm.x, mm.y);
1121 }
1122 for (i = rn1(6, 7); i; i--)
1123 mktrap(0, MKTRAP_MAZEFLAG, (struct mkroom *) 0, (coord *) 0);
1124}
1125
1126void
1127makemaz(const char *s)

Callers 1

makemazFunction · 0.85

Calls 7

mazexyFunction · 0.85
mkobj_atFunction · 0.85
rn2Function · 0.85
mksobj_atFunction · 0.85
makemonFunction · 0.85
mkgoldFunction · 0.85
mktrapFunction · 0.85

Tested by

no test coverage detected