#include "cmd-visual/cmd-draw.h"
#include "core/asking-player.h"
#include "core/player-redraw-types.h"
-#include "core/player-update-types.h"
#include "core/stuff-handler.h"
#include "core/window-redrawer.h"
#include "dungeon/quest.h"
#include "system/item-entity.h"
#include "system/monster-entity.h"
#include "system/player-type-definition.h"
+#include "system/redrawing-flags-updater.h"
#include "system/terrain-type-definition.h"
#include "target/grid-selector.h"
#include "term/screen-processor.h"
const auto &baseitem = baseitems_info[bi_id];
if (baseitem.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
- for (const auto &[a_idx, a_ref] : artifacts_info) {
- if ((a_idx == FixedArtifactId::NONE) || (a_ref.bi_key != baseitem.bi_key)) {
+ for (const auto &[a_idx, artifact] : artifacts_info) {
+ if ((a_idx == FixedArtifactId::NONE) || (artifact.bi_key != baseitem.bi_key)) {
continue;
}
*/
static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
{
- const auto &a_ref = artifacts_info.at(a_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
ItemEntity item;
- item.prep(lookup_baseitem_id(a_ref.bi_key));
+ item.prep(lookup_baseitem_id(artifact.bi_key));
item.fixed_artifact_idx = a_idx;
object_known(&item);
- char buf[MAX_NLEN];
- describe_flavor(player_ptr, buf, &item, OD_NAME_ONLY);
- return buf;
+ return describe_flavor(player_ptr, &item, OD_NAME_ONLY);
}
/**
put_str(ss.str().data(), i + 1, 15);
}
if (page_max > 1) {
- put_str(format("-- more (%d/%d) --", current_page + 1, page_max), page_item_count + 1, 15);
+ put_str(format("-- more (%lu/%lu) --", current_page + 1, page_max), page_item_count + 1, 15);
}
char cmd = ESCAPE;
const auto &[tval_list, name] = group_artifact;
std::vector<FixedArtifactId> a_idx_list;
for (auto tval : tval_list) {
- for (const auto &[a_idx, a_ref] : artifacts_info) {
- if (a_ref.bi_key.tval() == tval) {
+ for (const auto &[a_idx, artifact] : artifacts_info) {
+ if (artifact.bi_key.tval() == tval) {
a_idx_list.push_back(a_idx);
}
}
screen_load();
const auto a_idx = create_a_idx.value();
- const auto it = artifacts_info.find(a_idx);
- if (it == artifacts_info.end()) {
- msg_print("The specified artifact is obsoleted for now.");
- return;
- }
-
- auto &a_ref = it->second;
- if (a_ref.is_generated) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.is_generated) {
msg_print("It's already allocated.");
return;
}
note_spot(player_ptr, y, x);
lite_spot(player_ptr, y, x);
- player_ptr->update |= PU_FLOW;
+ RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::FLOW);
}
/*!
player_ptr->prace = i2enum<PlayerRaceType>(val);
rp_ptr = &race_info[enum2i(player_ptr->prace)];
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ const auto flags_srf = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MP,
+ StatusRedrawingFlag::SPELLS,
+ };
player_ptr->window_flags |= PW_PLAYER;
- player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
- player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
+ rfu.set_flags(flags_srf);
+ player_ptr->redraw |= PR_BASIC | PR_HP | PR_MP | PR_ABILITY_SCORE;
handle_stuff(player_ptr);
}
cp_ptr = &class_info[val];
mp_ptr = &class_magics_info[val];
PlayerClass(player_ptr).init_specific_data();
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ const auto flags_srf = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MP,
+ StatusRedrawingFlag::SPELLS,
+ };
player_ptr->window_flags |= PW_PLAYER;
- player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
- player_ptr->redraw |= PR_BASIC | PR_HP | PR_MANA | PR_STATS;
+ rfu.set_flags(flags_srf);
+ player_ptr->redraw |= PR_BASIC | PR_HP | PR_MP | PR_ABILITY_SCORE;
handle_stuff(player_ptr);
}
player_ptr->realm1 = static_cast<int16_t>(val1);
player_ptr->realm2 = static_cast<int16_t>(val2);
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ const auto flags = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MP,
+ StatusRedrawingFlag::SPELLS,
+ };
player_ptr->window_flags |= PW_PLAYER;
- player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
+ rfu.set_flags(flags);
player_ptr->redraw |= PR_BASIC;
handle_stuff(player_ptr);
}
*/
void wiz_dump_options(void)
{
- char buf[1024];
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "opt_info.txt");
- FILE *fff;
- fff = angband_fopen(buf, "a");
+ const auto &path = path_build(ANGBAND_DIR_USER, "opt_info.txt");
+ const auto &filename = path.string();
+ auto *fff = angband_fopen(path, FileOpenMode::APPEND);
if (fff == nullptr) {
- msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
+ msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename.data());
msg_print(nullptr);
return;
}
}
angband_fclose(fff);
- msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
+ msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), filename.data());
}
/*!
continue;
}
- if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
- GAME_TEXT m_name[MAX_NLEN];
-
- monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+ if (record_named_pet && m_ptr->is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
+ exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name.data());
}
delete_monster_idx(player_ptr, i);
continue;
}
- if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
- GAME_TEXT m_name[MAX_NLEN];
- monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+ if (record_named_pet && m_ptr->is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
+ exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name.data());
}
delete_monster_idx(player_ptr, i);
player_ptr->wild_mode = false;
player_ptr->leaving = true;
-
- exe_write_diary(player_ptr, DIARY_DESCRIPTION, 1, _(" しかし、生き返った。", " but revived."));
+ constexpr auto note = _(" しかし、生き返った。", " but revived.");
+ exe_write_diary(player_ptr, DIARY_DESCRIPTION, 1, note);
leave_floor(player_ptr);
}