check whether bones are feasible */
| 353 | |
| 354 | /* check whether bones are feasible */ |
| 355 | boolean |
| 356 | can_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 */ |
no test coverage detected