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

Function possible_places

src/dungeon.c:597–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597staticfn int
598possible_places(
599 int idx, /* prototype index */
600 boolean *map, /* array MAXLEVEL+1 in length */
601 struct proto_dungeon *pd)
602{
603 int i, start, count;
604 s_level *lev = pd->final_lev[idx];
605
606 /* init level possibilities */
607 for (i = 0; i <= MAXLEVEL; i++)
608 map[i] = FALSE;
609
610 /* get base and range and set those entries to true */
611 count = level_range(lev->dlevel.dnum, pd->tmplevel[idx].lev.base,
612 pd->tmplevel[idx].lev.rand, pd->tmplevel[idx].chain,
613 pd, &start);
614 for (i = start; i < start + count; i++)
615 map[i] = TRUE;
616
617 /* mark off already placed levels */
618 for (i = pd->start; i < idx; i++) {
619 if (pd->final_lev[i] && map[pd->final_lev[i]->dlevel.dlevel]) {
620 map[pd->final_lev[i]->dlevel.dlevel] = FALSE;
621 --count;
622 }
623 }
624
625 return count;
626}
627
628DISABLE_WARNING_UNREACHABLE_CODE
629

Callers 1

place_levelFunction · 0.85

Calls 1

level_rangeFunction · 0.85

Tested by

no test coverage detected