provide the name of the current level for display by various ports */
| 438 | |
| 439 | /* provide the name of the current level for display by various ports */ |
| 440 | int |
| 441 | describe_level( |
| 442 | char *buf, /* output buffer */ |
| 443 | int dflgs) /* 1: append trailing space; 2: include dungeon branch name */ |
| 444 | { |
| 445 | boolean addspace = (dflgs & 1) != 0, /* (used to be unconditional) */ |
| 446 | addbranch = (dflgs & 2) != 0; /* False: status, True: livelog */ |
| 447 | int ret = 1; |
| 448 | |
| 449 | if (Is_knox(&u.uz)) { |
| 450 | Sprintf(buf, "%s", svd.dungeons[u.uz.dnum].dname); |
| 451 | addbranch = FALSE; |
| 452 | } else if (In_quest(&u.uz)) { |
| 453 | Sprintf(buf, "Home %d", dunlev(&u.uz)); |
| 454 | } else if (In_endgame(&u.uz)) { |
| 455 | /* [3.6.2: this used to be "Astral Plane" or generic "End Game"] */ |
| 456 | (void) endgamelevelname(buf, depth(&u.uz)); |
| 457 | if (!addbranch) |
| 458 | (void) strsubst(buf, "Plane of ", ""); /* just keep <element> */ |
| 459 | addbranch = FALSE; |
| 460 | } else { |
| 461 | /* ports with more room may expand this one */ |
| 462 | if (!addbranch) |
| 463 | Sprintf(buf, "%s:%-2d", /* "Dlvl:n" (grep fodder) */ |
| 464 | In_tutorial(&u.uz) ? "Tutorial" : "Dlvl", depth(&u.uz)); |
| 465 | else |
| 466 | Sprintf(buf, "level %d", depth(&u.uz)); |
| 467 | ret = 0; |
| 468 | } |
| 469 | if (addbranch) { |
| 470 | Sprintf(eos(buf), ", %s", svd.dungeons[u.uz.dnum].dname); |
| 471 | (void) strsubst(buf, "The ", "the "); |
| 472 | } |
| 473 | if (addspace) |
| 474 | Strcat(buf, " "); |
| 475 | return ret; |
| 476 | } |
| 477 | |
| 478 | /* weapon description for status lines; started as a terser version of |
| 479 | what ^X shows but has diverged to some extent */ |
no test coverage detected