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

Function doterrain

src/cmd.c:1097–1191  ·  view source on GitHub ↗

#terrain command -- show known map, inspired by crawl's '|' command */

Source from the content-addressed store, hash-verified

1095
1096/* #terrain command -- show known map, inspired by crawl's '|' command */
1097staticfn int
1098doterrain(void)
1099{
1100 winid men;
1101 menu_item *sel;
1102 anything any;
1103 int n;
1104 int which;
1105 int clr = NO_COLOR;
1106
1107 /* this used to be done each time vision was recalculated, so would
1108 always be up to date (hopefully); now we do it on demand instead */
1109 recalc_mapseen();
1110
1111 /*
1112 * normal play: choose between known map without mons, obj, and traps
1113 * (to see underlying terrain only), or
1114 * known map without mons and objs (to see traps under mons and objs), or
1115 * known map without mons (to see objects under monsters);
1116 * explore mode: normal choices plus full map (w/o mons, objs, traps);
1117 * wizard mode: normal and explore choices plus
1118 * a dump of the internal levl[][].typ codes w/ level flags, or
1119 * a legend for the levl[][].typ codes dump
1120 */
1121 men = create_nhwindow(NHW_MENU);
1122 start_menu(men, MENU_BEHAVE_STANDARD);
1123 any = cg.zeroany;
1124 any.a_int = 1;
1125 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
1126 "known map without monsters, objects, and traps",
1127 MENU_ITEMFLAGS_SELECTED);
1128 any.a_int = 2;
1129 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
1130 clr, "known map without monsters and objects",
1131 MENU_ITEMFLAGS_NONE);
1132 any.a_int = 3;
1133 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
1134 clr, "known map without monsters",
1135 MENU_ITEMFLAGS_NONE);
1136 if (discover || wizard) {
1137 any.a_int = 4;
1138 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
1139 clr, "full map without monsters, objects, and traps",
1140 MENU_ITEMFLAGS_NONE);
1141 if (wizard) {
1142 any.a_int = 5;
1143 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
1144 clr, "internal levl[][].typ codes in base-36",
1145 MENU_ITEMFLAGS_NONE);
1146 any.a_int = 6;
1147 add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
1148 clr, "legend of base-36 levl[][].typ codes",
1149 MENU_ITEMFLAGS_NONE);
1150 }
1151 }
1152 end_menu(men, "View which?");
1153
1154 n = select_menu(men, PICK_ONE, &sel);

Callers

nothing calls this directly

Calls 6

recalc_mapseenFunction · 0.85
add_menuFunction · 0.85
select_menuFunction · 0.85
reveal_terrainFunction · 0.85
wiz_map_levltypFunction · 0.85
wiz_levltyp_legendFunction · 0.85

Tested by

no test coverage detected