OSDN Git Service

[Refactor] #40399 Moved floor_increase() and floor_optimize() from object2.c/h to...
authorHourier <hourier@users.sourceforge.jp>
Tue, 2 Jun 2020 08:52:21 +0000 (17:52 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 2 Jun 2020 13:23:22 +0000 (22:23 +0900)
src/birth/inventory-initializer.c
src/cmd-item/cmd-item.c
src/cmd/cmd-basic.c
src/floor/floor-object.c
src/floor/floor-object.h
src/inventory/inventory-object.c
src/object/object2.c
src/object/object2.h
src/spell/spells3.c

index bbf0332..4352455 100644 (file)
@@ -1,6 +1,7 @@
 #include "birth/inventory-initializer.h"
 #include "autopick/autopick.h"
 #include "birth/initial-equipments-table.h"
+#include "floor/floor-object.h"
 #include "inventory/inventory-object.h"
 #include "monster/monster-race-hook.h"
 #include "object/item-apply-magic.h"
index bf144b6..a8704bd 100644 (file)
@@ -25,6 +25,7 @@
 #include "core/sort.h"
 #include "core/stuff-handler.h"
 #include "dungeon/quest.h"
+#include "floor/floor-object.h"
 #include "inventory/inventory-object.h"
 #include "inventory/player-inventory.h"
 #include "io/targeting.h"
index 1a77b5e..37132d9 100644 (file)
@@ -22,6 +22,7 @@
 #include "dungeon/dungeon.h"
 #include "dungeon/quest.h"
 #include "effect/spells-effect-util.h"
+#include "floor/floor-object.h"
 #include "floor/geometry.h"
 #include "floor/wild.h"
 #include "grid/grid.h"
index f1282f2..1b3fe07 100644 (file)
@@ -166,3 +166,42 @@ void delete_all_items_from_floor(player_type *player_ptr, POSITION y, POSITION x
     g_ptr->o_idx = 0;
     lite_spot(player_ptr, y, x);
 }
+
+/*!
+ * @brief 床上のアイテムの数を増やす /
+ * Increase the "number" of an item on the floor
+ * @param floo_ptr 現在フロアへの参照ポインタ
+ * @param item 増やしたいアイテムの所持スロット
+ * @param num 増やしたいアイテムの数
+ * @return なし
+ */
+void floor_item_increase(floor_type *floor_ptr, INVENTORY_IDX item, ITEM_NUMBER num)
+{
+    object_type *o_ptr = &floor_ptr->o_list[item];
+    num += o_ptr->number;
+    if (num > 255)
+        num = 255;
+    else if (num < 0)
+        num = 0;
+
+    num -= o_ptr->number;
+    o_ptr->number += num;
+}
+
+/*!
+ * @brief 床上の数の無くなったアイテムスロットを消去する /
+ * Optimize an item on the floor (destroy "empty" items)
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param item 消去したいアイテムの所持スロット
+ * @return なし
+ */
+void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item)
+{
+    object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[item];
+    if (!o_ptr->k_idx)
+        return;
+    if (o_ptr->number)
+        return;
+
+    delete_object_idx(owner_ptr, item);
+}
index e7bc63c..166ea3e 100644 (file)
@@ -5,3 +5,5 @@
 bool make_object(player_type *owner_ptr, object_type *j_ptr, BIT_FLAGS mode);
 bool make_gold(floor_type *floor_ptr, object_type *j_ptr);
 void delete_all_items_from_floor(player_type *owner_ptr, POSITION y, POSITION x);
+void floor_item_increase(floor_type *floor_ptr, INVENTORY_IDX item, ITEM_NUMBER num);
+void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item);
index 0f18bd4..a7296fe 100644 (file)
@@ -1,4 +1,5 @@
 #include "inventory/inventory-object.h"
+#include "floor/floor-object.h"
 #include "object/object-flavor.h"
 #include "object/object-mark-types.h"
 #include "object/object-value.h"
index aa21edd..af592e2 100644 (file)
@@ -912,7 +912,6 @@ void object_prep(object_type *o_ptr, KIND_OBJECT_IDX k_idx)
 
 
 /*!
- *
  * @brief アイテムのエゴをレア度の重みに合わせてランダムに選択する
  * Choose random ego type
  * @param slot 取得したいエゴの装備部位
@@ -3206,43 +3205,6 @@ void floor_item_describe(player_type *owner_ptr, INVENTORY_IDX item)
 
 
 /*!
- * @brief 床上のアイテムの数を増やす /
- * Increase the "number" of an item on the floor
- * @param floo_ptr 現在フロアへの参照ポインタ
- * @param item 増やしたいアイテムの所持スロット
- * @param num 増やしたいアイテムの数
- * @return なし
- */
-void floor_item_increase(floor_type *floor_ptr, INVENTORY_IDX item, ITEM_NUMBER num)
-{
-       object_type *o_ptr = &floor_ptr->o_list[item];
-       num += o_ptr->number;
-       if (num > 255) num = 255;
-       else if (num < 0) num = 0;
-
-       num -= o_ptr->number;
-       o_ptr->number += num;
-}
-
-
-/*!
- * @brief 床上の数の無くなったアイテムスロットを消去する /
- * Optimize an item on the floor (destroy "empty" items)
- * @param player_ptr プレーヤーへの参照ポインタ
- * @param item 消去したいアイテムの所持スロット
- * @return なし
- */
-void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item)
-{
-       object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[item];
-       if (!o_ptr->k_idx) return;
-       if (o_ptr->number) return;
-
-       delete_object_idx(owner_ptr, item);
-}
-
-
-/*!
  * todo ここのp_ptrだけは抜けない……関数ポインタの嵐でにっちもさっちもいかない
  * @brief アイテムを拾う際にザックから溢れずに済むかを判定する /
  * Check if we have space for an item in the pack without overflow
index 58ede97..82a3f85 100644 (file)
@@ -30,8 +30,6 @@ void apply_magic(player_type *owner_type, object_type *o_ptr, DEPTH lev, BIT_FLA
 
 OBJECT_IDX drop_near(player_type *owner_type, object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
 void floor_item_charges(floor_type *owner_ptr, INVENTORY_IDX item);
-void floor_item_increase(floor_type *floor_ptr, INVENTORY_IDX item, ITEM_NUMBER num);
-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);
 INVENTORY_IDX inven_takeoff(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER amt);
index 827cc30..3b990ba 100644 (file)
@@ -23,6 +23,7 @@
 #include "dungeon/quest.h"
 #include "effect/effect-characteristics.h"
 #include "effect/spells-effect-util.h"
+#include "floor/floor-object.h"
 #include "floor/floor-save.h"
 #include "floor/floor-town.h"
 #include "floor/wild.h"