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

Function ledger_to_dnum

src/dungeon.c:1398–1416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398DISABLE_WARNING_UNREACHABLE_CODE
1399
1400/* return the dungeon that this ledgerno exists in */
1401xint16
1402ledger_to_dnum(xint16 ledgerno)
1403{
1404 xint16 i;
1405
1406 /* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */
1407 for (i = 0; i < svn.n_dgns; i++)
1408 if (svd.dungeons[i].ledger_start < ledgerno
1409 && ledgerno <= (svd.dungeons[i].ledger_start
1410 + svd.dungeons[i].num_dunlevs))
1411 return i;
1412
1413 panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno);
1414 /*NOT REACHED*/
1415 return (xint16) 0;
1416}
1417
1418RESTORE_WARNING_UNREACHABLE_CODE
1419

Callers 5

goto_levelFunction · 0.85
ledger_to_dlevFunction · 0.85
lev_by_nameFunction · 0.85
show_overviewFunction · 0.85
migrate_to_levelFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected