OSDN Git Service

[Refactor] #2666 is_teleport_level_ineffective() をFloorType のメソッドcan_teleport_level...
[hengbandforosx/hengbandosx.git] / src / system / floor-type-definition.h
1 #pragma once
2
3 #include "floor/floor-base-definitions.h"
4 #include "monster/monster-timed-effect-types.h"
5 #include "system/angband.h"
6 #include "util/point-2d.h"
7 #include <array>
8 #include <optional>
9 #include <vector>
10
11 /*!
12  * @brief プレイヤー用光源処理配列サイズ / Max array size of player's lite
13  * @details 光源の最大半径は14,実グリッド数では581である.
14  */
15 constexpr auto LITE_MAX = 600;
16
17 /*!
18  * @brief モンスター用光源処理配列サイズ / Max array size of monster's lite
19  * @details 視界の最大半径は20、実際は8角形で1520グリッドである.
20  * モンスターの可視範囲はCAVE_VIEWフラグに依存する.
21  */
22 constexpr auto MON_LITE_MAX = 1536;
23
24 /*!
25  * @brief 視界処理配列サイズ / Max array size of the "view"
26  * @details 視界の最大半径は20、実際は8角形で1520グリッドである.
27  */
28 constexpr auto VIEW_MAX = 1536;
29
30 /*!
31  * @brief 再描画処理用配列サイズ / Max array size of the "redraw"
32  * @details 遅延再描画を適切に機能させるため、最大ビュー領域の 2倍の大きさにする.
33  * ビューグリッド数の最大値は1149なのでその2倍とする.
34  */
35 constexpr auto REDRAW_MAX = 2298;
36
37 enum class QuestId : short;
38 struct dungeon_type;
39 struct grid_type;
40 class MonsterEntity;
41 class ItemEntity;
42 class FloorType {
43 public:
44     FloorType();
45     short dungeon_idx = 0;
46     std::vector<std::vector<grid_type>> grid_array;
47     DEPTH dun_level = 0; /*!< 現在の実ダンジョン階層 base_level の参照元となる / Current dungeon level */
48     DEPTH base_level = 0; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
49     DEPTH object_level = 0; /*!< アイテムの生成レベル、 base_level を起点に一時変更する時に参照 / Current object creation level */
50     DEPTH monster_level = 0; /*!< モンスターの生成レベル、 base_level を起点に一時変更する時に参照 / Current monster creation level */
51     POSITION width = 0; /*!< Current dungeon width */
52     POSITION height = 0; /*!< Current dungeon height */
53     MONSTER_NUMBER num_repro = 0; /*!< Current reproducer count */
54
55     GAME_TURN generated_turn = 0; /* Turn when level began */
56
57     std::vector<ItemEntity> o_list; /*!< The array of dungeon items [max_o_idx] */
58     OBJECT_IDX o_max = 0; /* Number of allocated objects */
59     OBJECT_IDX o_cnt = 0; /* Number of live objects */
60
61     std::vector<MonsterEntity> m_list; /*!< The array of dungeon monsters [max_m_idx] */
62     MONSTER_IDX m_max = 0; /* Number of allocated monsters */
63     MONSTER_IDX m_cnt = 0; /* Number of live monsters */
64
65     std::vector<int16_t> mproc_list[MAX_MTIMED]{}; /*!< The array to process dungeon monsters[max_m_idx] */
66     int16_t mproc_max[MAX_MTIMED]{}; /*!< Number of monsters to be processed */
67
68     POSITION_IDX lite_n = 0; //!< Array of grids lit by player lite
69     std::array<POSITION, LITE_MAX> lite_y{};
70     std::array<POSITION, LITE_MAX> lite_x{};
71
72     POSITION_IDX mon_lite_n = 0; //!< Array of grids lit by player lite
73     std::array<POSITION, MON_LITE_MAX> mon_lite_y{};
74     std::array<POSITION, MON_LITE_MAX> mon_lite_x{};
75
76     POSITION_IDX view_n = 0; //!< Array of grids viewable to the player
77     std::array<POSITION, VIEW_MAX> view_y{};
78     std::array<POSITION, VIEW_MAX> view_x{};
79
80     POSITION_IDX redraw_n = 0; //!< Array of grids for delayed visual updating
81     std::array<POSITION, REDRAW_MAX> redraw_y{};
82     std::array<POSITION, REDRAW_MAX> redraw_x{};
83
84     bool monster_noise = false;
85     QuestId quest_number;
86     bool inside_arena = false; /* Is character inside on_defeat_arena_monster? */
87
88     grid_type &get_grid(const Pos2D pos);
89     const grid_type &get_grid(const Pos2D pos) const;
90     bool is_in_dungeon() const;
91     bool is_in_quest() const;
92     void set_dungeon_index(short dungeon_idx_); /*!< @todo 後でenum class にする */
93     void reset_dungeon_index();
94     dungeon_type &get_dungeon_definition() const;
95     QuestId get_random_quest_id(std::optional<int> level_opt = std::nullopt) const;
96     QuestId get_quest_id(const int bonus = 0) const;
97     bool has_los(const Pos2D pos) const;
98     bool is_special() const;
99     bool can_teleport_level(bool to_player = false) const;
100 };