1 #include "grid/stair.h"
2 #include "dungeon/dungeon.h"
3 #include "dungeon/quest.h"
4 #include "game-option/birth-options.h"
5 #include "floor/cave.h"
7 #include "object-hook/hook-enchant.h"
8 #include "system/floor-type-definition.h"
9 #include "system/object-type-definition.h"
12 * @brief 所定の位置に上り階段か下り階段を配置する / Place an up/down staircase at given location
13 * @param player_ptr プレーヤーへの参照ポインタ
14 * @param y 配置を試みたいマスのY座標
15 * @param x 配置を試みたいマスのX座標
18 void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x)
20 bool up_stairs = TRUE;
21 bool down_stairs = TRUE;
23 floor_type *floor_ptr = player_ptr->current_floor_ptr;
24 g_ptr = &floor_ptr->grid_array[y][x];
25 if (!is_floor_grid(g_ptr) || g_ptr->o_idx)
28 if (!floor_ptr->dun_level)
34 if (floor_ptr->dun_level >= d_info[player_ptr->dungeon_idx].maxdepth)
37 if (quest_number(player_ptr, floor_ptr->dun_level) && (floor_ptr->dun_level > 1))
40 if (down_stairs && up_stairs) {
41 if (randint0(100) < 50)
48 set_cave_feat(floor_ptr, y, x, feat_up_stair);
50 set_cave_feat(floor_ptr, y, x, feat_down_stair);
54 * @brief 指定された座標が地震や階段生成の対象となるマスかを返す。 / Determine if a given location may be "destroyed"
55 * @param player_ptr プレーヤーへの参照ポインタ
58 * @return 各種の変更が可能ならTRUEを返す。
60 * 条件は永久地形でなく、なおかつ該当のマスにアーティファクトが存在しないか、である。英語の旧コメントに反して*破壊*の抑止判定には現在使われていない。
62 bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x)
64 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
65 if (cave_has_flag_grid(g_ptr, FF_PERMANENT))
68 OBJECT_IDX next_o_idx = 0;
69 for (OBJECT_IDX this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) {
71 o_ptr = &floor_ptr->o_list[this_o_idx];
72 next_o_idx = o_ptr->next_o_idx;
73 if (object_is_artifact(o_ptr))