-#include "floor/floor-events.h"
+#include "floor/floor-events.h"
#include "cmd-io/cmd-dump.h"
#include "core/disturbance.h"
-#include "core/player-redraw-types.h"
-#include "core/player-update-types.h"
#include "core/window-redrawer.h"
#include "dungeon/dungeon-flag-types.h"
#include "dungeon/quest.h"
#include "sv-definition/sv-amulet-types.h"
#include "sv-definition/sv-protector-types.h"
#include "sv-definition/sv-ring-types.h"
-#include "system/baseitem-info-definition.h"
+#include "system/angband-system.h"
+#include "system/baseitem-info.h"
#include "system/dungeon-info.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
-#include "system/monster-race-definition.h"
-#include "system/monster-type-definition.h"
-#include "system/object-type-definition.h"
+#include "system/item-entity.h"
+#include "system/monster-entity.h"
+#include "system/monster-race-info.h"
#include "system/player-type-definition.h"
+#include "system/redrawing-flags-updater.h"
#include "system/terrain-type-definition.h"
#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
#include "world/world.h"
+static void update_sun_light(PlayerType *player_ptr)
+{
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ static constexpr auto flags_srf = {
+ StatusRecalculatingFlag::MONSTER_STATUSES,
+ StatusRecalculatingFlag::MONSTER_LITE,
+ };
+ rfu.set_flags(flags_srf);
+ rfu.set_flag(MainWindowRedrawingFlag::MAP);
+ static constexpr auto flags = {
+ SubWindowRedrawingFlag::OVERHEAD,
+ SubWindowRedrawingFlag::DUNGEON,
+ };
+ rfu.set_flags(flags);
+ if ((player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].info & CAVE_GLOW) != 0) {
+ set_superstealth(player_ptr, false);
+ }
+}
+
void day_break(PlayerType *player_ptr)
{
msg_print(_("夜が明けた。", "The sun has risen."));
auto *floor_ptr = player_ptr->current_floor_ptr;
- if (!player_ptr->wild_mode) {
- for (POSITION y = 0; y < floor_ptr->height; y++) {
- for (POSITION x = 0; x < floor_ptr->width; x++) {
- auto *g_ptr = &floor_ptr->grid_array[y][x];
- g_ptr->info |= CAVE_GLOW;
- if (view_perma_grids) {
- g_ptr->info |= CAVE_MARK;
- }
+ if (player_ptr->wild_mode) {
+ update_sun_light(player_ptr);
+ return;
+ }
- note_spot(player_ptr, y, x);
+ for (auto y = 0; y < floor_ptr->height; y++) {
+ for (auto x = 0; x < floor_ptr->width; x++) {
+ auto *g_ptr = &floor_ptr->grid_array[y][x];
+ g_ptr->info |= CAVE_GLOW;
+ if (view_perma_grids) {
+ g_ptr->info |= CAVE_MARK;
}
+
+ note_spot(player_ptr, y, x);
}
}
- player_ptr->update |= PU_MONSTERS | PU_MON_LITE;
- player_ptr->redraw |= PR_MAP;
- player_ptr->window_flags |= PW_OVERHEAD | PW_DUNGEON;
- if ((floor_ptr->grid_array[player_ptr->y][player_ptr->x].info & CAVE_GLOW) != 0) {
- set_superstealth(player_ptr, false);
- }
+ update_sun_light(player_ptr);
}
void night_falls(PlayerType *player_ptr)
{
msg_print(_("日が沈んだ。", "The sun has fallen."));
- auto *floor_ptr = player_ptr->current_floor_ptr;
- if (!player_ptr->wild_mode) {
- for (POSITION y = 0; y < floor_ptr->height; y++) {
- for (POSITION x = 0; x < floor_ptr->width; x++) {
- auto *g_ptr = &floor_ptr->grid_array[y][x];
- auto *f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
- if (g_ptr->is_mirror() || f_ptr->flags.has(TerrainCharacteristics::QUEST_ENTER) || f_ptr->flags.has(TerrainCharacteristics::ENTRANCE)) {
- continue;
- }
+ if (player_ptr->wild_mode) {
+ update_sun_light(player_ptr);
+ return;
+ }
- g_ptr->info &= ~(CAVE_GLOW);
- if (f_ptr->flags.has_not(TerrainCharacteristics::REMEMBER)) {
- g_ptr->info &= ~(CAVE_MARK);
- note_spot(player_ptr, y, x);
- }
+ auto &floor = *player_ptr->current_floor_ptr;
+ for (auto y = 0; y < floor.height; y++) {
+ for (auto x = 0; x < floor.width; x++) {
+ const Pos2D pos(y, x);
+ auto &grid = floor.get_grid(pos);
+ const auto &terrain = grid.get_terrain_mimic();
+ using Tc = TerrainCharacteristics;
+ if (grid.is_mirror() || terrain.flags.has(Tc::QUEST_ENTER) || terrain.flags.has(Tc::ENTRANCE)) {
+ continue;
}
- glow_deep_lava_and_bldg(player_ptr);
+ grid.info &= ~(CAVE_GLOW);
+ if (terrain.flags.has_not(Tc::REMEMBER)) {
+ grid.info &= ~(CAVE_MARK);
+ note_spot(player_ptr, y, x);
+ }
}
- }
-
- player_ptr->update |= PU_MONSTERS | PU_MON_LITE;
- player_ptr->redraw |= PR_MAP;
- player_ptr->window_flags |= PW_OVERHEAD | PW_DUNGEON;
- if ((floor_ptr->grid_array[player_ptr->y][player_ptr->x].info & CAVE_GLOW) != 0) {
- set_superstealth(player_ptr, false);
+ glow_deep_lava_and_bldg(player_ptr);
}
+
+ update_sun_light(player_ptr);
}
/*!
continue;
}
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
if (r_ptr->level + 10 > floor_ptr->dun_level) {
delta += (r_ptr->level + 10 - floor_ptr->dun_level) * 2 * base;
delta += (r_ptr->level - floor_ptr->dun_level) * base;
}
- if (r_ptr->flags1 & RF1_FRIENDS) {
+ if (r_ptr->misc_flags.has(MonsterMiscType::HAS_FRIENDS)) {
if (5 <= get_monster_crowd_number(floor_ptr, i)) {
delta += 1;
}
for (MONSTER_IDX i = 1; i < floor_ptr->o_max; i++) {
auto *o_ptr = &floor_ptr->o_list[i];
- auto *k_ptr = &baseitems_info[o_ptr->k_idx];
int delta = 0;
- if (!o_ptr->is_valid() || (o_ptr->is_known() && ((o_ptr->marked & OM_TOUCHED) != 0)) || ((o_ptr->ident & IDENT_SENSE) != 0)) {
+ if (!o_ptr->is_valid() || (o_ptr->is_known() && o_ptr->marked.has(OmType::TOUCHED)) || ((o_ptr->ident & IDENT_SENSE) != 0)) {
continue;
}
if (o_ptr->is_ego()) {
- auto *e_ptr = &egos_info[o_ptr->ego_idx];
- delta += e_ptr->rating * base;
+ const auto &ego = o_ptr->get_ego();
+ delta += ego.rating * base;
}
- if (o_ptr->is_artifact()) {
+ if (o_ptr->is_fixed_or_random_artifact()) {
PRICE cost = object_value_real(o_ptr);
delta += 10 * base;
if (cost > 10000L) {
}
}
- if (o_ptr->tval == ItemKindType::DRAG_ARMOR) {
+ if (o_ptr->bi_key.tval() == ItemKindType::DRAG_ARMOR) {
delta += 30 * base;
}
- if (o_ptr->tval == ItemKindType::SHIELD && o_ptr->sval == SV_DRAGON_SHIELD) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::SHIELD, SV_DRAGON_SHIELD)) {
delta += 5 * base;
}
- if (o_ptr->tval == ItemKindType::GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::GLOVES, SV_SET_OF_DRAGON_GLOVES)) {
delta += 5 * base;
}
- if (o_ptr->tval == ItemKindType::BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::BOOTS, SV_PAIR_OF_DRAGON_GREAVE)) {
delta += 5 * base;
}
- if (o_ptr->tval == ItemKindType::HELM && o_ptr->sval == SV_DRAGON_HELM) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::HELM, SV_DRAGON_HELM)) {
delta += 5 * base;
}
- if (o_ptr->tval == ItemKindType::RING && o_ptr->sval == SV_RING_SPEED && !o_ptr->is_cursed()) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::RING, SV_RING_SPEED) && !o_ptr->is_cursed()) {
delta += 25 * base;
}
- if (o_ptr->tval == ItemKindType::RING && o_ptr->sval == SV_RING_LORDLY && !o_ptr->is_cursed()) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::RING, SV_RING_LORDLY) && !o_ptr->is_cursed()) {
delta += 15 * base;
}
- if (o_ptr->tval == ItemKindType::AMULET && o_ptr->sval == SV_AMULET_THE_MAGI && !o_ptr->is_cursed()) {
+ if (o_ptr->bi_key == BaseitemKey(ItemKindType::AMULET, SV_AMULET_THE_MAGI) && !o_ptr->is_cursed()) {
delta += 15 * base;
}
- if (!o_ptr->is_cursed() && !o_ptr->is_broken() && k_ptr->level > floor_ptr->dun_level) {
- delta += (k_ptr->level - floor_ptr->dun_level) * base;
+ const auto &baseitem = o_ptr->get_baseitem();
+ if (!o_ptr->is_cursed() && !o_ptr->is_broken() && baseitem.level > floor_ptr->dun_level) {
+ delta += (baseitem.level - floor_ptr->dun_level) * base;
}
rating += rating_boost(delta);
*/
void update_dungeon_feeling(PlayerType *player_ptr)
{
- auto *floor_ptr = player_ptr->current_floor_ptr;
- if (!floor_ptr->dun_level) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ if (!floor.dun_level) {
return;
}
- if (player_ptr->phase_out) {
+ if (AngbandSystem::get_instance().is_phase_out()) {
return;
}
- int delay = std::max(10, 150 - player_ptr->skill_fos) * (150 - floor_ptr->dun_level) * TURNS_PER_TICK / 100;
+ int delay = std::max(10, 150 - player_ptr->skill_fos) * (150 - floor.dun_level) * TURNS_PER_TICK / 100;
if (w_ptr->game_turn < player_ptr->feeling_turn + delay && !cheat_xtra) {
return;
}
- auto quest_num = quest_number(player_ptr, floor_ptr->dun_level);
+ auto quest_num = floor.get_quest_id();
const auto &quest_list = QuestList::get_instance();
auto dungeon_quest = (quest_num == QuestId::OBERON);
dungeon_quest |= !(quest_list[quest_num].flags & QUEST_FLAG_PRESET);
auto feeling_quest = inside_quest(quest_num);
- feeling_quest &= quest_type::is_fixed(quest_num);
+ feeling_quest &= QuestType::is_fixed(quest_num);
feeling_quest &= !dungeon_quest;
if (feeling_quest) {
return;
player_ptr->feeling = new_feeling;
do_cmd_feeling(player_ptr);
select_floor_music(player_ptr);
- player_ptr->redraw |= PR_DEPTH;
+ RedrawingFlagsUpdater::get_instance().set_flag(MainWindowRedrawingFlag::DEPTH);
if (disturb_minor) {
disturb(player_ptr, false, false);
}
*/
void glow_deep_lava_and_bldg(PlayerType *player_ptr)
{
- if (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::DARKNESS)) {
+ auto &floor = *player_ptr->current_floor_ptr;
+ if (floor.get_dungeon_definition().flags.has(DungeonFeatureType::DARKNESS)) {
return;
}
- auto *floor_ptr = player_ptr->current_floor_ptr;
- for (POSITION y = 0; y < floor_ptr->height; y++) {
- for (POSITION x = 0; x < floor_ptr->width; x++) {
- grid_type *g_ptr;
- g_ptr = &floor_ptr->grid_array[y][x];
- if (terrains_info[g_ptr->get_feat_mimic()].flags.has_not(TerrainCharacteristics::GLOW)) {
+ for (auto y = 0; y < floor.height; y++) {
+ for (auto x = 0; x < floor.width; x++) {
+ const auto &grid = floor.get_grid({ y, x });
+ if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::GLOW)) {
continue;
}
- for (DIRECTION i = 0; i < 9; i++) {
- POSITION yy = y + ddy_ddd[i];
- POSITION xx = x + ddx_ddd[i];
- if (!in_bounds2(floor_ptr, yy, xx)) {
+ for (auto i = 0; i < 9; i++) {
+ const Pos2D pos(y + ddy_ddd[i], x + ddx_ddd[i]);
+ if (!in_bounds2(&floor, pos.y, pos.x)) {
continue;
}
- floor_ptr->grid_array[yy][xx].info |= CAVE_GLOW;
+ floor.get_grid(pos).info |= CAVE_GLOW;
}
}
}
- player_ptr->update |= PU_VIEW | PU_LITE | PU_MON_LITE;
- player_ptr->redraw |= PR_MAP;
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ static constexpr auto flags_srf = {
+ StatusRecalculatingFlag::VIEW,
+ StatusRecalculatingFlag::LITE,
+ StatusRecalculatingFlag::MONSTER_LITE,
+ };
+ rfu.set_flags(flags_srf);
+ rfu.set_flag(MainWindowRedrawingFlag::MAP);
}
/*
for (int i = 0; i < floor_ptr->view_n; i++) {
POSITION y = floor_ptr->view_y[i];
POSITION x = floor_ptr->view_x[i];
- grid_type *g_ptr;
+ Grid *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
g_ptr->info &= ~(CAVE_VIEW);
}