context-sensitive invent: corpses

Picking a corpse while looking at inventory issued a menu that had
entry for eating that and if on an altar another one for offering
that.  Picking the eat or offer choice worked as long as there
weren't any other corpses on the ground or altar.  If there were
others, they'd be skipped but you'd get prompted for which item in
inventory to eat or offer instead of operating on the one that was
used to initiate the action.
This commit is contained in:
PatR
2022-04-11 15:02:44 -07:00
parent 4d1caf8e3a
commit 53e10d582d
4 changed files with 19 additions and 8 deletions

View File

@@ -270,7 +270,7 @@ cmdq_add_key(char key)
void
cmdq_add_dir(schar dx, schar dy, schar dz)
{
struct _cmd_queue *tmp = (struct _cmd_queue *)alloc(sizeof(struct _cmd_queue));
struct _cmd_queue *tmp = (struct _cmd_queue *) alloc(sizeof *tmp);
struct _cmd_queue *cq = g.command_queue;
tmp->typ = CMDQ_DIR;
@@ -292,7 +292,7 @@ cmdq_add_dir(schar dx, schar dy, schar dz)
void
cmdq_add_userinput(void)
{
struct _cmd_queue *tmp = (struct _cmd_queue *)alloc(sizeof(struct _cmd_queue));
struct _cmd_queue *tmp = (struct _cmd_queue *) alloc(sizeof *tmp);
struct _cmd_queue *cq = g.command_queue;
tmp->typ = CMDQ_USER_INPUT;
@@ -322,6 +322,13 @@ cmdq_pop(void)
return tmp;
}
/* get the top entry without popping it */
struct _cmd_queue *
cmdq_peek(void)
{
return g.command_queue;
}
/* clear all commands from the command queue */
void
cmdq_clear(void)