if (can_banish) {
if (record_named_pet && monster.is_named_pet()) {
const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
}
delete_monster_idx(player_ptr, grid.m_idx);
message_add("====================");
message_add(" ");
message_add(" ");
-
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "------- Started New Game -------"));
- exe_write_diary(player_ptr, DiaryKind::DIALY, 0);
+ const auto &floor = *player_ptr->current_floor_ptr;
+ exe_write_diary(floor, DiaryKind::GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "------- Started New Game -------"));
+ exe_write_diary(floor, DiaryKind::DIALY, 0);
const auto mes_sex = format(_("%s性別に%sを選択した。", "%schose %s gender."), indent, sex_info[player_ptr->psex].title);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_sex);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_sex);
const auto mes_race = format(_("%s種族に%sを選択した。", "%schose %s race."), indent, race_info[enum2i(player_ptr->prace)].title);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_race);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_race);
const auto mes_class = format(_("%s職業に%sを選択した。", "%schose %s class."), indent, class_info[enum2i(player_ptr->pclass)].title);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_class);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_class);
if (player_ptr->realm1) {
const auto mes_realm2 = player_ptr->realm2 ? format(_("と%s", " and %s realms"), realm_names[player_ptr->realm2]) : _("", " realm");
const auto mes_realm = format(_("%s魔法の領域に%s%sを選択した。", "%schose %s%s."), indent, realm_names[player_ptr->realm1], mes_realm2.data());
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_realm);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_realm);
}
if (player_ptr->element) {
const auto mes_element = format(_("%s元素系統に%sを選択した。", "%schose %s system."), indent, get_element_title(player_ptr->element));
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_element);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_element);
}
const auto mes_personality = format(_("%s性格に%sを選択した。", "%schose %s personality."), indent, personality_info[player_ptr->ppersonality].title);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_personality);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_personality);
if (PlayerClass(player_ptr).equals(PlayerClassType::CHAOS_WARRIOR)) {
const auto fmt_patron = _("%s守護神%sと契約を交わした。", "%smade a contract with patron %s.");
const auto mes_patron = format(fmt_patron, indent, patron_list[player_ptr->chaos_patron].name.data());
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, mes_patron);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, mes_patron);
}
}
do_cmd_save_game(player_ptr, true);
}
- const auto quest_number = player_ptr->current_floor_ptr->quest_number;
+ const auto quest_number = floor.quest_number;
auto &quest = quests.get_quest(quest_number);
if (inside_quest(quest_number) && quest.type == QuestKindType::RANDOM) {
leave_quest_check(player_ptr);
- player_ptr->current_floor_ptr->quest_number = QuestId::NONE;
+ floor.quest_number = QuestId::NONE;
}
auto up_num = 0;
if (inside_quest(quest_number) && quest.type != QuestKindType::RANDOM) {
leave_quest_check(player_ptr);
- player_ptr->current_floor_ptr->quest_number = i2enum<QuestId>(grid.special);
- player_ptr->current_floor_ptr->dun_level = 0;
+ floor.quest_number = i2enum<QuestId>(grid.special);
+ floor.dun_level = 0;
up_num = 0;
} else {
auto &fcms = FloorChangeModesStore::get_instace();
up_num *= 2;
}
- if (player_ptr->current_floor_ptr->dun_level - up_num < floor.get_dungeon_definition().mindepth) {
- up_num = player_ptr->current_floor_ptr->dun_level;
+ if (floor.dun_level - up_num < floor.get_dungeon_definition().mindepth) {
+ up_num = floor.dun_level;
}
}
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::STAIR, 0 - up_num, _("階段を上った", "climbed up the stairs to"));
+ exe_write_diary(floor, DiaryKind::STAIR, 0 - up_num, _("階段を上った", "climbed up the stairs to"));
}
- if (up_num == player_ptr->current_floor_ptr->dun_level) {
+ if (up_num == floor.dun_level) {
if (is_echizen(player_ptr)) {
msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
} else {
if (record_stair) {
if (fall_trap) {
- exe_write_diary(player_ptr, DiaryKind::STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
+ exe_write_diary(floor, DiaryKind::STAIR, down_num, _("落とし戸に落ちた", "fell through a trap door"));
} else {
- exe_write_diary(player_ptr, DiaryKind::STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
+ exe_write_diary(floor, DiaryKind::STAIR, down_num, _("階段を下りた", "climbed down the stairs to"));
}
}
w_ptr->add_retired_class(player_ptr->pclass);
} else {
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("ダンジョンの探索に絶望して自殺した。", "gave up all hope to commit suicide."));
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
+ const auto &floor = *player_ptr->current_floor_ptr;
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, _("ダンジョンの探索に絶望して自殺した。", "gave up all hope to commit suicide."));
+ exe_write_diary(floor, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
}
player_ptr->died_from = _("途中終了", "Quitting");
if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
if (record_named_pet && monster.is_named()) {
const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
}
if (pet_ctr == player_ptr->riding) {
if (!new_name->empty()) {
m_ptr->nickname = *new_name;
if (record_named_pet) {
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
}
return;
}
if (record_named_pet && old_name) {
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
}
m_ptr->nickname.clear();
constexpr auto fmt_realm = _("魔法の領域を%sから%sに変更した。", "changed magic realm from %s to %s.");
const auto mes = format(fmt_realm, realm_names[player_ptr->realm2], realm_names[next_realm]);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, mes);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::DESCRIPTION, 0, mes);
player_ptr->old_realm |= 1U << (player_ptr->realm2 - 1);
player_ptr->realm2 = next_realm;
*/
static void write_diary_stay_inn(PlayerType *player_ptr, int prev_hour)
{
+ const auto &floor = *player_ptr->current_floor_ptr;
if ((prev_hour >= 6) && (prev_hour < 18)) {
const auto stay_message = _(is_player_undead(player_ptr) ? "宿屋に泊まった。" : "日が暮れるまで宿屋で過ごした。", "stayed during the day at the inn.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, stay_message);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, stay_message);
return;
}
const auto stay_message = _(is_player_undead(player_ptr) ? "夜が明けるまで宿屋で過ごした。" : "宿屋に泊まった。", "stayed overnight at the inn.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, stay_message);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, stay_message);
}
/*!
}
msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare."));
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare."));
return true;
}
*/
static void display_stay_result(PlayerType *player_ptr, int prev_hour)
{
+ const auto &floor = *player_ptr->current_floor_ptr;
if ((prev_hour >= 6) && (prev_hour < 18)) {
#if JP
msg_format("あなたはリフレッシュして目覚め、%sを迎えた。", is_player_undead(player_ptr) ? "夜" : "夕方");
msg_format("You awake refreshed for the %s.", is_player_undead(player_ptr) ? "evening" : "twilight");
#endif
const auto awake_message = _(is_player_undead(player_ptr) ? "すがすがしい夜を迎えた。" : "夕方を迎えた。", "awoke refreshed.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, awake_message);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, awake_message);
return;
}
msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
const auto awake_message = _(is_player_undead(player_ptr) ? "すがすがしい朝を迎えた。" : "朝を迎えた。", "awoke refreshed.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, awake_message);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, awake_message);
}
/*!
pass_game_turn_by_stay();
prevent_turn_overflow(player_ptr);
-
if ((prev_hour >= 18) && (prev_hour <= 23)) {
determine_daily_bounty(player_ptr, false); /* Update daily bounty */
- exe_write_diary(player_ptr, DiaryKind::DIALY, 0);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::DIALY, 0);
}
player_ptr->chp = player_ptr->mhp;
/*!
* @brief 日記に任意の内容を表記するコマンドのメインルーチン /
*/
-static void add_diary_note(PlayerType *player_ptr)
+static void add_diary_note(const FloorType &floor)
{
const auto input_str = input_string(_("内容: ", "diary note: "), 1000);
if (input_str) {
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, *input_str);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, *input_str);
}
}
/*!
* @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
*/
-static void do_cmd_last_get(PlayerType *player_ptr)
+static void do_cmd_last_get(const FloorType &floor)
{
if (record_o_name[0] == '\0') {
return;
GAME_TURN turn_tmp = w_ptr->game_turn;
w_ptr->game_turn = record_turn;
const auto mes = format(_("%sを手に入れた。", "discover %s."), record_o_name);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, mes);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, mes);
w_ptr->game_turn = turn_tmp;
}
{
screen_save();
TermCenteredOffsetSetter tcos(MAIN_TERM_MIN_COLS, MAIN_TERM_MIN_ROWS);
-
+ const auto &floor = *player_ptr->current_floor_ptr;
while (true) {
term_clear();
prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
display_diary(player_ptr);
break;
case '2':
- add_diary_note(player_ptr);
+ add_diary_note(floor);
break;
case '3':
- do_cmd_last_get(player_ptr);
+ do_cmd_last_get(floor);
break;
case '4':
do_cmd_erase_diary();
* Interact with some options for cheating
* @param info 表示メッセージ
*/
-static void do_cmd_options_cheat(PlayerType *player_ptr, concptr info)
+static void do_cmd_options_cheat(const FloorType &floor, std::string_view player_name, std::string_view info)
{
term_clear();
auto k = 0U;
const auto n = cheat_info.size();
while (true) {
- prt(format(_("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info), 0, 0);
+ prt(format(_("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info.data()), 0, 0);
#ifdef JP
/* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
case 'Y':
case '6':
if (!w_ptr->noscore) {
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0,
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0,
_("詐欺オプションをONにして、スコアを残せなくなった。", "gave up sending score to use cheating options."));
}
k = (k + 1) % n;
break;
case '?':
- FileDisplayer(player_ptr->name).display(true, std::string(_("joption.txt#", "option.txt#")).append(cheat_info[k].o_text), 0, 0);
+ FileDisplayer(player_name).display(true, std::string(_("joption.txt#", "option.txt#")).append(cheat_info[k].o_text), 0, 0);
term_clear();
break;
default:
break;
}
- do_cmd_options_cheat(player_ptr, _("詐欺師は決して勝利できない!", "Cheaters never win"));
+ do_cmd_options_cheat(*player_ptr->current_floor_ptr, player_ptr->name, _("詐欺師は決して勝利できない!", "Cheaters never win"));
break;
}
case 'a':
{
player_ptr->playing = false;
player_ptr->leaving = true;
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 0, _("----ゲーム中断----", "--- Saved and Exited Game ---"));
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::GAMESTART, 0, _("----ゲーム中断----", "--- Saved and Exited Game ---"));
}
static void kingly(PlayerType *player_ptr)
{
bool seppuku = streq(player_ptr->died_from, "Seppuku");
- player_ptr->current_floor_ptr->dun_level = 0;
+ auto &floor = *player_ptr->current_floor_ptr;
+ floor.dun_level = 0;
if (!seppuku) {
/* 引退したときの識別文字 */
player_ptr->died_from = _("ripe", "Ripe Old Age");
#endif
if (!seppuku) {
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("ダンジョンの探索から引退した。", "retired exploring dungeons."));
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, _("ダンジョンの探索から引退した。", "retired exploring dungeons."));
+ exe_write_diary(floor, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
}
flush();
{
write_level = false;
constexpr auto mes = _(" ----ゲーム再開----", " --- Restarted Game ---");
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 1, mes);
+ const auto &floor = *player_ptr->current_floor_ptr;
+ exe_write_diary(floor, DiaryKind::GAMESTART, 1, mes);
if (player_ptr->riding != -1) {
return;
}
player_ptr->riding = 0;
- auto *floor_ptr = player_ptr->current_floor_ptr;
- for (short i = floor_ptr->m_max; i > 0; i--) {
- const auto &monster = floor_ptr->m_list[i];
+ for (short i = floor.m_max; i > 0; i--) {
+ const auto &monster = floor.m_list[i];
if (player_ptr->is_located_at({ monster.fy, monster.fx })) {
player_ptr->riding = i;
break;
static void generate_world(PlayerType *player_ptr, bool new_game)
{
reset_world_info(player_ptr);
- auto *floor_ptr = player_ptr->current_floor_ptr;
- panel_row_min = floor_ptr->height;
- panel_col_min = floor_ptr->width;
+ const auto &floor = *player_ptr->current_floor_ptr;
+ panel_row_min = floor.height;
+ panel_col_min = floor.width;
- set_floor_and_wall(floor_ptr->dungeon_idx);
+ set_floor_and_wall(floor.dungeon_idx);
initialize_items_flavor();
prt(_("お待ち下さい...", "Please wait..."), 0, 0);
term_fresh();
}
const auto mes = format(_("%sに降り立った。", "arrived in %s."), map_name(player_ptr).data());
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, mes);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, mes);
}
static void init_io(PlayerType *player_ptr)
if ((max_dlv[floor.dungeon_idx] < floor.dun_level) && !floor.is_in_quest()) {
max_dlv[floor.dungeon_idx] = floor.dun_level;
if (record_maxdepth) {
- exe_write_diary(player_ptr, DiaryKind::MAXDEAPTH, floor.dun_level);
+ exe_write_diary(floor, DiaryKind::MAXDEAPTH, floor.dun_level);
}
}
if (record_named_pet && em_ptr->m_ptr->is_named_pet()) {
const auto m2_name = monster_desc(player_ptr, em_ptr->m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
}
delete_monster_idx(player_ptr, em_ptr->g_ptr->m_idx);
static void place_pet(PlayerType *player_ptr)
{
int max_num = player_ptr->wild_mode ? 1 : MAX_PARTY_MON;
+ auto &floor = *player_ptr->current_floor_ptr;
for (int current_monster = 0; current_monster < max_num; current_monster++) {
POSITION cy = 0;
POSITION cx = 0;
update_monster(player_ptr, m_idx, true);
lite_spot(player_ptr, cy, cx);
if (r_ref.misc_flags.has(MonsterMiscType::MULTIPLY)) {
- player_ptr->current_floor_ptr->num_repro++;
+ floor.num_repro++;
}
} else {
- auto *m_ptr = &party_mon[current_monster];
- auto &r_ref = m_ptr->get_real_monrace();
- msg_format(_("%sとはぐれてしまった。", "You have lost sight of %s."), monster_desc(player_ptr, m_ptr, 0).data());
- if (record_named_pet && m_ptr->is_named()) {
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
+ const auto &monster = party_mon[current_monster];
+ auto &monrace = monster.get_real_monrace();
+ msg_format(_("%sとはぐれてしまった。", "You have lost sight of %s."), monster_desc(player_ptr, &monster, 0).data());
+ if (record_named_pet && monster.is_named()) {
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE));
}
- if (r_ref.cur_num) {
- r_ref.cur_num--;
+ if (monrace.cur_num) {
+ monrace.cur_num--;
}
}
}
return;
}
- for (MONSTER_IDX i = player_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || !m_ptr->is_named_pet() || (player_ptr->riding == i)) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ for (MONSTER_IDX i = floor.m_max - 1; i >= 1; i--) {
+ const auto &monster = floor.m_list[i];
+ if (!monster.is_valid() || !monster.is_named_pet() || (player_ptr->riding == i)) {
continue;
}
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_MOVED, monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE));
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_MOVED, monster_desc(player_ptr, &monster, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE));
}
}
{
auto min_level = 0;
auto max_level = 99;
- auto current_level = static_cast<short>(player_ptr->current_floor_ptr->dun_level);
+ auto &floor = *player_ptr->current_floor_ptr;
+ auto current_level = static_cast<short>(floor.dun_level);
if (input_check(_("他の階にテレポートしますか?", "Teleport level? "))) {
if (ironman_downward) {
min_level = current_level;
}
- const auto &floor = *player_ptr->current_floor_ptr;
if (floor.dungeon_idx == DUNGEON_ANGBAND) {
if (floor.dun_level > 100) {
max_level = MAX_DEPTH - 1;
do_cmd_save_game(player_ptr, true);
}
- player_ptr->current_floor_ptr->dun_level = command_arg;
+ floor.dun_level = command_arg;
leave_quest_check(player_ptr);
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::PAT_TELE, 0);
+ exe_write_diary(floor, DiaryKind::PAT_TELE, 0);
}
player_ptr->current_floor_ptr->quest_number = QuestId::NONE;
void hit_trap(PlayerType *player_ptr, bool break_trap)
{
const Pos2D p_pos(player_ptr->y, player_ptr->x);
- const auto &grid = player_ptr->current_floor_ptr->get_grid(p_pos);
+ const auto &floor = *player_ptr->current_floor_ptr;
+ const auto &grid = floor.get_grid(p_pos);
const auto &terrain = grid.get_terrain();
TrapType trap_feat_type = terrain.flags.has(TerrainCharacteristics::TRAP) ? i2enum<TrapType>(terrain.subtype) : TrapType::NOT_TRAP;
do_cmd_save_game(player_ptr, true);
}
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("落とし戸に落ちた", "fell through a trap door!"));
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, _("落とし戸に落ちた", "fell through a trap door!"));
FloorChangeModesStore::get_instace()->set({ FloorChangeMode::SAVE_FLOORS, FloorChangeMode::DOWN, FloorChangeMode::RANDOM_PLACE, FloorChangeMode::RANDOM_CONNECT });
player_ptr->leaving = true;
}
/*!
* @brief ウィザードモードへの導入処理
* / Verify use of "wizard" mode
- * @param player_ptr プレイヤーへの参照ポインタ
+ * @param floor フロアへの参照
* @return 実際にウィザードモードへ移行したらTRUEを返す。
*/
-bool enter_wizard_mode(PlayerType *player_ptr)
+bool enter_wizard_mode(const FloorType &floor)
{
if (!w_ptr->noscore) {
if (!allow_debug_opts) {
}
constexpr auto mes = _("ウィザードモードに突入してスコアを残せなくなった。", "gave up recording score to enter wizard mode.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, mes);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, mes);
w_ptr->noscore |= 0x0002;
}
* @param player_ptr プレイヤーへの参照ポインタ
* @return 実際にデバッグコマンドへ移行したらTRUEを返す。
*/
-static bool enter_debug_mode(PlayerType *player_ptr)
+static bool enter_debug_mode(const FloorType &floor)
{
if (!w_ptr->noscore) {
if (!allow_debug_opts) {
}
constexpr auto mes = _("デバッグモードに突入してスコアを残せなくなった。", "gave up sending score to use debug commands.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, mes);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, mes);
w_ptr->noscore |= 0x0008;
}
sniper_data->reset_concent = true;
}
- auto *floor_ptr = player_ptr->current_floor_ptr;
+ const auto &floor = *player_ptr->current_floor_ptr;
switch (command_cmd) {
case ESCAPE:
case ' ':
if (w_ptr->wizard) {
w_ptr->wizard = false;
msg_print(_("ウィザードモード解除。", "Wizard mode off."));
- } else if (enter_wizard_mode(player_ptr)) {
+ } else if (enter_wizard_mode(floor)) {
w_ptr->wizard = true;
msg_print(_("ウィザードモード突入。", "Wizard mode on."));
}
break;
}
case KTRL('A'): {
- if (enter_debug_mode(player_ptr)) {
+ if (enter_debug_mode(floor)) {
do_cmd_debug(player_ptr);
}
break;
}
case '<': {
- if (!player_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->is_in_quest()) {
+ if (!player_ptr->wild_mode && !floor.dun_level && !floor.inside_arena && !floor.is_in_quest()) {
if (vanilla_town) {
break;
}
break;
}
- const auto &dungeon = floor_ptr->get_dungeon_definition();
+ const auto &dungeon = floor.get_dungeon_definition();
auto non_magic_class = pc.equals(PlayerClassType::BERSERKER);
non_magic_class |= pc.equals(PlayerClassType::SMITH);
- if (floor_ptr->dun_level && dungeon.flags.has(DungeonFeatureType::NO_MAGIC) && !non_magic_class) {
+ if (floor.is_in_underground() && dungeon.flags.has(DungeonFeatureType::NO_MAGIC) && !non_magic_class) {
msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
msg_print(nullptr);
break;
#pragma once
+class FloorType;
class PlayerType;
-bool enter_wizard_mode(PlayerType *player_ptr);
+bool enter_wizard_mode(const FloorType &floor);
void process_command(PlayerType *player_ptr);
quit(nullptr);
}
- forget_lite(p_ptr->current_floor_ptr);
- forget_view(p_ptr->current_floor_ptr);
- clear_mon_lite(p_ptr->current_floor_ptr);
+ auto &floor = *p_ptr->current_floor_ptr;
+ forget_lite(&floor);
+ forget_view(&floor);
+ clear_mon_lite(&floor);
term_erase(0, hgt - 1);
term_putstr(0, hgt - 1, -1, TERM_RED, _("恐ろしいソフトのバグが飛びかかってきた!", "A gruesome software bug LEAPS out at you!"));
term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ...", "Panic save..."));
- exe_write_diary(p_ptr, DiaryKind::GAMESTART, 0, _("----ゲーム異常終了----", "-- Tried Panic Save and Aborted Game --"));
+ exe_write_diary(floor, DiaryKind::GAMESTART, 0, _("----ゲーム異常終了----", "-- Tried Panic Save and Aborted Game --"));
term_fresh();
p_ptr->panic_save = 1;
* @param num 日記内容のIDに応じた数値
* @param note 日記内容のIDに応じた文字列
*/
-void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_view note)
+void exe_write_diary(const FloorType &floor, DiaryKind dk, int num, std::string_view note)
{
static auto disable_diary = false;
const auto &[day, hour, min] = w_ptr->extract_date_time(InnerGameData::get_instance().get_start_race());
return;
}
- const auto &floor = *player_ptr->current_floor_ptr;
const auto &[q_idx, note_level] = write_floor(floor);
auto do_level = true;
switch (dk) {
case DiaryKind::STAIR: {
auto to = inside_quest(q_idx) && (QuestType::is_fixed(q_idx) && !((q_idx == QuestId::OBERON) || (q_idx == QuestId::SERPENT)))
? _("地上", "the surface")
- : !(player_ptr->current_floor_ptr->dun_level + num)
+ : !(floor.dun_level + num)
? _("地上", "the surface")
- : format(_("%d階", "level %d"), player_ptr->current_floor_ptr->dun_level + num);
+ : format(_("%d階", "level %d"), floor.dun_level + num);
constexpr auto fmt = _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n");
fprintf(fff, fmt, hour, min, note_level.data(), _(to.data(), note.data()), _(note.data(), to.data()));
break;
break;
}
case DiaryKind::PAT_TELE: {
- const auto &floor_ref = *player_ptr->current_floor_ptr;
- auto to = !floor_ref.is_in_underground()
- ? _("地上", "the surface")
- : format(_("%d階(%s)", "level %d of %s"), floor.dun_level, floor.get_dungeon_definition().name.data());
+ const auto to = !floor.is_in_underground()
+ ? _("地上", "the surface")
+ : format(_("%d階(%s)", "level %d of %s"), floor.dun_level, floor.get_dungeon_definition().name.data());
constexpr auto fmt = _(" %2d:%02d %20s %sへとパターンの力で移動した。\n", " %2d:%02d %20s used Pattern to teleport to %s.\n");
fprintf(fff, fmt, hour, min, note_level.data(), to.data());
break;
extern bool write_level;
+class FloorType;
class PlayerType;
enum class QuestId : short;
#ifdef JP
std::string get_ordinal_number_suffix(int num);
#endif
int exe_write_diary_quest(PlayerType *player_ptr, DiaryKind dk, QuestId quest_id);
-void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_view note = "");
+void exe_write_diary(const FloorType &floor, DiaryKind dk, int num, std::string_view note = "");
if (p_ptr->chp < 0) {
p_ptr->is_dead = false;
}
- exe_write_diary(p_ptr, DiaryKind::GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
+ exe_write_diary(*p_ptr->current_floor_ptr, DiaryKind::GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
p_ptr->panic_save = 1;
signals_ignore_tstp();
md_ptr->md_x = md_ptr->m_ptr->fx;
if (record_named_pet && md_ptr->m_ptr->is_named_pet()) {
const auto m_name = monster_desc(player_ptr, md_ptr->m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, 3, m_name);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::NAMED_PET, 3, m_name);
}
}
static void on_defeat_arena_monster(PlayerType *player_ptr, MonsterDeath *md_ptr)
{
- auto *floor_ptr = player_ptr->current_floor_ptr;
- if (!floor_ptr->inside_arena || md_ptr->m_ptr->is_pet()) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ if (!floor.inside_arena || md_ptr->m_ptr->is_pet()) {
return;
}
const auto tval = arena.key.tval();
if (tval > ItemKindType::NONE) {
ItemEntity item(arena.key);
- ItemMagicApplier(player_ptr, &item, floor_ptr->object_level, AM_NO_FIXED_ART).execute();
+ ItemMagicApplier(player_ptr, &item, floor.object_level, AM_NO_FIXED_ART).execute();
(void)drop_near(player_ptr, &item, -1, md_ptr->md_y, md_ptr->md_x);
}
}
const auto m_name = monster_desc(player_ptr, md_ptr->m_ptr, MD_WRONGDOER_NAME);
- exe_write_diary(player_ptr, DiaryKind::ARENA, player_ptr->arena_number, m_name);
+ exe_write_diary(floor, DiaryKind::ARENA, player_ptr->arena_number, m_name);
}
static void drop_corpse(PlayerType *player_ptr, MonsterDeath *md_ptr)
w_ptr->add_winner_class(player_ptr->pclass);
RedrawingFlagsUpdater::get_instance().set_flag(MainWindowRedrawingFlag::TITLE);
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_FINAL_QUEST_CLEAR);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("見事に変愚蛮怒の勝利者となった!", "finally became *WINNER* of Hengband!"));
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::DESCRIPTION, 0, _("見事に変愚蛮怒の勝利者となった!", "finally became *WINNER* of Hengband!"));
patron_list[player_ptr->chaos_patron].admire(player_ptr);
msg_print(_("*** おめでとう ***", "*** CONGRATULATIONS ***"));
msg_print(_("あなたはゲームをコンプリートしました。", "You have won the game!"));
}
/* Compact at least 'size' objects */
- auto *floor_ptr = player_ptr->current_floor_ptr;
+ auto &floor = *player_ptr->current_floor_ptr;
for (int num = 0, cnt = 1; num < size; cnt++) {
int cur_lev = 5 * cnt;
int cur_dis = 5 * (20 - cnt);
- for (MONSTER_IDX i = 1; i < floor_ptr->m_max; i++) {
- auto *m_ptr = &floor_ptr->m_list[i];
- auto *r_ptr = &m_ptr->get_monrace();
- if (!m_ptr->is_valid()) {
+ for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
+ const auto &monster = floor.m_list[i];
+ const auto &monrace = monster.get_monrace();
+ if (!monster.is_valid()) {
continue;
}
- if (r_ptr->level > cur_lev) {
+ if (monrace.level > cur_lev) {
continue;
}
if (i == player_ptr->riding) {
continue;
}
- if ((cur_dis > 0) && (m_ptr->cdis < cur_dis)) {
+ if ((cur_dis > 0) && (monster.cdis < cur_dis)) {
continue;
}
int chance = 90;
- if (r_ptr->misc_flags.has(MonsterMiscType::QUESTOR) && (cnt < 1000)) {
+ if (monrace.misc_flags.has(MonsterMiscType::QUESTOR) && (cnt < 1000)) {
chance = 100;
}
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
+ if (monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
chance = 100;
}
continue;
}
- 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, DiaryKind::NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name);
+ if (record_named_pet && monster.is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name);
}
delete_monster_idx(player_ptr, i);
}
/* Excise dead monsters (backwards!) */
- for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--) {
- const auto &monster = floor_ptr->m_list[i];
+ for (MONSTER_IDX i = floor.m_max - 1; i >= 1; i--) {
+ const auto &monster = floor.m_list[i];
if (monster.is_valid()) {
continue;
}
- compact_monsters_aux(player_ptr, floor_ptr->m_max - 1, i);
- floor_ptr->m_max--;
+
+ compact_monsters_aux(player_ptr, floor.m_max - 1, i);
+ floor.m_max--;
}
}
if (monrace.kind_flags.has(MonsterKindType::UNIQUE) && record_destroy_uniq) {
std::stringstream ss;
ss << monrace.name << (monster.mflag2.has(MonsterConstantFlagType::CLONED) ? _("(クローン)", "(Clone)") : "");
- exe_write_diary(this->player_ptr, DiaryKind::UNIQUE, 0, ss.str());
+ exe_write_diary(*this->player_ptr->current_floor_ptr, DiaryKind::UNIQUE, 0, ss.str());
}
sound(SOUND_KILL);
return;
}
- DIRECTION mm[8];
- mm[0] = mm[1] = mm[2] = mm[3] = 0;
- mm[4] = mm[5] = mm[6] = mm[7] = 0;
-
+ int mm[8]{};
if (!decide_monster_movement_direction(player_ptr, mm, m_idx, turn_flags_ptr->aware)) {
return;
}
*/
bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
{
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
+ const auto &floor = *player_ptr->current_floor_ptr;
+ const auto &monster = floor.m_list[m_idx];
- if (!m_ptr->has_parent()) {
+ if (!monster.has_parent()) {
return false;
}
// parent_m_idxが自分自身を指している場合は召喚主は消滅している
- if (m_ptr->parent_m_idx != m_idx && player_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].is_valid()) {
+ if (monster.parent_m_idx != m_idx && floor.m_list[monster.parent_m_idx].is_valid()) {
return false;
}
if (see_m) {
- const auto m_name = monster_desc(player_ptr, m_ptr, 0);
+ const auto m_name = monster_desc(player_ptr, &monster, 0);
msg_format(_("%sは消え去った!", "%s^ disappears!"), m_name.data());
}
- 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, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
+ if (record_named_pet && monster.is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
}
delete_monster_idx(player_ptr, m_idx);
q_ptr->copy_from(o_ptr);
q_ptr->number = 1;
const auto item_name = describe_flavor(player_ptr, q_ptr, OD_NAME_ONLY);
- exe_write_diary(player_ptr, DiaryKind::FOUND, 0, item_name);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::FOUND, 0, item_name);
}
if (!reward.empty()) {
const auto note = format(_("パトロンの報酬で%s", "The patron rewarded you with %s."), reward.data());
- exe_write_diary(this->player_ptr, DiaryKind::DESCRIPTION, 0, note);
+ exe_write_diary(*this->player_ptr->current_floor_ptr, DiaryKind::DESCRIPTION, 0, note);
}
}
chg_virtue(player_ptr, Virtue::CHANCE, 2);
}
+ const auto &floor = *player_ptr->current_floor_ptr;
if (player_ptr->chp < 0 && !cheat_immortal) {
bool android = PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID);
player_ptr->is_dead = true;
}
- const auto &floor = *player_ptr->current_floor_ptr;
if (floor.inside_arena) {
const auto &m_name = monraces_info[arena_info[player_ptr->arena_number].r_idx].name;
msg_format(_("あなたは%sの前に敗れ去った。", "You are beaten by %s."), m_name.data());
msg_print(nullptr);
if (record_arena) {
- exe_write_diary(player_ptr, DiaryKind::ARENA, -1 - player_ptr->arena_number, m_name);
+ exe_write_diary(floor, DiaryKind::ARENA, -1 - player_ptr->arena_number, m_name);
}
} else {
const auto q_idx = floor.get_quest_id();
w_ptr->total_winner = false;
if (winning_seppuku) {
w_ptr->add_retired_class(player_ptr->pclass);
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, _("勝利の後切腹した。", "committed seppuku after the winning."));
} else {
std::string place;
#else
const auto note = format("killed by %s %s.", player_ptr->died_from.data(), place.data());
#endif
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, note);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, note);
}
- exe_write_diary(player_ptr, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
+ exe_write_diary(floor, DiaryKind::GAMESTART, 1, _("-------- ゲームオーバー --------", "-------- Game Over --------"));
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, "\n\n\n\n");
flush();
if (input_check_strict(player_ptr, _("画面を保存しますか?", "Dump the screen? "), UserCheck::NO_HISTORY)) {
do_cmd_save_screen(player_ptr);
ss << _(hit_from, "was in a critical situation because of ");
ss << _("によってピンチに陥った。", hit_from);
ss << _("", ".");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, ss.str());
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 0, ss.str());
}
if (auto_more) {
}
level_inc_stat = true;
- exe_write_diary(player_ptr, DiaryKind::LEVELUP, player_ptr->lev);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::LEVELUP, player_ptr->lev);
}
sound(SOUND_LEVEL);
*/
bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
{
- auto *floor_ptr = player_ptr->current_floor_ptr;
- if ((floor_ptr->is_in_quest() && QuestType::is_fixed(floor_ptr->quest_number)) || !floor_ptr->dun_level) {
+ auto &floor = *player_ptr->current_floor_ptr;
+ if ((floor.is_in_quest() && QuestType::is_fixed(floor.quest_number)) || !floor.dun_level) {
return false;
}
for (auto dy = -r; dy <= r; dy++) {
for (auto dx = -r; dx <= r; dx++) {
const Pos2D pos(cy + dy, cx + dx);
- if (!in_bounds(floor_ptr, pos.y, pos.x)) {
+ if (!in_bounds(&floor, pos.y, pos.x)) {
continue;
}
continue;
}
- auto &grid = floor_ptr->get_grid(pos);
+ auto &grid = floor.get_grid(pos);
grid.info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
grid.info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
if (!dx && !dy) {
continue;
}
- if (floor_ptr->grid_array[y][x].has_monster()) {
+ if (floor.grid_array[y][x].has_monster()) {
continue;
}
std::string killer;
if (m_idx) {
- auto *m_ptr = &floor_ptr->m_list[m_idx];
+ auto *m_ptr = &floor.m_list[m_idx];
const auto m_name = monster_desc(player_ptr, m_ptr, MD_WRONGDOER_NAME);
killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name.data());
} else {
continue;
}
- auto &grid = floor_ptr->get_grid(pos);
+ auto &grid = floor.get_grid(pos);
if (grid.m_idx == player_ptr->riding) {
continue;
}
continue;
}
- auto *m_ptr = &floor_ptr->m_list[grid.m_idx];
+ auto *m_ptr = &floor.m_list[grid.m_idx];
auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->misc_flags.has(MonsterMiscType::QUESTOR)) {
map[16 + pos.y - cy][16 + pos.x - cx] = false;
continue;
}
- const auto &grid_neighbor = floor_ptr->get_grid(pos_neighbor);
+ const auto &grid_neighbor = floor.get_grid(pos_neighbor);
if (grid_neighbor.is_rune_protection()) {
continue;
}
continue;
}
- if (pattern_tile(floor_ptr, pos_neighbor.y, pos_neighbor.x)) {
+ if (pattern_tile(&floor, pos_neighbor.y, pos_neighbor.x)) {
continue;
}
}
if (grid.has_monster()) {
- const auto &m_ref = floor_ptr->m_list[grid.m_idx];
- if (record_named_pet && m_ref.is_named_pet()) {
+ const auto &monster = floor.m_list[grid.m_idx];
+ if (record_named_pet && monster.is_named_pet()) {
const auto m2_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
}
}
const auto m_idx_aux = grid.m_idx;
grid.m_idx = 0;
- floor_ptr->get_grid(p_pos_new).m_idx = m_idx_aux;
+ floor.get_grid(p_pos_new).m_idx = m_idx_aux;
m_ptr->fy = p_pos_new.y;
m_ptr->fx = p_pos_new.x;
update_monster(player_ptr, m_idx_aux, true);
}
}
- clear_mon_lite(floor_ptr);
+ clear_mon_lite(&floor);
for (auto dy = -r; dy <= r; dy++) {
for (auto dx = -r; dx <= r; dx++) {
auto yy = cy + dy;
continue;
}
- if (!cave_valid_bold(floor_ptr, yy, xx)) {
+ if (!cave_valid_bold(&floor, yy, xx)) {
continue;
}
delete_all_items_from_floor(player_ptr, yy, xx);
- int t = cave_has_flag_bold(floor_ptr, yy, xx, TerrainCharacteristics::PROJECT) ? randint0(100) : 200;
+ int t = cave_has_flag_bold(&floor, yy, xx, TerrainCharacteristics::PROJECT) ? randint0(100) : 200;
if (t < 20) {
cave_set_feat(player_ptr, yy, xx, feat_granite);
continue;
for (auto dy = -r; dy <= r; dy++) {
for (auto dx = -r; dx <= r; dx++) {
const Pos2D pos(cy + dy, cx + dx);
- if (!in_bounds(floor_ptr, pos.y, pos.x)) {
+ if (!in_bounds(&floor, pos.y, pos.x)) {
continue;
}
continue;
}
- auto &grid = floor_ptr->get_grid(pos);
+ auto &grid = floor.get_grid(pos);
if (grid.is_mirror()) {
grid.info |= CAVE_GLOW;
continue;
}
- if (floor_ptr->get_dungeon_definition().flags.has(DungeonFeatureType::DARKNESS)) {
+ if (floor.get_dungeon_definition().flags.has(DungeonFeatureType::DARKNESS)) {
continue;
}
for (auto j = 0; j < 9; j++) {
const Pos2D pos_neighbor(pos.y + ddy_ddd[j], pos.x + ddx_ddd[j]);
- if (!in_bounds2(floor_ptr, pos_neighbor.y, pos_neighbor.x)) {
+ if (!in_bounds2(&floor, pos_neighbor.y, pos_neighbor.x)) {
continue;
}
- const auto &grid_neighbor = floor_ptr->get_grid(pos_neighbor);
+ const auto &grid_neighbor = floor.get_grid(pos_neighbor);
if (grid_neighbor.get_terrain_mimic().flags.has(TerrainCharacteristics::GLOW)) {
grid.info |= CAVE_GLOW;
break;
SubWindowRedrawingFlag::DUNGEON,
};
rfu.set_flags(flags_swrf);
- if (floor_ptr->grid_array[player_ptr->y][player_ptr->x].info & CAVE_GLOW) {
+ if (floor.grid_array[player_ptr->y][player_ptr->x].info & CAVE_GLOW) {
set_superstealth(player_ptr, false);
}
if (record_rand_art) {
const auto diary_item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
- exe_write_diary(player_ptr, DiaryKind::ART_SCROLL, 0, diary_item_name);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::ART_SCROLL, 0, diary_item_name);
}
chg_virtue(player_ptr, Virtue::ENCHANT, 1);
} else {
if (record_named_pet && monster.is_named_pet()) {
const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
}
/* Delete the monster (if any) */
} else {
if (record_named_pet && monster.is_named_pet()) {
const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
}
delete_monster_idx(player_ptr, m_idx);
record_turn = w_ptr->game_turn;
const auto item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
+ const auto &floor = *player_ptr->current_floor_ptr;
if (record_fix_art && !old_known && o_ptr->is_fixed_artifact()) {
- exe_write_diary(player_ptr, DiaryKind::ART, 0, item_name);
+ exe_write_diary(floor, DiaryKind::ART, 0, item_name);
}
if (record_rand_art && !old_known && o_ptr->is_random_artifact()) {
- exe_write_diary(player_ptr, DiaryKind::ART, 0, item_name);
+ exe_write_diary(floor, DiaryKind::ART, 0, item_name);
}
return old_known;
void discharge_minion(PlayerType *player_ptr)
{
bool okay = true;
- for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || !m_ptr->is_pet()) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
+ const auto &monster = floor.m_list[i];
+ if (!monster.is_valid() || !monster.is_pet()) {
continue;
}
- if (m_ptr->is_named()) {
+ if (monster.is_named()) {
okay = false;
}
}
}
}
- for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || !m_ptr->is_pet()) {
+ for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
+ const auto &monster = floor.m_list[i];
+ if (!monster.is_valid() || !monster.is_pet()) {
continue;
}
- MonsterRaceInfo *r_ptr;
- r_ptr = &m_ptr->get_monrace();
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
- const auto m_name = monster_desc(player_ptr, m_ptr, 0x00);
+ const auto &monrace = monster.get_monrace();
+ if (monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
+ const auto m_name = monster_desc(player_ptr, &monster, 0x00);
msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%s^ resists being blasted and runs away."), m_name.data());
delete_monster_idx(player_ptr, i);
continue;
}
- int dam = m_ptr->maxhp / 2;
+ auto dam = monster.maxhp / 2;
if (dam > 100) {
dam = (dam - 100) / 2 + 100;
}
if (dam > 800) {
dam = 800;
}
- project(player_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, AttributeType::PLASMA, PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL);
+ project(player_ptr, i, 2 + (monrace.level / 20), monster.fy, monster.fx, dam, AttributeType::PLASMA, PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL);
- if (record_named_pet && m_ptr->is_named()) {
- const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
+ if (record_named_pet && monster.is_named()) {
+ const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
}
delete_monster_idx(player_ptr, i);
}
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::TELEPORT_LEVEL, 1);
+ exe_write_diary(floor, DiaryKind::TELEPORT_LEVEL, 1);
}
if (autosave_l) {
if (m_idx <= 0) {
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::TELEPORT_LEVEL, -1);
+ exe_write_diary(floor, DiaryKind::TELEPORT_LEVEL, -1);
}
if (autosave_l) {
if (m_idx <= 0) {
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::TELEPORT_LEVEL, -1);
+ exe_write_diary(floor, DiaryKind::TELEPORT_LEVEL, -1);
}
if (autosave_l) {
if (m_idx <= 0) {
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::TELEPORT_LEVEL, 1);
+ exe_write_diary(floor, DiaryKind::TELEPORT_LEVEL, 1);
}
if (autosave_l) {
do_cmd_save_game(player_ptr, true);
QuestCompletionChecker(player_ptr, m_ptr).complete();
if (record_named_pet && m_ptr->is_named_pet()) {
const auto m2_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
- exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
}
delete_monster_idx(player_ptr, m_idx);
if (input_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) {
max_dlv[floor.dungeon_idx] = floor.dun_level;
if (record_maxdepth) {
- exe_write_diary(player_ptr, DiaryKind::TRUMP, floor.dungeon_idx, _("帰還のときに", "when recalled from dungeon"));
+ exe_write_diary(floor, DiaryKind::TRUMP, floor.dungeon_idx, _("帰還のときに", "when recalled from dungeon"));
}
}
}
max_dlv[player_ptr->recall_dungeon] = ((amt > dungeon.maxdepth) ? dungeon.maxdepth
: ((amt < dungeon.mindepth) ? dungeon.mindepth : amt));
if (record_maxdepth) {
- exe_write_diary(player_ptr, DiaryKind::TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
}
msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
max_dlv[select_dungeon] = *reset_level;
if (record_maxdepth) {
constexpr auto note = _("フロア・リセットで", "using a scroll of reset recall");
- exe_write_diary(player_ptr, DiaryKind::TRUMP, select_dungeon, note);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::TRUMP, select_dungeon, note);
}
#ifdef JP
msg_format("%sの帰還レベルを %d 階にセット。", dungeons_info[select_dungeon].name.data(), *reset_level);
msg_format(_("%sを $%ldで購入しました。", "You bought %s for %ld gold."), purchased_item_name.data(), (long)price);
angband_strcpy(record_o_name, purchased_item_name, MAX_NLEN);
record_turn = w_ptr->game_turn;
-
+ const auto &floor = *player_ptr->current_floor_ptr;
if (record_buy) {
- exe_write_diary(player_ptr, DiaryKind::BUY, 0, purchased_item_name);
+ exe_write_diary(floor, DiaryKind::BUY, 0, purchased_item_name);
}
const auto diary_item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
if (record_rand_art && o_ptr->is_random_artifact()) {
- exe_write_diary(player_ptr, DiaryKind::ART, 0, diary_item_name);
+ exe_write_diary(floor, DiaryKind::ART, 0, diary_item_name);
}
j_ptr->inscription.reset();
msg_format(_("%sを $%dで売却しました。", "You sold %s for %d gold."), sold_item_name.data(), price);
if (record_sell) {
- exe_write_diary(player_ptr, DiaryKind::SELL, 0, sold_item_name);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::SELL, 0, sold_item_name);
}
if (!((tval == ItemKindType::FIGURINE) && (value > 0))) {
#include "game-option/cheat-types.h"
#include "io/write-diary.h"
#include "system/angband-exceptions.h"
+#include "system/floor-type-definition.h"
+#include "system/player-type-definition.h"
#include "view/display-messages.h"
#include <array>
#include <sstream>
const auto mes = ss.str();
msg_print(mes);
if (cheat_diary_output) {
- exe_write_diary(player_ptr, DiaryKind::WIZARD_LOG, 0, mes);
+ exe_write_diary(*player_ptr->current_floor_ptr, DiaryKind::WIZARD_LOG, 0, mes);
}
}
*/
void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
{
- for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_PLAYER_SIGHT)) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
+ const auto &monster = floor.m_list[i];
+ if (!monster.is_valid() || (i == player_ptr->riding) || (monster.cdis > MAX_PLAYER_SIGHT)) {
continue;
}
- 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, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+ if (record_named_pet && monster.is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
}
delete_monster_idx(player_ptr, i);
*/
void wiz_zap_floor_monsters(PlayerType *player_ptr)
{
- for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || (i == player_ptr->riding)) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
+ const auto &monster = floor.m_list[i];
+ if (!monster.is_valid() || (i == player_ptr->riding)) {
continue;
}
- 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, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+ if (record_named_pet && monster.is_named_pet()) {
+ const auto m_name = monster_desc(player_ptr, &monster, MD_INDEF_VISIBLE);
+ exe_write_diary(floor, DiaryKind::NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
}
delete_monster_idx(player_ptr, i);
player_ptr->died_from = _("死の欺き", "Cheating death");
(void)set_food(player_ptr, PY_FOOD_MAX - 1);
- auto *floor_ptr = player_ptr->current_floor_ptr;
- floor_ptr->dun_level = 0;
- floor_ptr->inside_arena = false;
+ auto &floor = *player_ptr->current_floor_ptr;
+ floor.dun_level = 0;
+ floor.inside_arena = false;
AngbandSystem::get_instance().set_phase_out(false);
leaving_quest = QuestId::NONE;
- floor_ptr->quest_number = QuestId::NONE;
- if (floor_ptr->dungeon_idx) {
- player_ptr->recall_dungeon = floor_ptr->dungeon_idx;
+ floor.quest_number = QuestId::NONE;
+ if (floor.dungeon_idx) {
+ player_ptr->recall_dungeon = floor.dungeon_idx;
}
- floor_ptr->reset_dungeon_index();
+ floor.reset_dungeon_index();
if (lite_town || vanilla_town) {
player_ptr->wilderness_y = 1;
player_ptr->wilderness_x = 1;
player_ptr->wild_mode = false;
player_ptr->leaving = true;
constexpr auto note = _(" しかし、生き返った。", " but revived.");
- exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 1, note);
+ exe_write_diary(floor, DiaryKind::DESCRIPTION, 1, note);
leave_floor(player_ptr);
}
}
disturb(player_ptr, false, true);
- auto *floor_ptr = player_ptr->current_floor_ptr;
- if (floor_ptr->dun_level || floor_ptr->is_in_quest() || player_ptr->enter_dungeon) {
+ auto &floor = *player_ptr->current_floor_ptr;
+ if (floor.dun_level || floor.is_in_quest() || player_ptr->enter_dungeon) {
msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
- if (floor_ptr->dungeon_idx) {
- player_ptr->recall_dungeon = floor_ptr->dungeon_idx;
+ if (floor.dungeon_idx) {
+ player_ptr->recall_dungeon = floor.dungeon_idx;
}
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::RECALL, floor_ptr->dun_level);
+ exe_write_diary(floor, DiaryKind::RECALL, floor.dun_level);
}
- floor_ptr->dun_level = 0;
- floor_ptr->reset_dungeon_index();
+ floor.dun_level = 0;
+ floor.reset_dungeon_index();
leave_quest_check(player_ptr);
leave_tower_check(player_ptr);
- floor_ptr->quest_number = QuestId::NONE;
+ floor.quest_number = QuestId::NONE;
player_ptr->leaving = true;
sound(SOUND_TPLEVEL);
return;
}
msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
- floor_ptr->set_dungeon_index(player_ptr->recall_dungeon);
+ floor.set_dungeon_index(player_ptr->recall_dungeon);
if (record_stair) {
- exe_write_diary(player_ptr, DiaryKind::RECALL, floor_ptr->dun_level);
+ exe_write_diary(floor, DiaryKind::RECALL, floor.dun_level);
}
- floor_ptr->dun_level = max_dlv[floor_ptr->dungeon_idx];
- if (floor_ptr->dun_level < 1) {
- floor_ptr->dun_level = 1;
+ floor.dun_level = max_dlv[floor.dungeon_idx];
+ if (floor.dun_level < 1) {
+ floor.dun_level = 1;
}
- if (ironman_nightmare && !randint0(666) && (floor_ptr->dungeon_idx == DUNGEON_ANGBAND)) {
- if (floor_ptr->dun_level < 50) {
- floor_ptr->dun_level *= 2;
- } else if (floor_ptr->dun_level < 99) {
- floor_ptr->dun_level = (floor_ptr->dun_level + 99) / 2;
- } else if (floor_ptr->dun_level > 100) {
- floor_ptr->dun_level = floor_ptr->get_dungeon_definition().maxdepth - 1;
+ if (ironman_nightmare && !randint0(666) && (floor.dungeon_idx == DUNGEON_ANGBAND)) {
+ if (floor.dun_level < 50) {
+ floor.dun_level *= 2;
+ } else if (floor.dun_level < 99) {
+ floor.dun_level = (floor.dun_level + 99) / 2;
+ } else if (floor.dun_level > 100) {
+ floor.dun_level = floor.get_dungeon_definition().maxdepth - 1;
}
}
}
decide_auto_save();
- auto *floor_ptr = this->player_ptr->current_floor_ptr;
- if (floor_ptr->monster_noise && !ignore_unview) {
+ const auto &floor = *this->player_ptr->current_floor_ptr;
+ if (floor.monster_noise && !ignore_unview) {
msg_print(_("何かが聞こえた。", "You hear noise."));
}
process_world_monsters();
if ((this->hour == 0) && (this->min == 0)) {
if (this->min != prev_min) {
- exe_write_diary(this->player_ptr, DiaryKind::DIALY, 0);
+ exe_write_diary(floor, DiaryKind::DIALY, 0);
determine_daily_bounty(this->player_ptr, false);
}
}