if (!item_tester_okay(owner_ptr, o_ptr, item_selection_ptr->tval) && ((item_selection_ptr->mode & USE_FULL) == 0))
return FALSE;
- item_selection_ptr->tval = 0;
+ item_selection_ptr->tval = TV_NONE;
item_tester_hook = NULL;
command_cmd = 0;
return TRUE;
static bool check_item_tag_inventory(player_type *owner_ptr, item_selection_type *item_selection_ptr, char *prev_tag)
{
if ((!item_selection_ptr->inven || (*item_selection_ptr->cp < 0) || (*item_selection_ptr->cp >= INVEN_PACK))
- && (!item_selection_ptr->equip || (*item_selection_ptr->cp < INVEN_RARM) || (*item_selection_ptr->cp >= INVEN_TOTAL)))
+ && (!item_selection_ptr->equip || (*item_selection_ptr->cp < INVEN_MAIN_HAND) || (*item_selection_ptr->cp >= INVEN_TOTAL)))
return FALSE;
if (*prev_tag && command_cmd) {
- if (!get_tag(owner_ptr, &item_selection_ptr->k, *prev_tag, (*item_selection_ptr->cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, item_selection_ptr->tval)
- || (item_selection_ptr->k < INVEN_RARM)
- ? !item_selection_ptr->inven
- : !item_selection_ptr->equip || !get_item_okay(owner_ptr, item_selection_ptr->k, item_selection_ptr->tval)) {
+
+ bool flag = FALSE;
+ item_use_flag use_flag = (*item_selection_ptr->cp >= INVEN_MAIN_HAND) ? USE_EQUIP : USE_INVEN;
+
+ flag |= !get_tag(owner_ptr, &item_selection_ptr->k, *prev_tag, use_flag, item_selection_ptr->tval);
+ flag |= !get_item_okay(owner_ptr, item_selection_ptr->k, item_selection_ptr->tval);
+
+ if (item_selection_ptr->k < INVEN_MAIN_HAND)
+ flag |= !item_selection_ptr->inven;
+ else
+ flag |= !item_selection_ptr->equip;
+
+ if (flag) {
*prev_tag = '\0';
return FALSE;
}
*item_selection_ptr->cp = item_selection_ptr->k;
- item_selection_ptr->tval = 0;
+ item_selection_ptr->tval = TV_NONE;
item_tester_hook = NULL;
command_cmd = 0;
return TRUE;
if (!get_item_okay(owner_ptr, *item_selection_ptr->cp, item_selection_ptr->tval))
return FALSE;
- item_selection_ptr->tval = 0;
+ item_selection_ptr->tval = TV_NONE;
item_tester_hook = NULL;
command_cmd = 0;
return TRUE;
return FALSE;
if (item_selection_ptr->mode & USE_FORCE && (*item_selection_ptr->cp == INVEN_FORCE)) {
- item_selection_ptr->tval = 0;
+ item_selection_ptr->tval = TV_NONE;
item_tester_hook = NULL;
command_cmd = 0;
return TRUE;
if (!use_menu)
return;
- for (int j = INVEN_RARM; j < INVEN_TOTAL; j++)
- if (select_ring_slot ? is_ring_slot(j)
+ for (int j = INVEN_MAIN_HAND; j < INVEN_TOTAL; j++)
+ if (owner_ptr->select_ring_slot ? is_ring_slot(j)
: item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], item_selection_ptr->tval) || (item_selection_ptr->mode & USE_FULL))
item_selection_ptr->max_equip++;
- if (have_two_handed_weapons(owner_ptr) && !(item_selection_ptr->mode & IGNORE_BOTHHAND_SLOT))
+ if (has_two_handed_weapons(owner_ptr) && !(item_selection_ptr->mode & IGNORE_BOTHHAND_SLOT))
item_selection_ptr->max_equip++;
}
while ((item_selection_ptr->i1 <= item_selection_ptr->i2) && (!get_item_okay(owner_ptr, item_selection_ptr->i2, item_selection_ptr->tval)))
item_selection_ptr->i2--;
- item_selection_ptr->e1 = INVEN_RARM;
+ item_selection_ptr->e1 = INVEN_MAIN_HAND;
item_selection_ptr->e2 = INVEN_TOTAL - 1;
test_equipment(owner_ptr, item_selection_ptr);
while ((item_selection_ptr->e1 <= item_selection_ptr->e2) && (!get_item_okay(owner_ptr, item_selection_ptr->e1, item_selection_ptr->tval)))
while ((item_selection_ptr->e1 <= item_selection_ptr->e2) && (!get_item_okay(owner_ptr, item_selection_ptr->e2, item_selection_ptr->tval)))
item_selection_ptr->e2--;
- if (item_selection_ptr->equip && have_two_handed_weapons(owner_ptr) && !(item_selection_ptr->mode & IGNORE_BOTHHAND_SLOT)) {
- if (have_right_hand_weapon(owner_ptr)) {
- if (item_selection_ptr->e2 < INVEN_LARM)
- item_selection_ptr->e2 = INVEN_LARM;
- } else if (have_left_hand_weapon(owner_ptr))
- item_selection_ptr->e1 = INVEN_RARM;
+ if (item_selection_ptr->equip && has_two_handed_weapons(owner_ptr) && !(item_selection_ptr->mode & IGNORE_BOTHHAND_SLOT)) {
+ if (can_attack_with_main_hand(owner_ptr)) {
+ if (item_selection_ptr->e2 < INVEN_SUB_HAND)
+ item_selection_ptr->e2 = INVEN_SUB_HAND;
+ } else if (can_attack_with_sub_hand(owner_ptr))
+ item_selection_ptr->e1 = INVEN_MAIN_HAND;
}
if (item_selection_ptr->floor) {
item_selection_ptr->toggle = !item_selection_ptr->toggle;
}
- owner_ptr->window |= (PW_INVEN | PW_EQUIP);
+ owner_ptr->window_flags |= (PW_INVEN | PW_EQUIP);
handle_stuff(owner_ptr);
if (!command_wrk) {
if (!command_wrk) {
sprintf(item_selection_ptr->out_val, _("持ち物:", "Inven:"));
if ((item_selection_ptr->i1 <= item_selection_ptr->i2) && !use_menu) {
- sprintf(item_selection_ptr->tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), index_to_label(item_selection_ptr->i1),
+ char tmp_val[80];
+ sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), index_to_label(item_selection_ptr->i1),
index_to_label(item_selection_ptr->i2));
- strcat(item_selection_ptr->out_val, item_selection_ptr->tmp_val);
+ strcat(item_selection_ptr->out_val, tmp_val);
}
if (!command_see && !use_menu)
} else {
sprintf(item_selection_ptr->out_val, _("装備品:", "Equip:"));
if ((item_selection_ptr->e1 <= item_selection_ptr->e2) && !use_menu) {
- sprintf(item_selection_ptr->tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), index_to_label(item_selection_ptr->e1),
+ char tmp_val[80];
+ sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), index_to_label(item_selection_ptr->e1),
index_to_label(item_selection_ptr->e2));
- strcat(item_selection_ptr->out_val, item_selection_ptr->tmp_val);
+ strcat(item_selection_ptr->out_val, tmp_val);
}
if (!command_see && !use_menu)
}
if (item_selection_ptr->allow_floor)
- strcat(item_selection_ptr->out_val, _(" '-'床上,", " - for item_selection_ptr->floor,"));
+ strcat(item_selection_ptr->out_val, _(" '-'床上,", " - for floor,"));
if (item_selection_ptr->mode & USE_FORCE)
strcat(item_selection_ptr->out_val, _(" 'w'練気術,", " w for the Force,"));
continue;
item_selection_ptr->k = 0 - item_selection_ptr->this_o_idx;
- if (other_query_flag && !verify(owner_ptr, _("本当に", "Try"), item_selection_ptr->k) || !get_item_allow(owner_ptr, item_selection_ptr->k))
+ if ((other_query_flag && !verify(owner_ptr, _("本当に", "Try"), item_selection_ptr->k))
+ || !get_item_allow(owner_ptr, item_selection_ptr->k))
continue;
*item_selection_ptr->cp = item_selection_ptr->k;
break;
}
- if ((item_selection_ptr->k < INVEN_RARM) ? !item_selection_ptr->inven : !item_selection_ptr->equip) {
+ if ((item_selection_ptr->k < INVEN_MAIN_HAND) ? !item_selection_ptr->inven : !item_selection_ptr->equip) {
bell();
break;
}
bool not_found = FALSE;
if (!get_tag(owner_ptr, &item_selection_ptr->k, item_selection_ptr->which, command_wrk ? USE_EQUIP : USE_INVEN, item_selection_ptr->tval)) {
not_found = TRUE;
- } else if ((item_selection_ptr->k < INVEN_RARM) ? !item_selection_ptr->inven : !item_selection_ptr->equip) {
+ } else if ((item_selection_ptr->k < INVEN_MAIN_HAND) ? !item_selection_ptr->inven : !item_selection_ptr->equip) {
not_found = TRUE;
} else if (!get_item_okay(owner_ptr, item_selection_ptr->k, item_selection_ptr->tval)) {
not_found = TRUE;
command_see = FALSE;
}
- item_selection_ptr->tval = 0;
+ item_selection_ptr->tval = TV_NONE;
item_tester_hook = NULL;
if (item_selection_ptr->toggle)
toggle_inventory_equipment(owner_ptr);
- owner_ptr->window |= (PW_INVEN | PW_EQUIP);
+ owner_ptr->window_flags |= (PW_INVEN | PW_EQUIP);
handle_stuff(owner_ptr);
prt("", 0, 0);
if (item_selection_ptr->oops && str)