OSDN Git Service

Merge branch 'develop' into macos-develop
[hengbandforosx/hengbandosx.git] / src / world / world.h
1 #pragma once
2
3 #include "market/bounty-type-definition.h"
4 #include "player-info/class-types.h"
5 #include "system/angband.h"
6 #include "util/flag-group.h"
7 #include "util/rng-xoshiro.h"
8 #include <tuple>
9
10 constexpr auto MAX_BOUNTY = 20;
11
12 /*!
13  * @brief 世界情報構造体
14  */
15 enum term_color_type : unsigned char;
16 enum class PlayerRaceType;
17 class AngbandWorld {
18 public:
19     AngbandWorld() = default;
20
21     POSITION max_wild_x{}; /*!< Maximum size of the wilderness */
22     POSITION max_wild_y{}; /*!< Maximum size of the wilderness */
23     GAME_TURN game_turn{}; /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
24     GAME_TURN game_turn_limit{}; /*!< game_turnの最大値 / Limit of game_turn */
25     GAME_TURN dungeon_turn{}; /*!< NASTY生成の計算に関わる内部ターン値 / Game turn in dungeon */
26     GAME_TURN dungeon_turn_limit{}; /*!< dungeon_turnの最大値 / Limit of game_turn in dungeon */
27     GAME_TURN arena_start_turn{}; /*!< 闘技場賭博の開始ターン値 */
28     uint32_t start_time{};
29     uint16_t noscore{}; /* Cheating flags */
30     uint16_t total_winner{}; /* Total winner */
31
32     MONSTER_IDX timewalk_m_idx{}; /*!< 現在時間停止を行っているモンスターのID */
33
34     bounty_type bounties[MAX_BOUNTY]{};
35     MonsterRaceId today_mon{}; //!< 実際の日替わり賞金首
36
37     uint32_t play_time{}; /*!< 実プレイ時間 */
38
39     Xoshiro128StarStar rng; //!< Uniform random bit generator for <random>
40
41     uint32_t seed_flavor{}; /* Hack -- consistent object colors */
42     uint32_t seed_town{}; /* Hack -- consistent town layout */
43
44     bool is_loading_now{}; /*!< ロード処理中フラグ...ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
45
46     byte h_ver_major{}; //!< 変愚蛮怒バージョン(メジャー番号) / Hengband version (major ver.)
47     byte h_ver_minor{}; //!< 変愚蛮怒バージョン(マイナー番号) / Hengband version (minor ver.)
48     byte h_ver_patch{}; //!< 変愚蛮怒バージョン(パッチ番号) / Hengband version (patch ver.)
49     byte h_ver_extra{}; //!< 変愚蛮怒バージョン(エクストラ番号) / Hengband version (extra ver.)
50
51     byte sf_extra{}; //!< セーブファイルエンコードキー(XOR)
52
53     uint32_t sf_system{}; //!< OS情報 / OS information
54     uint32_t sf_when{}; //!< 作成日時 / Created Date
55     uint16_t sf_lives{}; //!< このセーブファイルで何人プレイしたか / Number of past "lives" with this file
56     uint16_t sf_saves{}; //!< 現在のプレイで何回セーブしたか / Number of "saves" during this life
57     uint32_t sf_play_time{}; //!< このセーブファイルで遊んだ合計のプレイ時間
58     EnumClassFlagGroup<PlayerClassType> sf_winner{}; //!< このセーブファイルで*勝利*した職業
59     EnumClassFlagGroup<PlayerClassType> sf_retired{}; //!< このセーブファイルで引退した職業
60
61     bool character_generated{}; /* The character exists */
62     bool character_dungeon{}; /* The character has a dungeon */
63     bool character_loaded{}; /* The character was loaded from a savefile */
64     bool character_saved{}; /* The character was just saved to a savefile */
65
66     byte character_icky_depth{}; /* The game is in an icky full screen mode */
67     bool character_xtra{}; /* The game is in an icky startup mode */
68
69     bool creating_savefile{}; /* New savefile is currently created */
70
71     bool wizard{}; /* This world under wizard mode */
72
73     OBJECT_IDX max_o_idx = 1024; /*!< 1フロアに存在可能な最大アイテム数 */
74     MONSTER_IDX max_m_idx = 1024; /*!< 1フロアに存在可能な最大モンスター数 */
75
76     void set_arena(const bool new_status);
77     bool get_arena() const;
78     std::tuple<int, int, int> extract_date_time(PlayerRaceType start_race) const;
79     bool is_daytime() const;
80     void update_playtime();
81     void add_winner_class(PlayerClassType c);
82     void add_retired_class(PlayerClassType c);
83     term_color_type get_birth_class_color(PlayerClassType c) const;
84
85 private:
86     bool is_out_arena = false; // アリーナ外部にいる時だけtrue.
87
88     bool is_winner_class(PlayerClassType c) const;
89     bool is_retired_class(PlayerClassType c) const;
90 };
91
92 extern AngbandWorld *w_ptr;