MCPcopy Create free account
hub / github.com/NetHack/NetHack / tport_menu

Function tport_menu

src/dungeon.c:2203–2236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2201}
2202
2203staticfn void
2204tport_menu(
2205 winid win,
2206 char *entry,
2207 struct lchoice *lchoices,
2208 d_level *lvl_p,
2209 boolean cannotreach)
2210{
2211 char tmpbuf[BUFSZ];
2212 anything any;
2213 int clr = NO_COLOR;
2214
2215 lchoices->lev[lchoices->idx] = lvl_p->dlevel;
2216 lchoices->dgn[lchoices->idx] = lvl_p->dnum;
2217 lchoices->playerlev[lchoices->idx] = depth(lvl_p);
2218 any = cg.zeroany;
2219 if (cannotreach) {
2220 /* not selectable, but still consumes next menuletter;
2221 prepend padding in place of missing menu selector */
2222 Sprintf(tmpbuf, " %s", entry);
2223 entry = tmpbuf;
2224 } else {
2225 any.a_int = lchoices->idx + 1;
2226 }
2227 add_menu(win, &nul_glyphinfo, &any, lchoices->menuletter, 0,
2228 ATR_NONE, clr, entry, MENU_ITEMFLAGS_NONE);
2229 /* this assumes there are at most 52 interesting levels */
2230 if (lchoices->menuletter == 'z')
2231 lchoices->menuletter = 'A';
2232 else
2233 lchoices->menuletter++;
2234 lchoices->idx++;
2235 return;
2236}
2237
2238/* Convert a branch type to a string usable by print_dungeon(). */
2239staticfn const char *

Callers 2

print_branchFunction · 0.85
print_dungeonFunction · 0.85

Calls 2

depthFunction · 0.85
add_menuFunction · 0.85

Tested by

no test coverage detected