From e7ce89a41666574b966663da2756f4efa3fa6b41 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 26 Apr 2020 13:58:46 +0900 Subject: [PATCH] [Refactor] Unified autopick-adder.c/h into utopick-util.c/h --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 2 -- Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 12 +++--------- src/Makefile.am | 1 - src/autopick/autopick-adder.c | 22 ---------------------- src/autopick/autopick-adder.h | 3 --- src/autopick/autopick-pref-processor.c | 1 - src/autopick/autopick-registry.c | 1 - src/autopick/autopick-util.c | 20 ++++++++++++++++++++ src/autopick/autopick-util.h | 1 + 9 files changed, 24 insertions(+), 39 deletions(-) delete mode 100644 src/autopick/autopick-adder.c delete mode 100644 src/autopick/autopick-adder.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index a2f819ed4..8f29fe97b 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -149,7 +149,6 @@ - @@ -305,7 +304,6 @@ - diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 848c4262a..f7f88751d 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -625,9 +625,6 @@ autopick - - autopick - io @@ -664,9 +661,6 @@ autopick - - autopick - autopick @@ -691,6 +685,9 @@ cmd + + autopick + @@ -1358,9 +1355,6 @@ autopick - - autopick - autopick diff --git a/src/Makefile.am b/src/Makefile.am index 696457b6f..71364231f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,6 @@ hengband_SOURCES = \ autopick-destroyer.c autopick-destroyer.h \ autopick/autopick-reader-writer.c autopick/autopick-reader-writer.h \ autopick/autopick-finder.c autopick/autopick-finder.h \ - autopick/autopick-adder.c autopick/autopick-adder.h \ autopick/autopick-pref-processor.c autopick/autopick-pref-processor.h \ autopick/autopick-drawer.c autopick/autopick-drawer.h \ autopick/autopick-inserter-killer.c autopick/autopick-inserter-killer.h \ diff --git a/src/autopick/autopick-adder.c b/src/autopick/autopick-adder.c deleted file mode 100644 index cc33ceb22..000000000 --- a/src/autopick/autopick-adder.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "angband.h" -#include "autopick/autopick-util.h" -#include "autopick/autopick-adder.h" - -/* - * Add one line to autopick_list[] - */ -void add_autopick_list(autopick_type *entry) -{ - if (max_autopick >= max_max_autopick) - { - int old_max_max_autopick = max_max_autopick; - autopick_type *old_autopick_list = autopick_list; - max_max_autopick += MAX_AUTOPICK_DEFAULT; - C_MAKE(autopick_list, max_max_autopick, autopick_type); - (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type); - C_KILL(old_autopick_list, old_max_max_autopick, autopick_type); - } - - autopick_list[max_autopick] = *entry; - max_autopick++; -} diff --git a/src/autopick/autopick-adder.h b/src/autopick/autopick-adder.h deleted file mode 100644 index 7731a6e86..000000000 --- a/src/autopick/autopick-adder.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -void add_autopick_list(autopick_type *entry); diff --git a/src/autopick/autopick-pref-processor.c b/src/autopick/autopick-pref-processor.c index 9590a1efc..a6fbd4ed1 100644 --- a/src/autopick/autopick-pref-processor.c +++ b/src/autopick/autopick-pref-processor.c @@ -1,7 +1,6 @@ #include "angband.h" #include "autopick/autopick-pref-processor.h" #include "autopick/autopick-util.h" -#include "autopick/autopick-adder.h" #include "autopick/autopick-entry.h" /* diff --git a/src/autopick/autopick-registry.c b/src/autopick/autopick-registry.c index c196599d5..035008963 100644 --- a/src/autopick/autopick-registry.c +++ b/src/autopick/autopick-registry.c @@ -11,7 +11,6 @@ #include "autopick/autopick-reader-writer.h" #include "autopick/autopick-entry.h" #include "autopick/autopick-finder.h" -#include "autopick/autopick-adder.h" #include "object-hook.h" #include "object/object-kind.h" #include "object-flavor.h" diff --git a/src/autopick/autopick-util.c b/src/autopick/autopick-util.c index deb6bee08..8b8b5a430 100644 --- a/src/autopick/autopick-util.c +++ b/src/autopick/autopick-util.c @@ -74,3 +74,23 @@ void auto_inscribe_item(player_type *player_ptr, object_type *o_ptr, int idx) player_ptr->window |= (PW_EQUIP | PW_INVEN); player_ptr->update |= (PU_BONUS); } + + +/* + * Add one line to autopick_list[] + */ +void add_autopick_list(autopick_type *entry) +{ + if (max_autopick >= max_max_autopick) + { + int old_max_max_autopick = max_max_autopick; + autopick_type *old_autopick_list = autopick_list; + max_max_autopick += MAX_AUTOPICK_DEFAULT; + C_MAKE(autopick_list, max_max_autopick, autopick_type); + (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type); + C_KILL(old_autopick_list, old_max_max_autopick, autopick_type); + } + + autopick_list[max_autopick] = *entry; + max_autopick++; +} diff --git a/src/autopick/autopick-util.h b/src/autopick/autopick-util.h index 4ba52b5bf..2a17ead89 100644 --- a/src/autopick/autopick-util.h +++ b/src/autopick/autopick-util.h @@ -84,3 +84,4 @@ void autopick_free_entry(autopick_type *entry); void free_text_lines(concptr *lines_list); int get_com_id(char key); void auto_inscribe_item(player_type *player_ptr, object_type *o_ptr, int idx); +void add_autopick_list(autopick_type *entry); -- 2.11.0