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

Function can_make_bones

src/bones.c:355–385  ·  view source on GitHub ↗

check whether bones are feasible */

Source from the content-addressed store, hash-verified

353
354/* check whether bones are feasible */
355boolean
356can_make_bones(void)
357{
358 struct trap *ttmp;
359
360 if (!flags.bones)
361 return FALSE;
362 if (ledger_no(&u.uz) <= 0 || ledger_no(&u.uz) > maxledgerno())
363 return FALSE;
364 if (no_bones_level(&u.uz))
365 return FALSE; /* no bones for specific levels */
366 if (u.uswallow) {
367 return FALSE; /* no bones when swallowed */
368 }
369 if (!Is_branchlev(&u.uz)) {
370 /* no bones on non-branches with portals */
371 for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap)
372 if (ttmp->ttyp == MAGIC_PORTAL)
373 return FALSE;
374 }
375
376 if (depth(&u.uz) <= 0 /* bulletproofing for endgame */
377 || (!rn2(1 + (depth(&u.uz) >> 2)) /* fewer ghosts on low levels */
378 && !wizard))
379 return FALSE;
380 /* don't let multiple restarts generate multiple copies of objects
381 in bones files */
382 if (discover)
383 return FALSE;
384 return TRUE;
385}
386
387/* monster might need to be removed before saving a bones file,
388 in case these characters are not in their home bases */

Callers 1

really_doneFunction · 0.85

Calls 6

ledger_noFunction · 0.85
maxledgernoFunction · 0.85
no_bones_levelFunction · 0.85
Is_branchlevFunction · 0.85
depthFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected