#include "util.h"
#include "cmd-activate.h"
+#include "cmd-item.h"
#include "cmd-basic.h"
#include "floor.h"
#include "object-hook.h"
object_type *o_ptr;
bool success;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &user_ptr->inventory_list[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
-
+ o_ptr = REF_ITEM(user_ptr, current_floor_ptr, item);
take_turn(user_ptr, 100);
-
lev = k_info[o_ptr->k_idx].level;
/* Hack -- use artifact level instead */
(void)set_food(creature_ptr, creature_ptr->food + o_ptr->pval);
}
- /* Destroy a food in the pack */
if (item >= 0)
{
inven_item_increase(item, -1);
inven_item_describe(item);
inven_item_optimize(item);
}
-
- /* Destroy a food on the floor */
else
{
floor_item_increase(0 - item, -1);
set_action(creature_ptr, ACTION_NONE);
}
- /* Restrict choices to food */
item_tester_hook = item_tester_hook_eatable;
q = _("どれを食べますか? ", "Eat which item? ");
if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;
- /* Eat the object */
exe_eat_food(creature_ptr, item);
}
/* 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);