1 #include "grid/stair.h"
2 #include "dungeon/quest.h"
3 #include "floor/cave.h"
4 #include "game-option/birth-options.h"
5 #include "grid/feature.h"
7 #include "system/dungeon-info.h"
8 #include "system/floor-type-definition.h"
9 #include "system/grid-type-definition.h"
10 #include "system/item-entity.h"
11 #include "system/player-type-definition.h"
12 #include "system/terrain-type-definition.h"
15 * @brief 所定の位置に上り階段か下り階段を配置する / Place an up/down staircase at given location
16 * @param player_ptr プレイヤーへの参照ポインタ
17 * @param y 配置を試みたいマスのY座標
18 * @param x 配置を試みたいマスのX座標
20 void place_random_stairs(PlayerType *player_ptr, POSITION y, POSITION x)
22 bool up_stairs = true;
23 bool down_stairs = true;
24 auto &floor = *player_ptr->current_floor_ptr;
25 const auto *g_ptr = &floor.grid_array[y][x];
26 if (!g_ptr->is_floor() || !g_ptr->o_idx_list.empty()) {
30 if (!floor.dun_level) {
34 if (ironman_downward) {
38 if (floor.dun_level >= dungeons_info[floor.dungeon_idx].maxdepth) {
42 if (inside_quest(quest_number(floor, floor.dun_level)) && (floor.dun_level > 1)) {
46 if (down_stairs && up_stairs) {
47 if (randint0(100) < 50) {
55 set_cave_feat(&floor, y, x, feat_up_stair);
56 } else if (down_stairs) {
57 set_cave_feat(&floor, y, x, feat_down_stair);
62 * @brief 指定された座標が地震や階段生成の対象となるマスかを返す。 / Determine if a given location may be "destroyed"
63 * @param player_ptr プレイヤーへの参照ポインタ
66 * @return 各種の変更が可能ならTRUEを返す。
68 * 条件は永久地形でなく、なおかつ該当のマスにアーティファクトが存在しないか、である。英語の旧コメントに反して*破壊*の抑止判定には現在使われていない。
70 bool cave_valid_bold(FloorType *floor_ptr, POSITION y, POSITION x)
72 auto *g_ptr = &floor_ptr->grid_array[y][x];
73 if (g_ptr->cave_has_flag(TerrainCharacteristics::PERMANENT)) {
77 for (const auto this_o_idx : g_ptr->o_idx_list) {
79 o_ptr = &floor_ptr->o_list[this_o_idx];
80 if (o_ptr->is_fixed_or_random_artifact()) {