OSDN Git Service

[Refactor] クエスト突入時のID指定にget_value()を使用。
authorDeskull <sikabane-works@users.noreply.github.com>
Sun, 9 Oct 2022 06:01:05 +0000 (15:01 +0900)
committerDeskull <sikabane-works@users.noreply.github.com>
Sun, 9 Oct 2022 06:49:28 +0000 (15:49 +0900)
src/wizard/wizard-game-modifier.cpp

index acb7601..d7d2a88 100644 (file)
@@ -104,25 +104,13 @@ void wizard_game_modifier(PlayerType *player_ptr)
  */
 void wiz_enter_quest(PlayerType *player_ptr)
 {
-    char ppp[30];
-    char tmp_val[5];
-    int tmp_int;
+    auto tmp_int = 0;
     auto &quest_list = QuestList::get_instance();
     const auto quest_max = enum2i(quest_list.rbegin()->first);
-    sprintf(ppp, "QuestID (0-%u):", quest_max);
-    sprintf(tmp_val, "%d", 0);
-
-    if (!get_string(ppp, tmp_val, 3)) {
-        return;
-    }
-
-    tmp_int = atoi(tmp_val);
-    if ((tmp_int < 0) || (tmp_int > quest_max)) {
+    if (!get_value("QuestID", 0, quest_max - 1, &tmp_int)) {
         return;
     }
-
     auto q_idx = i2enum<QuestId>(tmp_int);
-
     init_flags = i2enum<init_flags_type>(INIT_SHOW_TEXT | INIT_ASSIGN);
     player_ptr->current_floor_ptr->quest_number = q_idx;
     parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0);