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

Function pick_level

src/dungeon.c:631–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629
630/* Pick the nth TRUE entry in the given boolean array. */
631staticfn xint16
632pick_level(
633 boolean *map, /* an array MAXLEVEL+1 in size */
634 int nth)
635{
636 xint16 i;
637 for (i = 1; i <= MAXLEVEL; i++)
638 if (map[i] && !nth--)
639 return i;
640 panic("pick_level: ran out of valid levels");
641 /*NOTREACHED*/
642 return 0;
643}
644
645RESTORE_WARNING_UNREACHABLE_CODE
646

Callers 1

place_levelFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected