static void autopick_delayed_alter_aux(player_type *player_ptr, INVENTORY_IDX item)
{
object_type *o_ptr;
- o_ptr = REF_ITEM(player_ptr, player_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(player_ptr, item);
if (o_ptr->k_idx == 0 || !(o_ptr->marked & OM_AUTODESTROY)) return;
void autopick_alter_item(player_type *player_ptr, INVENTORY_IDX item, bool destroy)
{
object_type *o_ptr;
- o_ptr = REF_ITEM(player_ptr, player_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(player_ptr, item);
int idx = find_autopick_list(player_ptr, o_ptr);
auto_inscribe_item(player_ptr, o_ptr, idx);
if (destroy && item <= INVEN_PACK)
object_type *o_ptr;
bool success;
- o_ptr = REF_ITEM(user_ptr, user_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(user_ptr, item);
take_turn(user_ptr, 100);
lev = k_info[o_ptr->k_idx].level;
if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_ptr, item);
sound(SOUND_EAT);
if (!hex_spelling(creature_ptr, HEX_INHAIL)) stop_hex_spell_all(creature_ptr);
}
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_ptr, item);
q_ptr = &forge;
object_copy(q_ptr, o_ptr);
int k, used_up, ident, lev;
object_type *o_ptr;
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_ptr, item);
take_turn(creature_ptr, 100);
if (cmd_limit_time_walk(creature_ptr)) return;
/* Hack -- let staffs of identify get aborted */
bool use_charge = TRUE;
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_ptr, item);
/* Mega-Hack -- refuse to use a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
object_kind *k_ptr;
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_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;
- o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
+ o_ptr = ref_item(creature_ptr, item);
/* Mega-Hack -- refuse to aim a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
if (!get_item(owner_ptr, &item, q, s, option, tval)) return NULL;
if (idx) *idx = item;
if (item == INVEN_FORCE) return NULL;
- return REF_ITEM(owner_ptr, owner_ptr->current_floor_ptr, item);
+ return ref_item(owner_ptr, item);
}
return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
}
+
+object_type *ref_item(player_type *owner_ptr, INVENTORY_IDX item)
+{
+ floor_type *floor_ptr = owner_ptr->current_floor_ptr;
+ return item >= 0 ? &owner_ptr->inventory_list[item] : &(floor_ptr->o_list[0 - item]);
+}
extern s16b wield_slot(player_type *owner_ptr, object_type *o_ptr);
extern bool check_book_realm(player_type *owner_ptr, const tval_type book_tval, const OBJECT_SUBTYPE_VALUE book_sval);
-
-#define REF_ITEM(P_PTR, FLOOR_PTR, ID) ((ID >= 0 ? &(P_PTR)->inventory_list[ID] : &(FLOOR_PTR)->o_list[0 - item]))
-
+extern object_type *ref_item(player_type *owner_ptr, INVENTORY_IDX item);
extern int bow_tval_ammo(object_type *o_ptr);
/*!