-#pragma once
+#pragma once
-#include "player/player-class-types.h"
+#include "market/bounty-type-definition.h"
+#include "player-info/class-types.h"
#include "system/angband.h"
#include "util/flag-group.h"
+#include "util/rng-xoshiro.h"
+#include <tuple>
-#define MAX_BOUNTY 20
+constexpr auto MAX_BOUNTY = 20;
/*!
* @brief 世界情報構造体
*/
-struct world_type {
+enum term_color_type : unsigned char;
+enum class PlayerRaceType;
+class AngbandWorld {
+public:
+ AngbandWorld() = default;
POSITION max_wild_x{}; /*!< Maximum size of the wilderness */
POSITION max_wild_y{}; /*!< Maximum size of the wilderness */
GAME_TURN dungeon_turn{}; /*!< NASTY生成の計算に関わる内部ターン値 / Game turn in dungeon */
GAME_TURN dungeon_turn_limit{}; /*!< dungeon_turnの最大値 / Limit of game_turn in dungeon */
GAME_TURN arena_start_turn{}; /*!< 闘技場賭博の開始ターン値 */
- u32b start_time{};
- u16b noscore{}; /* Cheating flags */
- u16b total_winner{}; /* Total winner */
+ uint32_t start_time{};
+ uint16_t noscore{}; /* Cheating flags */
+ uint16_t total_winner{}; /* Total winner */
MONSTER_IDX timewalk_m_idx{}; /*!< 現在時間停止を行っているモンスターのID */
- MONRACE_IDX bounty_r_idx[MAX_BOUNTY]{};
- MONSTER_IDX today_mon{}; //!< 実際の日替わり賞金首
+ bounty_type bounties[MAX_BOUNTY]{};
+ MonsterRaceId today_mon{}; //!< 実際の日替わり賞金首
- u32b play_time{}; /*!< 実プレイ時間 */
+ uint32_t play_time{}; /*!< 実プレイ時間 */
- u32b seed_flavor{}; /* Hack -- consistent object colors */
- u32b seed_town{}; /* Hack -- consistent town layout */
+ Xoshiro128StarStar rng; //!< Uniform random bit generator for <random>
+
+ uint32_t seed_flavor{}; /* Hack -- consistent object colors */
+ uint32_t seed_town{}; /* Hack -- consistent town layout */
bool is_loading_now{}; /*!< ロード処理中フラグ...ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */
byte sf_extra{}; //!< セーブファイルエンコードキー(XOR)
- u32b sf_system{}; //!< OS情報 / OS information
- u32b sf_when{}; //!< 作成日時 / Created Date
- u16b sf_lives{}; //!< このセーブファイルで何人プレイしたか / Number of past "lives" with this file
- u16b sf_saves{}; //!< 現在のプレイで何回セーブしたか / Number of "saves" during this life
- u32b sf_play_time{}; //!< このセーブファイルで遊んだ合計のプレイ時間
- FlagGroup<player_class_type, MAX_CLASS> sf_winner{}; //!< このセーブファイルで*勝利*した職業
- FlagGroup<player_class_type, MAX_CLASS> sf_retired{}; //!< このセーブファイルで引退した職業
+ uint32_t sf_system{}; //!< OS情報 / OS information
+ uint32_t sf_when{}; //!< 作成日時 / Created Date
+ uint16_t sf_lives{}; //!< このセーブファイルで何人プレイしたか / Number of past "lives" with this file
+ uint16_t sf_saves{}; //!< 現在のプレイで何回セーブしたか / Number of "saves" during this life
+ uint32_t sf_play_time{}; //!< このセーブファイルで遊んだ合計のプレイ時間
+ EnumClassFlagGroup<PlayerClassType> sf_winner{}; //!< このセーブファイルで*勝利*した職業
+ EnumClassFlagGroup<PlayerClassType> sf_retired{}; //!< このセーブファイルで引退した職業
bool character_generated{}; /* The character exists */
bool character_dungeon{}; /* The character has a dungeon */
bool wizard{}; /* This world under wizard mode */
- OBJECT_IDX max_o_idx{}; /*!< Maximum number of objects in the level */
- MONSTER_IDX max_m_idx{}; /*!< Maximum number of monsters in the level */
+ OBJECT_IDX max_o_idx = 1024; /*!< 1フロアに存在可能な最大アイテム数 */
+ MONSTER_IDX max_m_idx = 1024; /*!< 1フロアに存在可能な最大モンスター数 */
- DUNGEON_IDX max_d_idx{};
-};
+ void set_arena(const bool new_status);
+ bool get_arena() const;
+ std::tuple<int, int, int> extract_date_time(PlayerRaceType start_race) const;
+ bool is_daytime() const;
+ void update_playtime();
+ void add_winner_class(PlayerClassType c);
+ void add_retired_class(PlayerClassType c);
+ term_color_type get_birth_class_color(PlayerClassType c) const;
-extern world_type *current_world_ptr;
+private:
+ bool is_out_arena = false; // アリーナ外部にいる時だけtrue.
+
+ bool is_winner_class(PlayerClassType c) const;
+ bool is_retired_class(PlayerClassType c) const;
+};
-typedef struct player_type player_type;
-bool is_daytime(void);
-void extract_day_hour_min(player_type *player_ptr, int *day, int *hour, int *min);
-void update_playtime(void);
-void add_winner_class(player_class_type c);
-void add_retired_class(player_class_type c);
-bool is_winner_class(player_class_type c);
-bool is_retired_class(player_class_type c);
+extern AngbandWorld *w_ptr;