Add "user canceled" as extended command return value
Instead of returning ECMD_OK, the commands now return ECMD_CANCEL when user declined to pick a direction or an object to act on. Note that this can be ORed with ECMD_TIME, if the command still took a turn. For now this has no gameplay meaning.
This commit is contained in:
@@ -3606,6 +3606,11 @@ rhack(char *cmd)
|
||||
set_occupation(func, tlist->f_text, g.multi);
|
||||
res = (*func)(); /* perform the command */
|
||||
}
|
||||
if ((res & ECMD_CANCEL)) {
|
||||
/* command was canceled by user, maybe they declined to
|
||||
pick an object to act on. */
|
||||
cmdq_clear();
|
||||
}
|
||||
if (!(res & ECMD_TIME)) {
|
||||
g.context.move = FALSE;
|
||||
g.multi = 0;
|
||||
@@ -4042,7 +4047,7 @@ dotherecmdmenu(void)
|
||||
char ch;
|
||||
|
||||
if (!getdir((const char *) 0) || !isok(u.ux + u.dx, u.uy + u.dy))
|
||||
return ECMD_OK;
|
||||
return ECMD_CANCEL;
|
||||
|
||||
if (u.dx || u.dy)
|
||||
ch = there_cmd_menu(TRUE, u.ux + u.dx, u.uy + u.dy);
|
||||
|
||||
Reference in New Issue
Block a user