From adffae8096ad3ad50417aaf21644650c43893934 Mon Sep 17 00:00:00 2001 From: Slimebreath6078 Date: Fri, 11 Mar 2022 01:36:54 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20=E3=82=BB=E3=83=BC=E3=83=96?= =?utf8?q?=E3=83=87=E3=83=BC=E3=82=BF=E3=80=81misc.txt=20=E9=96=A2?= =?utf8?q?=E9=80=A3=E4=BB=A5=E5=A4=96=E3=82=92=20max=5Fq=5Fidx=20=E3=81=AB?= =?utf8?q?=E4=BE=9D=E5=AD=98=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit セーブデータは別コミットで、 misc.txt は max_q_idx の削除と共に処理する --- src/main-win/main-win-music.cpp | 2 +- src/wizard/wizard-game-modifier.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main-win/main-win-music.cpp b/src/main-win/main-win-music.cpp index 5dca4496d..0cf0dcee0 100644 --- a/src/main-win/main-win-music.cpp +++ b/src/main-win/main-win-music.cpp @@ -80,7 +80,7 @@ static concptr dungeon_key_at(int index, char *buf) */ static concptr quest_key_at(int index, char *buf) { - if (index >= static_cast(max_q_idx)) { + if (index > enum2i(quest_map.rbegin()->first)) { return nullptr; } diff --git a/src/wizard/wizard-game-modifier.cpp b/src/wizard/wizard-game-modifier.cpp index 5df3ecd4d..d4c29241d 100644 --- a/src/wizard/wizard-game-modifier.cpp +++ b/src/wizard/wizard-game-modifier.cpp @@ -107,7 +107,8 @@ void wiz_enter_quest(PlayerType *player_ptr) char ppp[30]; char tmp_val[5]; int tmp_int; - sprintf(ppp, "QuestID (0-%d):", max_q_idx - 1); + const auto quest_max = enum2i(quest_map.rbegin()->first); + sprintf(ppp, "QuestID (0-%u):", quest_max); sprintf(tmp_val, "%d", 0); if (!get_string(ppp, tmp_val, 3)) { @@ -115,7 +116,7 @@ void wiz_enter_quest(PlayerType *player_ptr) } tmp_int = atoi(tmp_val); - if ((tmp_int < 0) || (tmp_int >= max_q_idx)) { + if ((tmp_int < 0) || (tmp_int > quest_max)) { return; } -- 2.11.0