OSDN Git Service

[Refactor] #38997 place_gold() に floor_type * 引数を追加. / Add floor_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:57:22 +0000 (23:57 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:57:22 +0000 (23:57 +0900)
src/floor-generate.c
src/floor.c
src/floor.h
src/grid.c
src/object.h
src/object2.c

index c6be4a6..be739f7 100644 (file)
@@ -374,7 +374,7 @@ static void alloc_object(floor_type *floor_ptr, int set, EFFECT_ID typ, int num)
 
                        case ALLOC_TYP_GOLD:
                        {
-                               place_gold(y, x);
+                               place_gold(floor_ptr, y, x);
                                break;
                        }
 
index 0c55e5c..49a47b4 100644 (file)
@@ -1215,7 +1215,7 @@ void vault_objects(floor_type *floor_ptr, POSITION y, POSITION x, int num)
                        }
                        else
                        {
-                               place_gold(j, k);
+                               place_gold(floor_ptr, j, k);
                        }
 
                        /* Placement accomplished */
@@ -1663,3 +1663,61 @@ void place_object(floor_type *floor_ptr, POSITION y, POSITION x, BIT_FLAGS mode)
        }
 }
 
+
+
+/*!
+ * @brief フロアの指定位置に生成階に応じた財宝オブジェクトの生成を行う。
+ * Places a treasure (Gold or Gems) at given location
+ * @param y 配置したいフロアのY座標
+ * @param x 配置したいフロアのX座標
+ * @return 生成に成功したらTRUEを返す。
+ * @details
+ * The location must be a legal, clean, floor grid.
+ */
+void place_gold(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+       OBJECT_IDX o_idx;
+
+       /* Acquire grid */
+       grid_type *g_ptr = &floor_ptr->grid_array[y][x];
+
+       object_type forge;
+       object_type *q_ptr;
+
+
+       /* Paranoia -- check bounds */
+       if (!in_bounds(floor_ptr, y, x)) return;
+
+       /* Require floor space */
+       if (!cave_drop_bold(floor_ptr, y, x)) return;
+
+       /* Avoid stacking on other objects */
+       if (g_ptr->o_idx) return;
+
+       q_ptr = &forge;
+       object_wipe(q_ptr);
+
+       /* Make some gold */
+       if (!make_gold(q_ptr)) return;
+
+       o_idx = o_pop();
+
+       /* Success */
+       if (o_idx)
+       {
+               object_type *o_ptr;
+               o_ptr = &floor_ptr->o_list[o_idx];
+               object_copy(o_ptr, q_ptr);
+
+               /* Save location */
+               o_ptr->iy = y;
+               o_ptr->ix = x;
+
+               /* Build a stack */
+               o_ptr->next_o_idx = g_ptr->o_idx;
+
+               g_ptr->o_idx = o_idx;
+               note_spot(y, x);
+               lite_spot(y, x);
+       }
+}
index 55f2634..38db90d 100644 (file)
@@ -424,4 +424,4 @@ extern sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITI
 
 extern void set_floor(floor_type *floor_ptr, POSITION x, POSITION y);
 extern void place_object(floor_type *floor_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
-
+extern void place_gold(floor_type *floor_ptr, POSITION y, POSITION x);
index eeba279..93a9f86 100644 (file)
@@ -1062,7 +1062,7 @@ void cave_alter_feat(POSITION y, POSITION x, int action)
                if (have_flag(old_f_ptr->flags, FF_HAS_GOLD) && !have_flag(f_ptr->flags, FF_HAS_GOLD))
                {
                        /* Place some gold */
-                       place_gold(y, x);
+                       place_gold(p_ptr->current_floor_ptr, y, x);
                        found = TRUE;
                }
 
index 09a3259..69a562a 100644 (file)
@@ -485,7 +485,6 @@ extern OBJECT_SUBTYPE_VALUE coin_type;
 
 extern bool make_object(object_type *j_ptr, BIT_FLAGS mode);
 extern bool make_gold(object_type *j_ptr);
-extern void place_gold(POSITION y, POSITION x);
 extern OBJECT_IDX drop_near(object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
 extern void vary_item(INVENTORY_IDX item, ITEM_NUMBER num);
 extern void inven_item_charges(INVENTORY_IDX item);
index d640072..95d7513 100644 (file)
@@ -4350,64 +4350,6 @@ bool make_gold(object_type *j_ptr)
 
 
 /*!
- * @brief フロアの指定位置に生成階に応じた財宝オブジェクトの生成を行う。
- * Places a treasure (Gold or Gems) at given location
- * @param y 配置したいフロアのY座標
- * @param x 配置したいフロアのX座標
- * @return 生成に成功したらTRUEを返す。
- * @details
- * The location must be a legal, clean, floor grid.
- */
-void place_gold(POSITION y, POSITION x)
-{
-       OBJECT_IDX o_idx;
-
-       /* Acquire grid */
-       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
-
-       object_type forge;
-       object_type *q_ptr;
-
-
-       /* Paranoia -- check bounds */
-       if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
-
-       /* Require floor space */
-       if (!cave_drop_bold(p_ptr->current_floor_ptr, y, x)) return;
-
-       /* Avoid stacking on other objects */
-       if (g_ptr->o_idx) return;
-
-       q_ptr = &forge;
-       object_wipe(q_ptr);
-
-       /* Make some gold */
-       if (!make_gold(q_ptr)) return;
-
-       o_idx = o_pop();
-
-       /* Success */
-       if (o_idx)
-       {
-               object_type *o_ptr;
-               o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
-               object_copy(o_ptr, q_ptr);
-
-               /* Save location */
-               o_ptr->iy = y;
-               o_ptr->ix = x;
-
-               /* Build a stack */
-               o_ptr->next_o_idx = g_ptr->o_idx;
-
-               g_ptr->o_idx = o_idx;
-               note_spot(y, x);
-               lite_spot(y, x);
-       }
-}
-
-
-/*!
  * @brief 生成済のオブジェクトをフロアの所定の位置に落とす。
  * Let an object fall to the ground at or near a location.
  * @param j_ptr 落としたいオブジェクト構造体の参照ポインタ