OSDN Git Service

[Refactor] #3406 get_value() をinput_value_int() に変えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 17 Jun 2023 14:45:07 +0000 (23:45 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sat, 24 Jun 2023 03:24:11 +0000 (12:24 +0900)
src/cmd-io/cmd-gameoption.cpp
src/cmd-visual/cmd-visuals.cpp
src/core/asking-player.cpp
src/core/asking-player.h
src/wizard/wizard-game-modifier.cpp
src/wizard/wizard-item-modifier.cpp
src/wizard/wizard-special-process.cpp
src/wizard/wizard-spells.cpp

index 08cd03f..95c1fd7 100644 (file)
@@ -572,7 +572,7 @@ void do_cmd_options(PlayerType *player_ptr)
             clear_from(18);
             prt(format(_("現在ウェイト量(msec): %d", "Current Delay Factor(msec): %d"), delay_factor), 19, 0);
             constexpr auto prompt = _("コマンド: ウェイト量(msec)", "Command: Delay Factor(msec)");
-            const auto new_delay_factor = get_value(prompt, 0, 1000, delay_factor);
+            const auto new_delay_factor = input_value_int(prompt, 0, 1000, delay_factor);
             if (new_delay_factor.has_value()) {
                 delay_factor = new_delay_factor.value();
             }
