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

Function there_cmd_menu_self

src/cmd.c:4434–4520  ·  view source on GitHub ↗

command menu entries when targeting self */

Source from the content-addressed store, hash-verified

4432
4433/* command menu entries when targeting self */
4434staticfn int
4435there_cmd_menu_self(winid win, coordxy x, coordxy y, int *act UNUSED)
4436{
4437 int K = 0;
4438 char buf[BUFSZ];
4439 schar typ = levl[x][y].typ;
4440 stairway *stway = stairway_at(x, y);
4441 struct trap *ttmp;
4442
4443 if (!u_at(x, y))
4444 return K;
4445
4446 if ((IS_FOUNTAIN(typ) || IS_SINK(typ)) && can_reach_floor(FALSE)) {
4447 Sprintf(buf, "Drink from the %s",
4448 defsyms[IS_FOUNTAIN(typ) ? S_fountain : S_sink].explanation);
4449 mcmd_addmenu(win, MCMD_QUAFF, buf), ++K;
4450 }
4451 if (IS_FOUNTAIN(typ) && can_reach_floor(FALSE))
4452 mcmd_addmenu(win, MCMD_DIP, "Dip something into the fountain"), ++K;
4453 if (IS_THRONE(typ))
4454 mcmd_addmenu(win, MCMD_SIT, "Sit on the throne"), ++K;
4455 if (IS_ALTAR(typ))
4456 mcmd_addmenu(win, MCMD_OFFER, "Sacrifice something on the altar"), ++K;
4457
4458 if (stway && stway->up) {
4459 Sprintf(buf, "Go up the %s",
4460 stway->isladder ? "ladder" : "stairs");
4461 mcmd_addmenu(win, MCMD_UP, buf), ++K;
4462 }
4463 if (stway && !stway->up) {
4464 Sprintf(buf, "Go down the %s",
4465 stway->isladder ? "ladder" : "stairs");
4466 mcmd_addmenu(win, MCMD_DOWN, buf), ++K;
4467 }
4468 if (u.usteed) { /* another movement choice */
4469 Sprintf(buf, "Dismount %s",
4470 x_monnam(u.usteed, ARTICLE_THE, (char *) 0,
4471 SUPPRESS_SADDLE, FALSE));
4472 mcmd_addmenu(win, MCMD_DISMOUNT, buf), ++K;
4473 }
4474
4475#if 0
4476 if (Upolyd) { /* before objects */
4477 Sprintf(buf, "Use %s special ability",
4478 s_suffix(pmname(&mons[u.umonnum], Ugender)));
4479 mcmd_addmenu(win, MCMD_MONABILITY, buf), ++K;
4480 }
4481#endif
4482
4483 if (OBJ_AT(x, y)) {
4484 struct obj *otmp = svl.level.objects[x][y];
4485
4486 Sprintf(buf, "Pick up %s", otmp->nexthere ? "items" : doname(otmp));
4487 mcmd_addmenu(win, MCMD_PICKUP, buf), ++K;
4488
4489 if (Is_container(otmp)) {
4490 Sprintf(buf, "Loot %s", doname(otmp));
4491 mcmd_addmenu(win, MCMD_LOOT, buf), ++K;

Callers 1

there_cmd_menuFunction · 0.85

Calls 8

stairway_atFunction · 0.85
can_reach_floorFunction · 0.85
mcmd_addmenuFunction · 0.85
s_suffixFunction · 0.85
pmnameFunction · 0.85
donameFunction · 0.85
num_spellsFunction · 0.85
t_atFunction · 0.85

Tested by

no test coverage detected