From: Slimebreath6078 Date: Thu, 10 Mar 2022 16:36:54 +0000 (+0900) Subject: [Refactor] セーブデータ、misc.txt 関連以外を max_q_idx に依存しないようにした X-Git-Tag: 3.0.0Alpha57^2~31^2~2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=adffae8096ad3ad50417aaf21644650c43893934;p=hengbandforosx%2Fhengbandosx.git [Refactor] セーブデータ、misc.txt 関連以外を max_q_idx に依存しないようにした セーブデータは別コミットで、 misc.txt は max_q_idx の削除と共に処理する --- 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; }