int max_inven = 0;
int max_equip = 0;
+#ifdef ALLOW_REPEAT
+
+ static s16b prev_k_idx = 0;
+
+#endif /* ALLOW_REPEAT */
+
#ifdef ALLOW_EASY_FLOOR /* TNB */
if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
/* Validate the item */
if (item_tester_okay(o_ptr))
{
+ bool allowed = !command_cmd || (prev_k_idx == o_ptr->k_idx);
+
+ if (!allowed)
+ {
+ allowed = get_item_allow(*cp);
+ if (allowed) prev_k_idx = o_ptr->k_idx;
+ }
+
/* Forget the item_tester_tval restriction */
item_tester_tval = 0;
command_cmd = 0; /* Hack -- command_cmd is no longer effective */
- /* Success */
- return (TRUE);
+ /* Success or aborted */
+ return allowed;
}
}
/* Verify the item */
if (get_item_okay(*cp))
{
+ bool allowed = !command_cmd || (prev_k_idx == inventory[*cp].k_idx);
+
+ if (!allowed)
+ {
+ allowed = get_item_allow(*cp);
+ if (allowed) prev_k_idx = inventory[*cp].k_idx;
+ }
+
/* Forget the item_tester_tval restriction */
item_tester_tval = 0;
command_cmd = 0; /* Hack -- command_cmd is no longer effective */
- /* Success */
- return (TRUE);
+ /* Success or aborted */
+ return allowed;
}
}
}
{
#ifdef ALLOW_REPEAT
repeat_push(*cp);
+
+ if (command_cmd)
+ {
+ if (*cp == INVEN_FORCE) prev_k_idx = 0;
+ else if (*cp < 0) prev_k_idx = o_list[0 - (*cp)].k_idx;
+ else prev_k_idx = inventory[*cp].k_idx;
+ }
#endif /* ALLOW_REPEAT */
command_cmd = 0; /* Hack -- command_cmd is no longer effective */
#ifdef ALLOW_REPEAT
+ static s16b prev_k_idx = 0;
+
/* Get the item index */
if (repeat_pull(cp))
{
/* Validate the item */
if (item_tester_okay(o_ptr))
{
+ bool allowed = !command_cmd || (prev_k_idx == o_ptr->k_idx);
+
+ if (!allowed)
+ {
+ allowed = get_item_allow(*cp);
+ if (allowed) prev_k_idx = o_ptr->k_idx;
+ }
+
/* Forget the item_tester_tval restriction */
item_tester_tval = 0;
command_cmd = 0; /* Hack -- command_cmd is no longer effective */
- /* Success */
- return (TRUE);
+ /* Success or aborted */
+ return allowed;
}
}
/* Verify the item */
if (get_item_okay(*cp))
{
+ bool allowed = !command_cmd || (prev_k_idx == inventory[*cp].k_idx);
+
+ if (!allowed)
+ {
+ allowed = get_item_allow(*cp);
+ if (allowed) prev_k_idx = inventory[*cp].k_idx;
+ }
+
/* Forget the item_tester_tval restriction */
item_tester_tval = 0;
command_cmd = 0; /* Hack -- command_cmd is no longer effective */
- /* Success */
- return (TRUE);
+ /* Success or aborted */
+ return allowed;
}
}
}
{
#ifdef ALLOW_REPEAT
repeat_push(*cp);
+
+ if (command_cmd)
+ {
+ if (*cp == INVEN_FORCE) prev_k_idx = 0;
+ else if (*cp < 0) prev_k_idx = o_list[0 - (*cp)].k_idx;
+ else prev_k_idx = inventory[*cp].k_idx;
+ }
#endif /* ALLOW_REPEAT */
command_cmd = 0; /* Hack -- command_cmd is no longer effective */