if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
- o_ptr = ref_item(p_ptr, item);
/* Get the item (in the pack) */
if (item >= 0)
{
#include "angband.h"
#include "player-item.h"
-object_type *ref_item(player_type *player_ptr, INVENTORY_IDX idx)
+/*!
+ * @brief get_item()からのリファクタリング
+ * @return アイテムのポインタ、キャンセルや不能ならNULLを返す。
+ */
+object_type *ref_item(player_type *player_ptr, cptr pmt, cptr str, BIT_FLAGS mode)
{
+ OBJECT_IDX idx;
(player_ptr); // しばらくは未使用
+
+ if(!get_item(&idx, pmt, str, mode)) return NULL;
return idx >= 0 ? &inventory[idx] : &o_list[0 - idx];
}
\ No newline at end of file
-extern object_type *ref_item(player_type *player_ptr, INVENTORY_IDX idx);
+extern object_type *ref_item(player_type *player_ptr, cptr pmt, cptr str, BIT_FLAGS mode);
+