OSDN Git Service

[Refactor] #3783 exe_write_diary() の引数をPlayerType からFloorType に変えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 1 Jun 2024 13:42:58 +0000 (22:42 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 2 Jun 2024 11:24:06 +0000 (20:24 +0900)
45 files changed:
src/action/mutation-execution.cpp
src/birth/character-builder.cpp
src/cmd-action/cmd-move.cpp
src/cmd-action/cmd-others.cpp
src/cmd-action/cmd-pet.cpp
src/cmd-action/cmd-spell.cpp
src/cmd-building/cmd-inn.cpp
src/cmd-io/cmd-diary.cpp
src/cmd-io/cmd-gameoption.cpp
src/cmd-io/cmd-save.cpp
src/core/game-closer.cpp
src/core/game-play.cpp
src/dungeon/dungeon-processor.cpp
src/effect/effect-monster.cpp
src/floor/floor-changer.cpp
src/floor/floor-leaver.cpp
src/floor/pattern-walk.cpp
src/grid/trap.cpp
src/io/input-key-processor.cpp
src/io/input-key-processor.h
src/io/signal-handlers.cpp
src/io/write-diary.cpp
src/io/write-diary.h
src/main-win.cpp
src/monster-floor/monster-death.cpp
src/monster/monster-compaction.cpp
src/monster/monster-damage.cpp
src/monster/monster-processor.cpp
src/perception/object-perception.cpp
src/player/patron.cpp
src/player/player-damage.cpp
src/player/player-status.cpp
src/spell-kind/earthquake.cpp
src/spell-kind/spells-enchant.cpp
src/spell-kind/spells-floor.cpp
src/spell-kind/spells-genocide.cpp
src/spell-kind/spells-perception.cpp
src/spell-kind/spells-pet.cpp
src/spell-kind/spells-world.cpp
src/store/purchase-order.cpp
src/store/sell-order.cpp
src/wizard/wizard-messages.cpp
src/wizard/wizard-special-process.cpp
src/world/world-movement-processor.cpp
src/world/world-turn-processor.cpp

index 2f495ae..a50a3ef 100644 (file)
@@ -277,7 +277,7 @@ bool exe_mutation_power(PlayerType *player_ptr, PlayerMutationType power)
         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);
index 24cc00a..01ddea9 100644 (file)
@@ -57,32 +57,32 @@ static void write_birth_diary(PlayerType *player_ptr)
     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);
     }
 }
 
index 0af18c1..e8ddb46 100644 (file)
@@ -140,19 +140,19 @@ void do_cmd_go_up(PlayerType *player_ptr)
         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();
@@ -163,16 +163,16 @@ void do_cmd_go_up(PlayerType *player_ptr)
             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 {
@@ -302,9 +302,9 @@ void do_cmd_go_down(PlayerType *player_ptr)
 
     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"));
         }
     }
 
index c99619c..e24c7dc 100644 (file)
@@ -193,9 +193,10 @@ void do_cmd_suicide(PlayerType *player_ptr)
         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");
index 4f4b0b7..0db8370 100644 (file)
@@ -138,7 +138,7 @@ void do_cmd_pet_dismiss(PlayerType *player_ptr)
         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) {
@@ -345,14 +345,14 @@ static void do_name_pet(PlayerType *player_ptr)
     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();
index 895fd34..399f41a 100644 (file)
@@ -696,7 +696,7 @@ static void change_realm2(PlayerType *player_ptr, int16_t next_realm)
 
     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;
 
index 94de6db..199bada 100644 (file)
@@ -67,14 +67,15 @@ static bool is_player_undead(PlayerType *player_ptr)
  */
 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);
 }
 
 /*!
@@ -117,7 +118,7 @@ static bool has_a_nightmare(PlayerType *player_ptr)
     }
 
     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;
 }
 
@@ -163,6 +164,7 @@ static void charge_magic_eating_energy(PlayerType *player_ptr)
  */
 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) ? "夜" : "夕方");
@@ -170,13 +172,13 @@ static void display_stay_result(PlayerType *player_ptr, int prev_hour)
         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);
 }
 
 /*!
@@ -195,10 +197,9 @@ static bool stay_inn(PlayerType *player_ptr)
 
     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;
index 318f281..69b5f62 100644 (file)
@@ -44,18 +44,18 @@ static void display_diary(PlayerType *player_ptr)
 /*!
  * @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;
@@ -69,7 +69,7 @@ static void do_cmd_last_get(PlayerType *player_ptr)
     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;
 }
 
@@ -107,7 +107,7 @@ void do_cmd_diary(PlayerType *player_ptr)
 {
     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);
@@ -127,10 +127,10 @@ void do_cmd_diary(PlayerType *player_ptr)
             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();
index 434a468..484b469 100644 (file)
@@ -331,13 +331,13 @@ static void do_cmd_options_win(PlayerType *player_ptr)
  * 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
         /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
@@ -380,7 +380,7 @@ static void do_cmd_options_cheat(PlayerType *player_ptr, concptr info)
         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."));
             }
 
@@ -395,7 +395,7 @@ static void do_cmd_options_cheat(PlayerType *player_ptr, concptr info)
             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:
@@ -549,7 +549,7 @@ void do_cmd_options(PlayerType *player_ptr)
                 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':
index f788d02..4d1e955 100644 (file)
@@ -52,5 +52,5 @@ void do_cmd_save_and_exit(PlayerType *player_ptr)
 {
     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 ---"));
 }
index 9f452cd..88c28d1 100644 (file)
@@ -89,7 +89,8 @@ static bool check_death(PlayerType *player_ptr)
 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");
@@ -124,9 +125,9 @@ static void kingly(PlayerType *player_ptr)
 #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();
index 10633f5..b1c0bfc 100644 (file)
@@ -212,16 +212,16 @@ static void restore_world_floor_info(PlayerType *player_ptr)
 {
     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;
@@ -280,11 +280,11 @@ static void change_floor_if_error(PlayerType *player_ptr)
 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();
@@ -297,7 +297,7 @@ static void generate_world(PlayerType *player_ptr, bool new_game)
     }
 
     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)
index d18cb7e..c54f497 100644 (file)
@@ -130,7 +130,7 @@ void process_dungeon(PlayerType *player_ptr, bool load_game)
     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);
         }
     }
 
index 93c999b..7d3b9c6 100644 (file)
@@ -273,7 +273,7 @@ static bool heal_leaper(PlayerType *player_ptr, EffectMonster *em_ptr)
 
     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);
index f997971..6571f26 100644 (file)
@@ -135,6 +135,7 @@ static MonsterRaceInfo &set_pet_params(PlayerType *player_ptr, const int current
 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;
@@ -148,18 +149,18 @@ static void place_pet(PlayerType *player_ptr)
             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--;
             }
         }
     }
index ebe57b5..674980b 100644 (file)
@@ -100,13 +100,14 @@ static void record_pet_diary(PlayerType *player_ptr)
         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));
     }
 }
 
index e47da2d..7dedcb3 100644 (file)
@@ -40,13 +40,13 @@ void pattern_teleport(PlayerType *player_ptr)
 {
     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;
@@ -78,10 +78,10 @@ void pattern_teleport(PlayerType *player_ptr)
         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;
index d9b83a6..a67c793 100644 (file)
@@ -385,7 +385,8 @@ static void hit_trap_slow(PlayerType *player_ptr)
 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;
 
@@ -417,7 +418,7 @@ void hit_trap(PlayerType *player_ptr, bool break_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;
         }
index 1795505..b58cd5c 100644 (file)
 /*!
  * @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) {
@@ -119,7 +119,7 @@ bool enter_wizard_mode(PlayerType *player_ptr)
         }
 
         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;
     }
 
@@ -132,7 +132,7 @@ bool enter_wizard_mode(PlayerType *player_ptr)
  * @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) {
@@ -148,7 +148,7 @@ static bool enter_debug_mode(PlayerType *player_ptr)
         }
 
         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;
     }
 
@@ -170,7 +170,7 @@ void process_command(PlayerType *player_ptr)
         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 ' ':
@@ -183,7 +183,7 @@ void process_command(PlayerType *player_ptr)
         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."));
         }
@@ -194,7 +194,7 @@ void process_command(PlayerType *player_ptr)
         break;
     }
     case KTRL('A'): {
-        if (enter_debug_mode(player_ptr)) {
+        if (enter_debug_mode(floor)) {
             do_cmd_debug(player_ptr);
         }
 
@@ -309,7 +309,7 @@ void process_command(PlayerType *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;
             }
@@ -403,10 +403,10 @@ void process_command(PlayerType *player_ptr)
             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;
index ef259bb..59a6d5d 100644 (file)
@@ -1,5 +1,6 @@
 #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);
index fb659a9..bf0ab13 100644 (file)
@@ -124,16 +124,17 @@ static void handle_signal_abort(int sig)
         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;
index 532405b..27755a3 100644 (file)
@@ -253,7 +253,7 @@ int exe_write_diary_quest(PlayerType *player_ptr, DiaryKind dk, QuestId quest_id
  * @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());
@@ -266,7 +266,6 @@ void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_
         return;
     }
 
-    const auto &floor = *player_ptr->current_floor_ptr;
     const auto &[q_idx, note_level] = write_floor(floor);
     auto do_level = true;
     switch (dk) {
@@ -318,9 +317,9 @@ void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_
     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;
@@ -377,10 +376,9 @@ void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_
         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;
index a1cfbd5..5c6b50b 100644 (file)
@@ -51,6 +51,7 @@ enum class DiaryKind {
 
 extern bool write_level;
 
+class FloorType;
 class PlayerType;
 enum class QuestId : short;
 #ifdef JP
@@ -58,4 +59,4 @@ enum class QuestId : short;
 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 = "");
index 34f85d5..58456e4 100644 (file)
@@ -2446,7 +2446,7 @@ LRESULT PASCAL angband_window_procedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
         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();
index 9e549e0..cd32fcf 100644 (file)
@@ -54,7 +54,7 @@ static void write_pet_death(PlayerType *player_ptr, MonsterDeath *md_ptr)
     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);
     }
 }
 
@@ -77,8 +77,8 @@ static void on_dead_explosion(PlayerType *player_ptr, MonsterDeath *md_ptr)
 
 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;
     }
 
@@ -93,7 +93,7 @@ static void on_defeat_arena_monster(PlayerType *player_ptr, MonsterDeath *md_ptr
     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);
     }
 
@@ -107,7 +107,7 @@ static void on_defeat_arena_monster(PlayerType *player_ptr, MonsterDeath *md_ptr
     }
 
     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)
@@ -324,7 +324,7 @@ static void on_defeat_last_boss(PlayerType *player_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!"));
index 54c1eb5..e9f6e72 100644 (file)
@@ -106,32 +106,32 @@ void compact_monsters(PlayerType *player_ptr, int size)
     }
 
     /* 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;
             }
 
@@ -139,9 +139,9 @@ void compact_monsters(PlayerType *player_ptr, int size)
                 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);
@@ -150,12 +150,13 @@ void compact_monsters(PlayerType *player_ptr, int size)
     }
 
     /* 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--;
     }
 }
index 83e2079..19fee21 100644 (file)
@@ -150,7 +150,7 @@ bool MonsterDamageProcessor::process_dead_exp_virtue(std::string_view note, cons
     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);
index 2dfa8b3..586419a 100644 (file)
@@ -167,10 +167,7 @@ void process_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
         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;
     }
@@ -273,25 +270,26 @@ void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is
  */
 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);
index e91a55e..e9db0e7 100644 (file)
@@ -43,5 +43,5 @@ void object_aware(PlayerType *player_ptr, const ItemEntity *o_ptr)
     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);
 }
index 61843ee..39b9dff 100644 (file)
@@ -516,7 +516,7 @@ void Patron::gain_level_reward(PlayerType *player_ptr_, int chosen_reward)
 
     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);
     }
 }
 
index a0345a7..becb839 100644 (file)
@@ -359,6 +359,7 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
         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);
 
@@ -375,13 +376,12 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
             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();
@@ -417,7 +417,7 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
             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;
 
@@ -436,11 +436,11 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
 #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);
@@ -566,7 +566,7 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
             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) {
index c9ac2eb..f4941f9 100644 (file)
@@ -2928,7 +2928,7 @@ void check_experience(PlayerType *player_ptr)
             }
             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);
index d5880f6..f036888 100644 (file)
@@ -49,8 +49,8 @@
  */
 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;
     }
 
@@ -70,7 +70,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
     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;
             }
 
@@ -78,7 +78,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 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) {
@@ -110,7 +110,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 continue;
             }
 
-            if (floor_ptr->grid_array[y][x].has_monster()) {
+            if (floor.grid_array[y][x].has_monster()) {
                 continue;
             }
 
@@ -155,7 +155,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
             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 {
@@ -173,7 +173,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 continue;
             }
 
-            auto &grid = floor_ptr->get_grid(pos);
+            auto &grid = floor.get_grid(pos);
             if (grid.m_idx == player_ptr->riding) {
                 continue;
             }
@@ -182,7 +182,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 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;
@@ -201,7 +201,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                         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;
                     }
@@ -210,7 +210,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                         continue;
                     }
 
-                    if (pattern_tile(floor_ptr, pos_neighbor.y, pos_neighbor.x)) {
+                    if (pattern_tile(&floor, pos_neighbor.y, pos_neighbor.x)) {
                         continue;
                     }
 
@@ -250,10 +250,10 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 }
 
                 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);
                     }
                 }
 
