OSDN Git Service

[Fix] #1469 Habu氏の指摘に対応した (配列の生成と表示を除く)
authorHourier <grapefox.whitelucifer.0408@gmail.com>
Mon, 6 Sep 2021 13:29:52 +0000 (22:29 +0900)
committerHourier <grapefox.whitelucifer.0408@gmail.com>
Tue, 7 Sep 2021 09:11:43 +0000 (18:11 +0900)
src/core/player-processor.cpp
src/spell-realm/spells-hex.cpp
src/spell-realm/spells-hex.h
src/window/main-window-stat-poster.cpp

index 3214e99..4e9d804 100644 (file)
@@ -425,7 +425,7 @@ void process_upkeep_with_speed(player_type *creature_ptr)
             check_music(creature_ptr);
         }
 
-        auto realm_hex = RealmHex(creature_ptr);
+        RealmHex realm_hex(creature_ptr);
         if (!load) {
             realm_hex.decrease_mana();
         }
index 0870bb5..8acdf03 100644 (file)
@@ -70,7 +70,7 @@ bool RealmHex::stop_one_spell()
     screen_save();
     std::vector<int> sp(MAX_KEEP);
     char choice = 0;
-    auto flag = select_spell_stopping(sp, out_val, &choice);
+    auto flag = select_spell_stopping(sp, out_val, choice);
     screen_load();
     if (flag) {
         auto n = sp.at(A2I(choice));
@@ -91,25 +91,25 @@ bool RealmHex::stop_one_spell()
  * @param choice 選択した呪文
  * @return 選択が完了したらtrue、キャンセルならばfalse
  */
-bool RealmHex::select_spell_stopping(std::vector<int> &sp, char *out_val, char *choice)
+bool RealmHex::select_spell_stopping(std::vector<int> &sp, char *out_val, char &choice)
 {
     while (true) {
         this->display_spells_list(sp);
-        if (!get_com(out_val, choice, true)) {
+        if (!get_com(out_val, &choice, true)) {
             return false;
         }
 
-        if (isupper(*choice)) {
-            *choice = static_cast<char>(tolower(*choice));
+        if (isupper(choice)) {
+            choice = static_cast<char>(tolower(choice));
         }
 
         /* All */
-        if (*choice == 'l') {
+        if (choice == 'l') {
             screen_load();
             return this->stop_all_spells();
         }
 
-        if ((*choice < I2A(0)) || (*choice > I2A(casting_hex_num(this->caster_ptr) - 1))) {
+        if ((choice < I2A(0)) || (choice > I2A(casting_hex_num(this->caster_ptr) - 1))) {
             continue;
         }
 
index e9a2036..d2af0f6 100644 (file)
@@ -23,7 +23,7 @@ public:
 private:
     player_type *caster_ptr;
 
-    bool select_spell_stopping(std::vector<int> &sp, char *out_val, char *choice);
+    bool select_spell_stopping(std::vector<int> &sp, char *out_val, char &choice);
     void display_spells_list(std::vector<int> &sp);
     void process_mana_cost(const bool need_restart);
     bool check_restart();
index b57a2fd..fdf04db 100644 (file)
@@ -538,39 +538,40 @@ void print_status(player_type *creature_ptr)
         ADD_BAR_FLAG(BAR_EYEEYE);
 
     if (creature_ptr->realm1 == REALM_HEX) {
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_BLESS))
+        RealmHex realm_hex(creature_ptr);
+        if (realm_hex.is_spelling_specific(HEX_BLESS))
             ADD_BAR_FLAG(BAR_BLESSED);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_DEMON_AURA)) {
+        if (realm_hex.is_spelling_specific(HEX_DEMON_AURA)) {
             ADD_BAR_FLAG(BAR_SHFIRE);
             ADD_BAR_FLAG(BAR_REGENERATION);
         }
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_XTRA_MIGHT))
+        if (realm_hex.is_spelling_specific(HEX_XTRA_MIGHT))
             ADD_BAR_FLAG(BAR_MIGHT);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_DETECT_EVIL))
+        if (realm_hex.is_spelling_specific(HEX_DETECT_EVIL))
             ADD_BAR_FLAG(BAR_ESP_EVIL);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_ICE_ARMOR))
+        if (realm_hex.is_spelling_specific(HEX_ICE_ARMOR))
             ADD_BAR_FLAG(BAR_SHCOLD);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_RUNESWORD))
+        if (realm_hex.is_spelling_specific(HEX_RUNESWORD))
             ADD_BAR_FLAG(BAR_RUNESWORD);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_BUILDING))
+        if (realm_hex.is_spelling_specific(HEX_BUILDING))
             ADD_BAR_FLAG(BAR_BUILD);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_ANTI_TELE))
+        if (realm_hex.is_spelling_specific(HEX_ANTI_TELE))
             ADD_BAR_FLAG(BAR_ANTITELE);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_SHOCK_CLOAK))
+        if (realm_hex.is_spelling_specific(HEX_SHOCK_CLOAK))
             ADD_BAR_FLAG(BAR_SHELEC);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_SHADOW_CLOAK))
+        if (realm_hex.is_spelling_specific(HEX_SHADOW_CLOAK))
             ADD_BAR_FLAG(BAR_SHSHADOW);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_CONFUSION))
+        if (realm_hex.is_spelling_specific(HEX_CONFUSION))
             ADD_BAR_FLAG(BAR_ATTKCONF);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_EYE_FOR_EYE))
+        if (realm_hex.is_spelling_specific(HEX_EYE_FOR_EYE))
             ADD_BAR_FLAG(BAR_EYEEYE);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_ANTI_MULTI))
+        if (realm_hex.is_spelling_specific(HEX_ANTI_MULTI))
             ADD_BAR_FLAG(BAR_ANTIMULTI);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_VAMP_BLADE))
+        if (realm_hex.is_spelling_specific(HEX_VAMP_BLADE))
             ADD_BAR_FLAG(BAR_VAMPILIC);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_ANTI_MAGIC))
+        if (realm_hex.is_spelling_specific(HEX_ANTI_MAGIC))
             ADD_BAR_FLAG(BAR_ANTIMAGIC);
-        if (RealmHex(creature_ptr).is_spelling_specific(HEX_CURE_LIGHT) || RealmHex(creature_ptr).is_spelling_specific(HEX_CURE_SERIOUS) || RealmHex(creature_ptr).is_spelling_specific(HEX_CURE_CRITICAL))
+        if (realm_hex.is_spelling_specific(HEX_CURE_LIGHT) || realm_hex.is_spelling_specific(HEX_CURE_SERIOUS) || realm_hex.is_spelling_specific(HEX_CURE_CRITICAL))
             ADD_BAR_FLAG(BAR_CURE);
 
         if (hex_revenge_turn(creature_ptr)) {