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

Function parent_dnum

src/dungeon.c:345–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343 * listing, then figuring out to which dungeon it belongs.
344 */
345staticfn xint16
346parent_dnum(
347 const char *s, /* dungeon name */
348 struct proto_dungeon *pd)
349{
350 int i;
351 xint16 pdnum;
352
353 i = find_branch(s, pd);
354 /*
355 * Got branch, now find parent dungeon. Stop if we have reached
356 * "this" dungeon (if we haven't found it by now it is an error).
357 */
358 for (pdnum = 0; strcmp(pd->tmpdungeon[pdnum].name, s); pdnum++)
359 if ((i -= pd->tmpdungeon[pdnum].branches) < 0)
360 return pdnum;
361
362 panic("parent_dnum: couldn't resolve branch.");
363 /*NOT REACHED*/
364 return (xint16) 0;
365}
366
367RESTORE_WARNING_UNREACHABLE_CODE
368

Callers 2

parent_dlevelFunction · 0.85
add_branchFunction · 0.85

Calls 2

find_branchFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected