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

Function dotherecmdmenu

src/cmd.c:4342–4375  ·  view source on GitHub ↗

#therecmdmenu command, a way to test there_cmd_menu without mouse */

Source from the content-addressed store, hash-verified

4340
4341/* #therecmdmenu command, a way to test there_cmd_menu without mouse */
4342staticfn int
4343dotherecmdmenu(void)
4344{
4345 char ch;
4346 int dir, click;
4347 coordxy x = gc.clicklook_cc.x;
4348 coordxy y = gc.clicklook_cc.y;
4349
4350 iflags.getdir_click = CLICK_1 | CLICK_2; /* allow 'far' click */
4351
4352 if (isok(x, y)) {
4353 if (x == u.ux && y == u.uy)
4354 ch = here_cmd_menu();
4355 else
4356 ch = there_cmd_menu(x, y, iflags.getdir_click);
4357 gc.clicklook_cc.x = gc.clicklook_cc.y = -1;
4358 iflags.getdir_click = 0;
4359 return (ch && ch != '\033') ? ECMD_TIME : ECMD_OK;
4360 }
4361
4362 dir = getdir((const char *) 0);
4363 click = iflags.getdir_click;
4364 iflags.getdir_click = 0;
4365
4366 if (!dir || !isok(u.ux + u.dx, u.uy + u.dy))
4367 return ECMD_CANCEL;
4368
4369 if (u.dx || u.dy)
4370 ch = there_cmd_menu(u.ux + u.dx, u.uy + u.dy, click);
4371 else
4372 ch = here_cmd_menu();
4373
4374 return (ch && ch != '\033') ? ECMD_TIME : ECMD_OK;
4375}
4376
4377/* commands for [t]herecmdmenu */
4378enum menucmd {

Callers

nothing calls this directly

Calls 4

isokFunction · 0.85
here_cmd_menuFunction · 0.85
there_cmd_menuFunction · 0.85
getdirFunction · 0.85

Tested by

no test coverage detected