corpse safely wielded instead of petrifying the hero
special level loading wasn't honoring gender specified in lua code
add '#tip' for containers to context-sensitive invent handling
+sequencing confusion: picking an item when viewing inventory and picking an
+ action to do with it caused the inventory command to use time, then
+ on next turn the action was performed without taking any time
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support
doextcmd() notifies us what that was via ext_tlist;
other commands leave it Null */
if (g.ext_tlist)
- tlist = g.ext_tlist;
+ tlist = g.ext_tlist, g.ext_tlist = NULL;
- if ((tlist->flags & PREFIXCMD)) {
+ if ((tlist->flags & PREFIXCMD) != 0) {
/* it was a prefix command, mark and get another cmd */
- if ((res & ECMD_CANCEL)) {
+ if ((res & ECMD_CANCEL) != 0) {
/* prefix commands cancel if pressed twice */
reset_cmd_vars(TRUE);
return;
prefix_seen = 0;
was_m_prefix = FALSE;
}
- if ((res & (ECMD_CANCEL|ECMD_FAIL))) {
+ if ((res & (ECMD_CANCEL | ECMD_FAIL)) != 0) {
/* command was canceled by user, maybe they declined to
pick an object to act on, or command failed to finish */
reset_cmd_vars(TRUE);
- prefix_seen = 0;
- cmdq_ec = NULL;
- }
- if (!(res & ECMD_TIME)) {
+ } else if ((res & ECMD_TIME) != 0) {
+ g.context.move = TRUE;
+ } else { /* ECMD_OK */
reset_cmd_vars(FALSE);
- prefix_seen = 0;
- cmdq_ec = NULL;
}
return;
}
iflags.in_parse = TRUE;
g.command_count = 0;
- g.context.move = 1;
+ g.context.move = TRUE; /* assume next command will take game time */
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
g.program_state.getting_a_command = 1; /* affects readchar() behavior for
itemactions(struct obj *otmp)
{
int n, act = IA_NONE;
- int ret = ECMD_TIME;
winid win;
char buf[BUFSZ];
menu_item *selected;
cmdq_add_key(otmp->invlet);
break;
}
- } else
- ret = !n ? ECMD_CANCEL : ECMD_OK; /* cancelled */
+ }
destroy_nhwindow(win);
- return ret;
+ /* finish the 'i' command: no time elapses and cancelling without
+ selecting an action doesn't matter */
+ return ECMD_OK;
}
struct obj *otmp;
char c = display_inventory((char *) 0, TRUE);
- if (!c)
- return ECMD_OK;
- for (otmp = g.invent; otmp; otmp = otmp->nobj)
- if (otmp->invlet == c)
- return itemactions(otmp);
-
+ if (c && c != '\033') {
+ for (otmp = g.invent; otmp; otmp = otmp->nobj)
+ if (otmp->invlet == c)
+ return itemactions(otmp);
+ }
return ECMD_OK;
}