Thread: Throw vs Fire
View Single Post
Old January 27, 2020, 19:40   #9
Join Date: Dec 2019
Location: Mexico, undisclosed location
Posts: 79
eastwind is on a distinguished road
I debugged into this to see what was going on with the inscription part of it.

do_cmd_throw() in player-attack.c is not setting player->upkeep->command_wrk, so it is zero when textui_get_item() in ui-object.c is called, and is still zero at line 1310 of ui-object.c where the choice is made of which list to display. The code is slightly weird at that point (because each of those cases is setting something that it has just determined is already set and thus doing nothing).

	if (allow_inven || allow_equip || allow_quiver || allow_floor) {
		/* Start where requested if possible */
		if ((player->upkeep->command_wrk == USE_EQUIP) && allow_equip)
			player->upkeep->command_wrk = USE_EQUIP;
		else if ((player->upkeep->command_wrk == USE_INVEN) && allow_inven)
			player->upkeep->command_wrk = USE_INVEN;
		else if ((player->upkeep->command_wrk == USE_QUIVER) && allow_quiver)
			player->upkeep->command_wrk = USE_QUIVER;
		else if ((player->upkeep->command_wrk == USE_FLOOR) && allow_floor)
			player->upkeep->command_wrk = USE_FLOOR;

		/* If we are obviously using the quiver then start on quiver */
		else if (quiver_tags && allow_quiver)
			player->upkeep->command_wrk = USE_QUIVER;
The code falls into the final case and sets USE_QUIVER.

The quiver is special, in that it picks items with numbers rather than letters. The numbers 0-9 are menu choices, so v0 causes the first item in the quiver to be used, without consideration of inscriptions. This is forced by passing in QUIVER_TAGS in the mode bitfield.

I think the @f0 inscription only works because of a hack: when you inscribe something with @f0 it rearranges the quiver at that time to put that item in slot 0 - rather than the inscription causing the item to be picked at picking time.

I am testing changing two lines in do_cmd_throw(). One line sets player->upkeep->command_wrk to USE_INVEN so that 'v' defaults to presenting the inventory first, and the other is to remove the QUIVER_TAGS flag from the call to cmd_get_item() so that v0 is interpreted as an inscription reference.
eastwind is offline   Reply With Quote