@@ -267,7 +267,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
 
             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);
@@ -276,7 +276,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
         }
     }
 
-    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;
@@ -285,12 +285,12 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 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;
@@ -313,7 +313,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
     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;
             }
 
@@ -321,23 +321,23 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
                 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;
@@ -368,7 +368,7 @@ bool earthquake(PlayerType *player_ptr, POSITION cy, POSITION cx, POSITION r, MO
         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);
     }
 
index 99a6e00..6ba3ffb 100644 (file)
@@ -97,7 +97,7 @@ bool artifact_scroll(PlayerType *player_ptr)
 
     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);
index e49f19f..d9f83b1 100644 (file)
@@ -354,7 +354,7 @@ bool destroy_area(PlayerType *player_ptr, const POSITION y1, const POSITION x1,
                 } 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) */
index 6db4349..6e9b4eb 100644 (file)
@@ -64,7 +64,7 @@ bool genocide_aux(PlayerType *player_ptr, MONSTER_IDX m_idx, int power, bool pla
     } 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);
index 44e54de..704e246 100644 (file)
@@ -89,12 +89,13 @@ bool identify_item(PlayerType *player_ptr, ItemEntity *o_ptr)
     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;
index e793c22..b4f30bd 100644 (file)
 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;
         }
     }
@@ -39,22 +40,21 @@ void discharge_minion(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() || !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;
         }
@@ -64,11 +64,11 @@ void discharge_minion(PlayerType *player_ptr)
         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);
index ac5148d..aba1225 100644 (file)
@@ -110,7 +110,7 @@ void teleport_level(PlayerType *player_ptr, MONSTER_IDX m_idx)
             }
 
             if (record_stair) {
-                exe_write_diary(player_ptr, DiaryKind::TELEPORT_LEVEL, 1);
+                exe_write_diary(floor, DiaryKind::TELEPORT_LEVEL, 1);
             }
 
             if (autosave_l) {
@@ -140,7 +140,7 @@ void teleport_level(PlayerType *player_ptr, MONSTER_IDX m_idx)
 
         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) {
@@ -165,7 +165,7 @@ void teleport_level(PlayerType *player_ptr, MONSTER_IDX m_idx)
 
         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) {
@@ -188,7 +188,7 @@ void teleport_level(PlayerType *player_ptr, MONSTER_IDX m_idx)
 
         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);
@@ -208,7 +208,7 @@ void teleport_level(PlayerType *player_ptr, MONSTER_IDX m_idx)
     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);
@@ -448,7 +448,7 @@ bool recall_player(PlayerType *player_ptr, TIME_EFFECT turns)
         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"));
             }
         }
     }
@@ -505,7 +505,7 @@ bool free_level_recall(PlayerType *player_ptr)
     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..."));
@@ -541,7 +541,7 @@ bool reset_recall(PlayerType *player_ptr)
     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);
index 65f511b..f05232a 100644 (file)
@@ -284,14 +284,14 @@ void store_purchase(PlayerType *player_ptr, StoreSaleType store_num)
     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();
index 7809480..8ba5091 100644 (file)
@@ -170,7 +170,7 @@ void store_sell(PlayerType *player_ptr, StoreSaleType store_num)
             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))) {
index cf70a8b..4416e56 100644 (file)
@@ -3,6 +3,8 @@
 #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>
@@ -37,7 +39,7 @@ void msg_print_wizard(PlayerType *player_ptr, int cheat_type, std::string_view m
     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);
     }
 }
 
index 01eba53..8d9523b 100644 (file)
@@ -717,15 +717,16 @@ void set_gametime(void)
  */
 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);
@@ -738,15 +739,16 @@ void wiz_zap_surrounding_monsters(PlayerType *player_ptr)
  */
 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);
@@ -773,17 +775,17 @@ void cheat_death(PlayerType *player_ptr)
     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;
@@ -804,6 +806,6 @@ void cheat_death(PlayerType *player_ptr)
     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);
 }
index 2e2d66e..d0a9650 100644 (file)
@@ -73,43 +73,43 @@ void execute_recall(PlayerType *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;
         }
     }
 
index 4043a51..3bbfb79 100644 (file)
@@ -70,8 +70,8 @@ void WorldTurnProcessor::process_world()
     }
 
     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."));
     }
 
@@ -79,7 +79,7 @@ void WorldTurnProcessor::process_world()
     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);
         }
     }