OSDN Git Service

[Refactor] #39964 Separated autopick-finder.c/h from autopick.c/h
authorHourier <hourier@users.sourceforge.jp>
Sat, 25 Apr 2020 14:46:31 +0000 (23:46 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 25 Apr 2020 14:46:31 +0000 (23:46 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/autopick/autopick-finder.c [new file with mode: 0644]
src/autopick/autopick-finder.h [new file with mode: 0644]
src/autopick/autopick.c
src/autopick/autopick.h
src/cmd/cmd-item.c
src/io/read-pref-file.c
src/view/display-main-window.c

index 585efdf..7b1c364 100644 (file)
     <ClCompile Include="..\..\src\autopick\autopick-describer.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick-destroyer.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick-entry.c" />\r
+    <ClCompile Include="..\..\src\autopick\autopick-finder.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick-initializer.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick-matcher.c" />\r
     <ClCompile Include="..\..\src\autopick\autopick-menu-data-table.c" />\r
     <ClInclude Include="..\..\src\autopick\autopick-dirty-flags.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-editor-table.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-entry.h" />\r
+    <ClInclude Include="..\..\src\autopick\autopick-finder.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-flags-table.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-initializer.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-key-flag-process.h" />\r
index a6221ce..c0e555e 100644 (file)
     <ClCompile Include="..\..\src\autopick\autopick-reader-writer.c">
       <Filter>autopick</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\autopick\autopick-finder.c">
+      <Filter>autopick</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\gamevalue.h" />
     <ClInclude Include="..\..\src\autopick\autopick-reader-writer.h">
       <Filter>autopick</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\autopick\autopick-finder.h">
+      <Filter>autopick</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index ee57b71..965af16 100644 (file)
@@ -22,6 +22,7 @@ hengband_SOURCES = \
        autopick-describer.c autopick-describer.h \
        autopick-destroyer.c autopick-destroyer.h \
        autopick/autopick-reader-writer.c autopick/autopick-reader-writer.h \
+       autopick/autopick-finder.c autopick/autopick-finder.h \
        \
        avatar.h avatar.c birth.c birth.h \
        \
diff --git a/src/autopick/autopick-finder.c b/src/autopick/autopick-finder.c
new file mode 100644 (file)
index 0000000..1254178
--- /dev/null
@@ -0,0 +1,31 @@
+#include "angband.h"
+#include "autopick/autopick-finder.h"
+#include "autopick/autopick-util.h"
+#include "autopick/autopick-matcher.h"
+#include "object-flavor.h"
+
+/*
+ * @brief \97^\82¦\82ç\82ê\82½\83A\83C\83e\83\80\82ª\8e©\93®\8fE\82¢\82Ì\83\8a\83X\83g\82É\93o\98^\82³\82ê\82Ä\82¢\82é\82©\82Ç\82¤\82©\82ð\8c\9f\8dõ\82·\82é
+ * @param player_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
+ * @o_ptr \83A\83C\83e\83\80\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
+ * @return \8e©\93®\8fE\82¢\82Ì\83\8a\83X\83g\82É\93o\98^\82³\82ê\82Ä\82¢\82½\82ç\82»\82Ì\93o\98^\94Ô\8d\86\81A\82È\82©\82Á\82½\82ç-1
+ * @details
+ * A function for Auto-picker/destroyer
+ * Examine whether the object matches to the list of keywords or not.
+ */
+int find_autopick_list(player_type *player_ptr, object_type *o_ptr)
+{
+       GAME_TEXT o_name[MAX_NLEN];
+       if (o_ptr->tval == TV_GOLD) return -1;
+
+       object_desc(player_ptr, o_name, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
+       str_tolower(o_name);
+       for (int i = 0; i < max_autopick; i++)
+       {
+               autopick_type *entry = &autopick_list[i];
+               if (is_autopick_match(player_ptr, o_ptr, entry, o_name))
+                       return i;
+       }
+
+       return -1;
+}
diff --git a/src/autopick/autopick-finder.h b/src/autopick/autopick-finder.h
new file mode 100644 (file)
index 0000000..28213a2
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+int find_autopick_list(player_type *player_ptr, object_type *o_ptr);
index e70c8bf..5cd8d0e 100644 (file)
@@ -26,6 +26,7 @@
 #include "autopick/autopick-describer.h"
 #include "autopick/autopick-entry.h"
 #include "autopick/autopick-reader-writer.h"
+#include "autopick/autopick-finder.h"
 #include "gameterm.h"
 #include "autopick/autopick.h"
 #include "core.h"
@@ -94,33 +95,6 @@ void process_autopick_file_command(char *buf)
 
 
 /*
- * @brief 与えられたアイテムが自動拾いのリストに登録されているかどうかを検索する
- * @param player_ptr プレーヤーへの参照ポインタ
- * @o_ptr アイテムへの参照ポインタ
- * @return 自動拾いのリストに登録されていたらその登録番号、なかったら-1
- * @details
- * A function for Auto-picker/destroyer
- * Examine whether the object matches to the list of keywords or not.
- */
-int find_autopick_list(player_type *player_ptr, object_type *o_ptr)
-{
-       GAME_TEXT o_name[MAX_NLEN];
-       if (o_ptr->tval == TV_GOLD) return -1;
-
-       object_desc(player_ptr, o_name, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NO_PLURAL));
-       str_tolower(o_name);
-       for (int i = 0; i < max_autopick; i++)
-       {
-               autopick_type *entry = &autopick_list[i];
-               if (is_autopick_match(player_ptr, o_ptr, entry, o_name))
-                       return i;
-       }
-
-       return -1;
-}
-
-
-/*
  *  Auto inscription
  */
 static void auto_inscribe_item(player_type *player_ptr, object_type *o_ptr, int idx)
index 5d2c3f4..7571c61 100644 (file)
@@ -3,7 +3,6 @@
 #include "autopick/autopick-util.h"
 
 extern void process_autopick_file_command(char *buf);
-extern int find_autopick_list(player_type *player_ptr, object_type *o_ptr);
 extern void autopick_alter_item(player_type *player_ptr, INVENTORY_IDX item, bool destroy);
 extern void autopick_delayed_alter(player_type *player_ptr);
 extern void autopick_pickup_items(player_type *player_ptr, grid_type *g_ptr);
index 90cecb6..dea4ddb 100644 (file)
@@ -15,7 +15,6 @@
 #include "core.h"
 #include "util.h"
 #include "main/sound-definitions-table.h"
-#include "autopick/autopick.h"
 #include "gameterm.h"
 
 #include "selfinfo.h"
index 9bda358..95094fd 100644 (file)
@@ -18,7 +18,6 @@
 #include "io/dump-remover.h"
 #include "io/read-pref-file.h"
 #include "io/interpret-pref-file.h"
-#include "autopick/autopick.h"
 #include "files.h" // 暫定。コールバック化して後で消す.
 #include "world.h"
 
index bd5a62e..2295a2f 100644 (file)
@@ -12,8 +12,9 @@
 
 #include "angband.h"
 #include "util.h"
-#include "autopick/autopick.h"
+#include "autopick/autopick-finder.h"
 #include "autopick/autopick-methods-table.h"
+#include "autopick/autopick-util.h"
 #include "gameterm.h"
 
 #include "market/building.h"