MCPcopy Index your code
hub / github.com/NetHack/NetHack / describe_level

Function describe_level

src/botl.c:440–476  ·  view source on GitHub ↗

provide the name of the current level for display by various ports */

Source from the content-addressed store, hash-verified

438
439/* provide the name of the current level for display by various ports */
440int
441describe_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 */

Callers 12

updateStatsMethod · 0.85
update_valFunction · 0.85
place_monsterFunction · 0.85
goto_levelFunction · 0.85
query_annotationFunction · 0.85
dmonsfreeFunction · 0.85
dealloc_monstFunction · 0.85
do_statusline2Function · 0.85
botl.cFile · 0.85
create_objectFunction · 0.85
updateStatsMethod · 0.85
FormatStatusStringFunction · 0.85

Calls 6

In_questFunction · 0.85
dunlevFunction · 0.85
endgamelevelnameFunction · 0.85
depthFunction · 0.85
strsubstFunction · 0.85
eosFunction · 0.85

Tested by

no test coverage detected