context-sensitive dipping

Normally dipping gets the thing to dip first and what to dip it
into second and the item-action handling knows that.  I'm not sure
why that wasn't working as intended and I couldn't figure out how
to make it do that, so went another way:  this adds an internal
extended command that executes an alternate dip routine which gets
the potion to dip into first and the thing to dip into it second.

The #dip command should allow an 'm' prefix to skip fountains and
pools, similar to how eating accepts it to skip food on the floor.
But this doesn't implement that.
This commit is contained in:
PatR
2022-04-12 02:20:40 -07:00
parent 699a25c00b
commit 11543620f9
4 changed files with 54 additions and 13 deletions
+9 -5
View File
@@ -2612,9 +2612,12 @@ itemactions(struct obj *otmp)
} else if (otmp->otyp == POT_OIL && objects[otmp->otyp].oc_name_known) {
Sprintf(buf, "%s this oil", light);
ia_addmenu(win, IA_APPLY_OBJ, 'a', buf);
} else if (otmp->oclass == POTION_CLASS)
ia_addmenu(win, IA_DIP_OBJ, 'a', "Dip something into this potion");
else if (otmp->otyp == EXPENSIVE_CAMERA)
} else if (otmp->oclass == POTION_CLASS) {
/* FIXME? this should probably be moved to 'D' rather than be 'a' */
Sprintf(buf, "Dip something into %s potion%s",
is_plural(otmp) ? "one of these" : "this", plur(otmp->quan));
ia_addmenu(win, IA_DIP_OBJ, 'a', buf);
} else if (otmp->otyp == EXPENSIVE_CAMERA)
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Take a photograph");
else if (otmp->otyp == TOWEL)
ia_addmenu(win, IA_APPLY_OBJ, 'a',
@@ -2825,8 +2828,9 @@ itemactions(struct obj *otmp)
cmdq_add_key(otmp->invlet);
break;
case IA_DIP_OBJ:
cmdq_add_ec(dodip);
cmdq_add_userinput();
/*cmdq_add_ec(dodip);*/
/*cmdq_add_userinput();*/
cmdq_add_ec(dip_into);
cmdq_add_key(otmp->invlet);
break;
case IA_DROP_OBJ: