1 #include "grid/object-placer.h"
2 #include "floor/cave.h"
3 #include "floor/floor-object.h"
5 #include "object-hook/hook-enchant.h"
6 #include "object/object-generator.h"
7 #include "system/artifact-type-definition.h"
8 #include "system/floor-type-definition.h"
9 #include "system/object-type-definition.h"
10 #include "world/world-object.h"
13 * @brief フロアの指定位置に生成階に応じた財宝オブジェクトの生成を行う。
14 * Places a treasure (Gold or Gems) at given location
15 * @param player_ptr プレーヤーへの参照ポインタ
16 * @param y 配置したいフロアのY座標
17 * @param x 配置したいフロアのX座標
18 * @return 生成に成功したらTRUEを返す。
20 * The location must be a legal, clean, floor grid.
22 void place_gold(player_type *player_ptr, POSITION y, POSITION x)
24 floor_type *floor_ptr = player_ptr->current_floor_ptr;
25 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
26 if (!in_bounds(floor_ptr, y, x))
28 if (!cave_drop_bold(floor_ptr, y, x))
37 if (!make_gold(player_ptr, q_ptr))
40 OBJECT_IDX o_idx = o_pop(floor_ptr);
45 o_ptr = &floor_ptr->o_list[o_idx];
46 object_copy(o_ptr, q_ptr);
50 o_ptr->next_o_idx = g_ptr->o_idx;
53 note_spot(player_ptr, y, x);
54 lite_spot(player_ptr, y, x);
58 * @brief フロアの指定位置に生成階に応じたベースアイテムの生成を行う。
59 * Attempt to place an object (normal or good/great) at the given location.
60 * @param owner_ptr プレーヤーへの参照ポインタ
61 * @param y 配置したいフロアのY座標
62 * @param x 配置したいフロアのX座標
63 * @param mode オプションフラグ
64 * @return 生成に成功したらTRUEを返す。
66 * This routine plays nasty games to generate the "special artifacts".\n
67 * This routine uses "object_level" for the "generation level".\n
68 * This routine requires a clean floor grid destination.\n
70 void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode)
72 floor_type *floor_ptr = owner_ptr->current_floor_ptr;
73 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
76 if (!in_bounds(floor_ptr, y, x) || !cave_drop_bold(floor_ptr, y, x) || (g_ptr->o_idx != 0))
81 if (!make_object(owner_ptr, q_ptr, mode))
84 OBJECT_IDX o_idx = o_pop(floor_ptr);
86 if (object_is_fixed_artifact(q_ptr)) {
87 a_info[q_ptr->name1].cur_num = 0;
94 o_ptr = &floor_ptr->o_list[o_idx];
95 object_copy(o_ptr, q_ptr);
99 o_ptr->next_o_idx = g_ptr->o_idx;
101 g_ptr->o_idx = o_idx;
102 note_spot(owner_ptr, y, x);
103 lite_spot(owner_ptr, y, x);