index 3c1b52a..cc2aa45 100644 (file)
@@ -39,7 +39,7 @@
 static std::optional<short> input_new_visual_id(int i, int initial_visual_id, short max)
 {
     if (iscntrl(i)) {
-        const auto new_visual_id = get_value("Input new number", 0, max - 1, initial_visual_id);
+        const auto new_visual_id = input_value_int("Input new number", 0, max - 1, initial_visual_id);
         if (!new_visual_id.has_value()) {
             return std::nullopt;
         }
index fda4907..ef86af8 100644 (file)
@@ -439,7 +439,7 @@ void pause_line(int row)
     prt("", row, 0);
 }
 
-std::optional<int> get_value(std::string_view prompt, int min, int max, int initial_value)
+std::optional<int> input_value_int(std::string_view prompt, int min, int max, int initial_value)
 {
     std::stringstream ss;
     char tmp_val[12] = "";
index 530cbde..10e8365 100644 (file)
@@ -20,4 +20,4 @@ bool get_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS
 bool get_com(std::string_view prompt, char *command, bool z_escape);
 QUANTITY get_quantity(std::optional<std::string_view> prompt_opt, QUANTITY max);
 void pause_line(int row);
-std::optional<int> get_value(std::string_view prompt, int min, int max, int initial_value = 0);
+std::optional<int> input_value_int(std::string_view prompt, int min, int max, int initial_value = 0);
index e6b28ea..7b0a35a 100644 (file)
@@ -106,7 +106,7 @@ void wiz_enter_quest(PlayerType *player_ptr)
 {
     auto &quest_list = QuestList::get_instance();
     const auto quest_max = enum2i(quest_list.rbegin()->first);
-    const auto quest_num = get_value("QuestID", 0, quest_max - 1);
+    const auto quest_num = input_value_int("QuestID", 0, quest_max - 1);
     if (!quest_num.has_value()) {
         return;
     }
@@ -142,7 +142,7 @@ void wiz_complete_quest(PlayerType *player_ptr)
 void wiz_restore_monster_max_num(MonsterRaceId r_idx)
 {
     if (!MonsterRace(r_idx).is_valid()) {
-        const auto restore_monrace_id = get_value("MonsterID", 1, monraces_info.size() - 1);
+        const auto restore_monrace_id = input_value_int("MonsterID", 1, monraces_info.size() - 1);
         if (!restore_monrace_id.has_value()) {
             return;
         }
index c36efa4..7bf8bd8 100644 (file)
@@ -241,7 +241,7 @@ void wiz_restore_aware_flag_of_fixed_arfifact(FixedArtifactId reset_artifact_idx
         return;
     }
 
-    const auto input_artifact_id = get_value("Artifact ID", 1, max_a_idx);
+    const auto input_artifact_id = input_value_int("Artifact ID", 1, max_a_idx);
     if (!input_artifact_id.has_value()) {
         return;
     }
@@ -266,7 +266,7 @@ void wiz_modify_item_activation(PlayerType *player_ptr)
 
     constexpr auto min = enum2i(RandomArtActType::NONE);
     constexpr auto max = enum2i(RandomArtActType::MAX) - 1;
-    const auto act_id = get_value("Activation ID", min, max);
+    const auto act_id = input_value_int("Activation ID", min, max);
     if (!act_id.has_value()) {
         return;
     }
index c61ecc7..7f19e2e 100644 (file)
@@ -493,12 +493,12 @@ void wiz_create_feature(PlayerType *player_ptr)
     }
 
     auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
-    auto f_val1 = get_value(_("実地形ID", "FeatureID"), 0, terrains_info.size() - 1, g_ptr->feat);
+    auto f_val1 = input_value_int(_("実地形ID", "FeatureID"), 0, terrains_info.size() - 1, g_ptr->feat);
     if (!f_val1.has_value()) {
         return;
     }
 
-    auto f_val2 = get_value(_("偽装地形ID", "FeatureID"), 0, terrains_info.size() - 1, f_val1.value());
+    auto f_val2 = input_value_int(_("偽装地形ID", "FeatureID"), 0, terrains_info.size() - 1, f_val1.value());
     if (!f_val2.has_value()) {
         return;
     }
@@ -694,7 +694,7 @@ static void change_birth_flags()
 void wiz_reset_race(PlayerType *player_ptr)
 {
     const auto original_race = enum2i<PlayerRaceType>(player_ptr->prace);
-    const auto new_race = get_value("RaceID", 0, MAX_RACES - 1, original_race);
+    const auto new_race = input_value_int("RaceID", 0, MAX_RACES - 1, original_race);
     if (!new_race.has_value()) {
         return;
     }
@@ -712,7 +712,7 @@ void wiz_reset_race(PlayerType *player_ptr)
 void wiz_reset_class(PlayerType *player_ptr)
 {
     const auto original_class = enum2i<PlayerClassType>(player_ptr->pclass);
-    const auto new_class_opt = get_value("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, original_class);
+    const auto new_class_opt = input_value_int("ClassID", 0, PLAYER_CLASS_TYPE_MAX - 1, original_class);
     if (!new_class_opt.has_value()) {
         return;
     }
@@ -733,13 +733,13 @@ void wiz_reset_class(PlayerType *player_ptr)
 void wiz_reset_realms(PlayerType *player_ptr)
 {
     const auto original_realm1 = player_ptr->realm1;
-    const auto new_realm1 = get_value("1st Realm (None=0)", 0, MAX_REALM - 1, original_realm1);
+    const auto new_realm1 = input_value_int("1st Realm (None=0)", 0, MAX_REALM - 1, original_realm1);
     if (!new_realm1.has_value()) {
         return;
     }
 
     const auto original_realm2 = player_ptr->realm2;
-    const auto new_realm2 = get_value("2nd Realm (None=0)", 0, MAX_REALM - 1, original_realm2);
+    const auto new_realm2 = input_value_int("2nd Realm (None=0)", 0, MAX_REALM - 1, original_realm2);
     if (!new_realm2.has_value()) {
         return;
     }
@@ -801,7 +801,7 @@ void wiz_dump_options(void)
  */
 void set_gametime(void)
 {
-    const auto game_time = get_value("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1);
+    const auto game_time = input_value_int("Dungeon Turn", 0, w_ptr->dungeon_turn_limit - 1);
     if (!game_time.has_value()) {
         return;
     }
index 9264408..40489a5 100644 (file)
@@ -228,7 +228,7 @@ void wiz_summon_random_monster(PlayerType *player_ptr, int num)
 void wiz_summon_specific_monster(PlayerType *player_ptr, MonsterRaceId r_idx)
 {
     if (!MonsterRace(r_idx).is_valid()) {
-        const auto new_monrace_id = get_value("MonsterID", 1, monraces_info.size() - 1, 1);
+        const auto new_monrace_id = input_value_int("MonsterID", 1, monraces_info.size() - 1, 1);
         if (!new_monrace_id.has_value()) {
             return;
         }
@@ -249,7 +249,7 @@ void wiz_summon_specific_monster(PlayerType *player_ptr, MonsterRaceId r_idx)
 void wiz_summon_pet(PlayerType *player_ptr, MonsterRaceId r_idx)
 {
     if (!MonsterRace(r_idx).is_valid()) {
-        const auto new_monrace_id = get_value("MonsterID", 1, monraces_info.size() - 1, 1);
+        const auto new_monrace_id = input_value_int("MonsterID", 1, monraces_info.size() - 1, 1);
         if (!new_monrace_id.has_value()) {
             return;
         }
@@ -271,7 +271,7 @@ void wiz_kill_target(PlayerType *player_ptr, int initial_dam, AttributeType effe
 {
     auto dam = initial_dam;
     if (dam <= 0) {
-        const auto input_dam = get_value("Damage", 1, 1000000, 1000000);
+        const auto input_dam = input_value_int("Damage", 1, 1000000, 1000000);
         if (!input_dam.has_value()) {
             return;
         }
@@ -294,7 +294,7 @@ void wiz_kill_target(PlayerType *player_ptr, int initial_dam, AttributeType effe
             put_str(format("%03d:%-.10s^", num, name.data()), 1 + i / 5, 1 + (i % 5) * 16);
         }
 
-        const auto input_effect_id = get_value("EffectID", 1, max - 1, idx);
+        const auto input_effect_id = input_value_int("EffectID", 1, max - 1, idx);
         if (!input_effect_id.has_value()) {
             screen_load();
             return;