OSDN Git Service

[Refactor] #3733 optional 型の値取得処理 value() を撤廃した その3
[hengbandforosx/hengbandosx.git] / src / cmd-action / cmd-hissatsu.cpp
index f3b7905..c042ee0 100644 (file)
@@ -1,4 +1,4 @@
-/*!
+/*!
  * @brief 剣術の実装 / Blade arts
  * @date 2014/01/17
  * @author
@@ -112,11 +112,11 @@ static int get_hissatsu_power(PlayerType *player_ptr, SPELL_IDX *sn)
             choice = ' ';
         } else {
             const auto new_choice = input_command(prompt);
-            if (!new_choice.has_value()) {
+            if (!new_choice) {
                 break;
             }
 
-            choice = new_choice.value();
+            choice = *new_choice;
         }
 
         auto should_redraw_cursor = true;
@@ -390,13 +390,13 @@ void do_cmd_gain_hissatsu(PlayerType *player_ptr)
     constexpr auto q = _("どの書から学びますか? ", "Study which book? ");
     constexpr auto s = _("読める書がない。", "You have no books that you can read.");
     constexpr auto options = USE_INVEN | USE_FLOOR;
-    short item;
-    const auto *o_ptr = choose_object(player_ptr, &item, q, s, options, TvalItemTester(ItemKindType::HISSATSU_BOOK));
+    short i_idx;
+    const auto *o_ptr = choose_object(player_ptr, &i_idx, q, s, options, TvalItemTester(ItemKindType::HISSATSU_BOOK));
     if (o_ptr == nullptr) {
         return;
     }
 
-    const auto sval = o_ptr->bi_key.sval().value();
+    const auto sval = *o_ptr->bi_key.sval();
     auto gain = false;
     for (auto i = sval * 8; i < sval * 8 + 8; i++) {
         if (player_ptr->spell_learned1 & (1UL << i)) {