{
object_type *o_ptr;
- /* Get the item (in the pack) */
- if (item >= 0) o_ptr = &p_ptr->inventory_list[item];
-
- /* Get the item (on the floor) */
- else o_ptr = ¤t_floor_ptr->o_list[0 - item];
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
if (o_ptr->k_idx && (o_ptr->marked & OM_AUTODESTROY))
{
object_type *o_ptr;
int idx;
- /* Get the item (in the pack) */
- if (item >= 0) o_ptr = &p_ptr->inventory_list[item];
-
- /* Get the item (on the floor) */
- else o_ptr = ¤t_floor_ptr->o_list[0 - item];
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
/* Get the index in the auto-pick/destroy list */
idx = is_autopick(o_ptr);
if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
if (hex_spelling_any(creature_ptr)) stop_hex_spell_all();
-
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &creature_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
+ o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item);
sound(SOUND_EAT);
/* cmd3-item.h */
-#define REF_ITEM(P_PTR, FLOOR_PTR, ID) ((ID > 0 ? &(P_PTR)->inventory_list[ID] : &(FLOOR_PTR)->o_list[0 - item]))
-
extern void do_cmd_inven(void);
extern void do_cmd_equip(void);
extern void do_cmd_wield(void);
if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
}
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
q_ptr = &forge;
object_copy(q_ptr, o_ptr);
int k, used_up, ident, lev;
object_type *o_ptr;
-
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
take_turn(p_ptr, 100);
if (cmd_limit_time_walk(p_ptr)) return;
/* Hack -- let staffs of identify get aborted */
bool use_charge = TRUE;
-
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
-
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
/* Mega-Hack -- refuse to use a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
object_kind *k_ptr;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
-
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
/* Mega-Hack -- refuse to zap a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
object_type *o_ptr;
bool old_target_pet = target_pet;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
+ o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
/* Mega-Hack -- refuse to aim a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
#define USE_FULL 0x20 /*!< アイテム表示/選択範囲: 空欄まですべて表示する*/
extern bool can_get_item(OBJECT_TYPE_VALUE tval);
extern bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
+
+#define REF_ITEM(P_PTR, FLOOR_PTR, ID) ((ID > 0 ? &(P_PTR)->inventory_list[ID] : &(FLOOR_PTR)->o_list[0 - item]))
+
extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval);
extern int bow_tval_ammo(object_type *o_ptr);
OBJECT_IDX item;
if (!get_item(&item, q, s, option, tval)) return NULL;
if (idx) *idx = item;
-
if (item == INVEN_FORCE) return NULL;
-
- /* Get the item (in the pack) */
- else if (item >= 0) return &p_ptr->inventory_list[item];
-
- /* Get the item (on the floor) */
- else return ¤t_floor_ptr->o_list[0 - item];
+ return REF_ITEM(p_ptr, current_floor_ptr, item);
}