#include "cmd-item/cmd-usestaff.h"
#include "cmd/cmd-basic.h"
#include "floor/floor.h"
+#include "inventory/inventory-object.h"
#include "inventory/player-inventory.h"
#include "main/sound-definitions-table.h"
#include "object/item-use-flags.h"
#include "combat/attack-chaos-effect.h"
#include "monster/monster-status.h"
+#include "inventory/inventory-object.h"
#include "object/artifact.h"
#include "object/object2.h"
#include "object/object-flavor.h"
#include "inventory/inventory-object.h"
#include "object/object-flavor.h"
+#include "object/object-mark-types.h"
#include "object/object-value.h"
#include "object/object2.h" // 暫定、相互参照している.
#include "player/player-effects.h" // 暫定、相互参照している.
if (flag)
msg_print(_("ザックの中のアイテムを並べ直した。", "You reorder some items in your pack."));
}
+
+/*!
+ * @brief オブジェクトをプレイヤーが拾って所持スロットに納めるメインルーチン /
+ * Add an item to the players inventory, and return the slot used.
+ * @param o_ptr 拾うオブジェクトの構造体参照ポインタ
+ * @return 収められた所持スロットのID、拾うことができなかった場合-1を返す。
+ * @details
+ * If the new item can combine with an existing item in the inventory,\n
+ * it will do so, using "object_similar()" and "object_absorb()", else,\n
+ * the item will be placed into the "proper" location in the inventory.\n
+ *\n
+ * This function can be used to "over-fill" the player's pack, but only\n
+ * once, and such an action must trigger the "overflow" code immediately.\n
+ * Note that when the pack is being "over-filled", the new item must be\n
+ * placed into the "overflow" slot, and the "overflow" must take place\n
+ * before the pack is reordered, but (optionally) after the pack is\n
+ * combined. This may be tricky. See "dungeon.c" for info.\n
+ *\n
+ * Note that this code must remove any location/stack information\n
+ * from the object once it is placed into the inventory.\n
+ */
+s16b inven_carry(player_type *owner_ptr, object_type *o_ptr)
+{
+ INVENTORY_IDX i, j, k;
+ INVENTORY_IDX n = -1;
+
+ object_type *j_ptr;
+ for (j = 0; j < INVEN_PACK; j++) {
+ j_ptr = &owner_ptr->inventory_list[j];
+ if (!j_ptr->k_idx)
+ continue;
+
+ n = j;
+ if (object_similar(j_ptr, o_ptr)) {
+ object_absorb(j_ptr, o_ptr);
+
+ owner_ptr->total_weight += (o_ptr->number * o_ptr->weight);
+ owner_ptr->update |= (PU_BONUS);
+ owner_ptr->window |= (PW_INVEN);
+ return (j);
+ }
+ }
+
+ if (owner_ptr->inven_cnt > INVEN_PACK)
+ return -1;
+
+ for (j = 0; j <= INVEN_PACK; j++) {
+ j_ptr = &owner_ptr->inventory_list[j];
+ if (!j_ptr->k_idx)
+ break;
+ }
+
+ i = j;
+ if (i < INVEN_PACK) {
+ s32b o_value = object_value(o_ptr);
+ for (j = 0; j < INVEN_PACK; j++) {
+ if (object_sort_comp(o_ptr, o_value, &owner_ptr->inventory_list[j]))
+ break;
+ }
+
+ i = j;
+ for (k = n; k >= i; k--) {
+ object_copy(&owner_ptr->inventory_list[k + 1], &owner_ptr->inventory_list[k]);
+ }
+
+ object_wipe(&owner_ptr->inventory_list[i]);
+ }
+
+ object_copy(&owner_ptr->inventory_list[i], o_ptr);
+ j_ptr = &owner_ptr->inventory_list[i];
+ j_ptr->next_o_idx = 0;
+ j_ptr->held_m_idx = 0;
+ j_ptr->iy = j_ptr->ix = 0;
+ j_ptr->marked = OM_TOUCHED;
+
+ owner_ptr->total_weight += (j_ptr->number * j_ptr->weight);
+ owner_ptr->inven_cnt++;
+ owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
+ owner_ptr->window |= (PW_INVEN);
+
+ return i;
+}
void drop_from_inventory(player_type *owner_type, INVENTORY_IDX item, ITEM_NUMBER amt);
void combine_pack(player_type *owner_ptr);
void reorder_pack(player_type *owner_ptr);
+s16b inven_carry(player_type *owner_ptr, object_type *o_ptr);
/*!
- * @brief オブジェクトをプレイヤーが拾って所持スロットに納めるメインルーチン /
- * Add an item to the players inventory, and return the slot used.
- * @param o_ptr 拾うオブジェクトの構造体参照ポインタ
- * @return 収められた所持スロットのID、拾うことができなかった場合-1を返す。
- * @details
- * If the new item can combine with an existing item in the inventory,\n
- * it will do so, using "object_similar()" and "object_absorb()", else,\n
- * the item will be placed into the "proper" location in the inventory.\n
- *\n
- * This function can be used to "over-fill" the player's pack, but only\n
- * once, and such an action must trigger the "overflow" code immediately.\n
- * Note that when the pack is being "over-filled", the new item must be\n
- * placed into the "overflow" slot, and the "overflow" must take place\n
- * before the pack is reordered, but (optionally) after the pack is\n
- * combined. This may be tricky. See "dungeon.c" for info.\n
- *\n
- * Note that this code must remove any location/stack information\n
- * from the object once it is placed into the inventory.\n
- */
-s16b inven_carry(player_type *owner_ptr, object_type *o_ptr)
-{
- INVENTORY_IDX i, j, k;
- INVENTORY_IDX n = -1;
-
- object_type *j_ptr;
- for (j = 0; j < INVEN_PACK; j++)
- {
- j_ptr = &owner_ptr->inventory_list[j];
- if (!j_ptr->k_idx) continue;
-
- n = j;
- if (object_similar(j_ptr, o_ptr))
- {
- object_absorb(j_ptr, o_ptr);
-
- owner_ptr->total_weight += (o_ptr->number * o_ptr->weight);
- owner_ptr->update |= (PU_BONUS);
- owner_ptr->window |= (PW_INVEN);
- return (j);
- }
- }
-
- if (owner_ptr->inven_cnt > INVEN_PACK) return -1;
-
- for (j = 0; j <= INVEN_PACK; j++)
- {
- j_ptr = &owner_ptr->inventory_list[j];
- if (!j_ptr->k_idx) break;
- }
-
- i = j;
- if (i < INVEN_PACK)
- {
- s32b o_value = object_value(o_ptr);
- for (j = 0; j < INVEN_PACK; j++)
- {
- if (object_sort_comp(o_ptr, o_value, &owner_ptr->inventory_list[j])) break;
- }
-
- i = j;
- for (k = n; k >= i; k--)
- {
- object_copy(&owner_ptr->inventory_list[k + 1], &owner_ptr->inventory_list[k]);
- }
-
- object_wipe(&owner_ptr->inventory_list[i]);
- }
-
- object_copy(&owner_ptr->inventory_list[i], o_ptr);
- j_ptr = &owner_ptr->inventory_list[i];
- j_ptr->next_o_idx = 0;
- j_ptr->held_m_idx = 0;
- j_ptr->iy = j_ptr->ix = 0;
- j_ptr->marked = OM_TOUCHED;
-
- owner_ptr->total_weight += (j_ptr->number * j_ptr->weight);
- owner_ptr->inven_cnt++;
- owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
- owner_ptr->window |= (PW_INVEN);
-
- return i;
-}
-
-
-/*!
* @brief 装備スロットからオブジェクトを外すメインルーチン /
* Take off (some of) a non-cursed equipment item
* @param owner_ptr プレーヤーへの参照ポインタ
void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item);
bool inven_carry_okay(object_type *o_ptr);
bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr);
-s16b inven_carry(player_type *owner_ptr, object_type *o_ptr);
INVENTORY_IDX inven_takeoff(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER amt);
void floor_item_describe(player_type *player_ptr, INVENTORY_IDX item); // 暫定、元々object2.c の内部からのみ呼ばれていた.
#include "grid/feature.h"
#include "grid/grid.h"
#include "grid/trap.h"
+#include "inventory/inventory-object.h"
#include "inventory/player-inventory.h"
#include "io/targeting.h"
#include "main/sound-definitions-table.h"