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

Function wiz_map_levltyp

src/wizcmds.c:692–835  ·  view source on GitHub ↗

wizard mode variant of #terrain; internal levl[][].typ values in base-36 */

Source from the content-addressed store, hash-verified

690
691/* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */
692void
693wiz_map_levltyp(void)
694{
695 winid win;
696 coordxy x, y;
697 int terrain;
698 char row[COLNO + 1];
699 boolean istty = !strcmp(windowprocs.name, "tty");
700
701 win = create_nhwindow(NHW_TEXT);
702 /* map row 0, levl[][0], is drawn on the second line of tty screen */
703 if (istty)
704 putstr(win, 0, ""); /* tty only: blank top line */
705 for (y = 0; y < ROWNO; y++) {
706 /* map column 0, levl[0][], is off the left edge of the screen;
707 it should always have terrain type "undiggable stone" */
708 for (x = 1; x < COLNO; x++) {
709 terrain = levl[x][y].typ;
710 /* assumes there aren't more than 10+26+26 terrain types */
711 row[x - 1] = (char) ((terrain == STONE && !may_dig(x, y))
712 ? '*'
713 : (terrain < 10)
714 ? '0' + terrain
715 : (terrain < 36)
716 ? 'a' + terrain - 10
717 : 'A' + terrain - 36);
718 }
719 x--;
720 if (levl[0][y].typ != STONE || may_dig(0, y))
721 row[x++] = '!';
722 row[x] = '\0';
723 putstr(win, 0, row);
724 }
725
726 {
727 char dsc[COLBUFSZ];
728 s_level *slev = Is_special(&u.uz);
729
730 Sprintf(dsc, "D:%d,L:%d", u.uz.dnum, u.uz.dlevel);
731 /* [dungeon branch features currently omitted] */
732 /* special level features */
733 if (slev) {
734 Sprintf(eos(dsc), " \"%s\"", slev->proto);
735 /* special level flags (note: dungeon.def doesn't set `maze'
736 or `hell' for any specific levels so those never show up) */
737 if (slev->flags.maze_like)
738 Strcat(dsc, " mazelike");
739 if (slev->flags.hellish)
740 Strcat(dsc, " hellish");
741 if (slev->flags.town)
742 Strcat(dsc, " town");
743 if (slev->flags.rogue_like)
744 Strcat(dsc, " roguelike");
745 /* alignment currently omitted to save space */
746 }
747 /* level features */
748 if (svl.level.flags.nfountains)
749 Sprintf(eos(dsc), " %c:%d", defsyms[S_fountain].sym,

Callers 1

doterrainFunction · 0.85

Calls 6

may_digFunction · 0.85
Is_specialFunction · 0.85
eosFunction · 0.85
Invocation_levFunction · 0.85
On_W_tower_levelFunction · 0.85
strncmpiFunction · 0.70

Tested by

no test coverage detected