OSDN Git Service

[Refactor] 復帰させる固定アーティファクトID指定を get_value() に変更。
authorDeskull <sikabane-works@users.noreply.github.com>
Sun, 9 Oct 2022 06:07:03 +0000 (15:07 +0900)
committerDeskull <sikabane-works@users.noreply.github.com>
Sun, 9 Oct 2022 07:26:58 +0000 (16:26 +0900)
src/wizard/wizard-item-modifier.cpp

index 7087d61..d2ea1dd 100644 (file)
@@ -178,21 +178,11 @@ void wizard_item_modifier(PlayerType *player_ptr)
 void wiz_restore_aware_flag_of_fixed_arfifact(FixedArtifactId reset_artifact_idx, bool aware)
 {
     auto max_a_idx = enum2i(a_info.rbegin()->first);
-    auto int_a_idx = enum2i(reset_artifact_idx);
+    auto int_a_idx = static_cast<int>(enum2i(reset_artifact_idx));
     if (int_a_idx <= 0) {
-        char tmp[80] = "";
-        sprintf(tmp, "Artifact ID (1-%d): ", max_a_idx);
-        char tmp_val[10] = "";
-        if (!get_string(tmp, tmp_val, 3)) {
+        if (!get_value("Artifact ID", 1, max_a_idx, &int_a_idx)) {
             return;
         }
-
-        int_a_idx = static_cast<short>(atoi(tmp_val));
-    }
-
-    if ((int_a_idx <= 0) || (int_a_idx > static_cast<short>(max_a_idx))) {
-        msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), max_a_idx);
-        return;
     }
 
     a_info.at(i2enum<FixedArtifactId>(int_a_idx)).is_generated = aware;