OSDN Git Service

Merge pull request #3172 from Hourier/Remove-Nickname-Command
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 1 Jun 2023 14:08:59 +0000 (23:08 +0900)
committerGitHub <noreply@github.com>
Thu, 1 Jun 2023 14:08:59 +0000 (23:08 +0900)
ペットの名前に依存して全コマンドに確認を求められる仕様を削除した

src/io/input-key-requester.cpp
src/io/input-key-requester.h

index 30913f1..803dd9b 100644 (file)
@@ -324,19 +324,23 @@ void InputKeyRequestor::sweep_confirmation_equipments()
             continue;
         }
 
-        this->confirm_command(item, caret_command);
+        this->confirm_command(item.inscription, caret_command);
     }
 }
 
-void InputKeyRequestor::confirm_command(ItemEntity &o_ref, const int caret_command)
+void InputKeyRequestor::confirm_command(const std::optional<std::string> &inscription, const int caret_command)
 {
-    auto s = o_ref.inscription->data();
+    if (!inscription.has_value()) {
+        return;
+    }
+
+    auto s = inscription->data();
     s = angband_strchr(s, '^');
-    while (s) {
+    while (s != nullptr) {
 #ifdef JP
-        auto sure = (s[1] == caret_command) || (s[1] == '*');
+        auto sure = s[1] == caret_command;
 #else
-        auto sure = (s[1] == command_cmd) || (s[1] == '*');
+        auto sure = s[1] == command_cmd;
         (void)caret_command;
 #endif
         if (sure) {
index ad8dd90..edd96c1 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "game-option/keymap-directory-getter.h"
 #include "system/angband.h"
+#include <optional>
 #include <string>
 
 extern concptr keymap_act[KEYMAP_MODES][256];
@@ -17,7 +18,6 @@ extern TERM_LEN command_gap;
 extern int16_t command_wrk;
 extern int16_t command_new;
 
-class ItemEntity;
 class PlayerType;
 class SpecialMenuContent;
 class InputKeyRequestor {
@@ -48,7 +48,7 @@ private:
     void change_shopping_command();
     int get_caret_command();
     void sweep_confirmation_equipments();
-    void confirm_command(ItemEntity &o_ref, const int caret_command);
+    void confirm_command(const std::optional<std::string> &inscription, const int caret_command);
 
     void make_commands_frame();
     std::string switch_special_menu_condition(const SpecialMenuContent &special_menu);