<ItemGroup>\r
<ClCompile Include="..\..\src\artifact.c" />\r
<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-initializer.c" />\r
<ClCompile Include="..\..\src\autopick\autopick-matcher.c" />\r
<ClInclude Include="..\..\src\artifact.h" />\r
<ClInclude Include="..\..\src\autopick\autopick-commands-table.h" />\r
<ClInclude Include="..\..\src\autopick\autopick-describer.h" />\r
+ <ClInclude Include="..\..\src\autopick\autopick-destroyer.h" />\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
<ClCompile Include="..\..\src\view\display-main-window.c">
<Filter>view</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\autopick\autopick-destroyer.c">
+ <Filter>autopick</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\gamevalue.h" />
<ClInclude Include="..\..\src\view\display-main-window.h">
<Filter>view</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\autopick\autopick-destroyer.h">
+ <Filter>autopick</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
autopick/autopick-initializer.c autopick/autopick-initializer.h \
autopick/autopick-matcher.c autopick/autopick-matcher.h \
autopick-describer.c autopick-describer.h \
+ autopick-destroyer.c autopick-destroyer.h \
\
avatar.h avatar.c birth.c birth.h \
\
--- /dev/null
+#include "angband.h"
+#include "autopick/autopick-util.h"
+#include "autopick-methods-table.h"
+#include "autopick/autopick-destroyer.h"
+#include "object-ego.h"
+#include "object-hook.h"
+#include "object/object-kind.h"
+#include "object-flavor.h"
+#include "player-move.h"
+
+/*
+ * Automatically destroy items in this grid.
+ */
+static bool is_opt_confirm_destroy(player_type *player_ptr, object_type *o_ptr)
+{
+ if (!destroy_items) return FALSE;
+
+ if (leave_worth)
+ if (object_value(o_ptr) > 0) return FALSE;
+
+ if (leave_equip)
+ if (object_is_weapon_armour_ammo(o_ptr)) return FALSE;
+
+ if (leave_chest)
+ if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
+
+ if (leave_wanted)
+ {
+ if (object_is_bounty(o_ptr)) return FALSE;
+ }
+
+ if (leave_corpse)
+ if (o_ptr->tval == TV_CORPSE) return FALSE;
+
+ if (leave_junk)
+ if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
+
+ if (leave_special)
+ {
+ if (player_ptr->prace == RACE_DEMON)
+ {
+ if (o_ptr->tval == TV_CORPSE &&
+ o_ptr->sval == SV_CORPSE &&
+ my_strchr("pht", r_info[o_ptr->pval].d_char))
+ return FALSE;
+ }
+
+ if (player_ptr->pclass == CLASS_ARCHER)
+ {
+ if (o_ptr->tval == TV_SKELETON ||
+ (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
+ return FALSE;
+ }
+ else if (player_ptr->pclass == CLASS_NINJA)
+ {
+ if (o_ptr->tval == TV_LITE &&
+ o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
+ return FALSE;
+ }
+ else if (player_ptr->pclass == CLASS_BEASTMASTER ||
+ player_ptr->pclass == CLASS_CAVALRY)
+ {
+ if (o_ptr->tval == TV_WAND &&
+ o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
+ return FALSE;
+ }
+ }
+
+ if (o_ptr->tval == TV_GOLD) return FALSE;
+
+ return TRUE;
+}
+
+
+void auto_destroy_item(player_type *player_ptr, object_type *o_ptr, int autopick_idx)
+{
+ bool destroy = FALSE;
+ if (is_opt_confirm_destroy(player_ptr, o_ptr)) destroy = TRUE;
+
+ if (autopick_idx >= 0 &&
+ !(autopick_list[autopick_idx].action & DO_AUTODESTROY))
+ destroy = FALSE;
+
+ if (!always_pickup)
+ {
+ if (autopick_idx >= 0 &&
+ (autopick_list[autopick_idx].action & DO_AUTODESTROY))
+ destroy = TRUE;
+ }
+
+ if (!destroy) return;
+
+ disturb(player_ptr, FALSE, FALSE);
+ if (!can_player_destroy_object(o_ptr))
+ {
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(player_ptr, o_name, o_ptr, 0);
+ msg_format(_("%s\82Í\94j\89ó\95s\94\\82¾\81B", "You cannot auto-destroy %s."), o_name);
+ return;
+ }
+
+ (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
+ o_ptr->marked |= OM_AUTODESTROY;
+ player_ptr->update |= PU_AUTODESTROY;
+}
--- /dev/null
+#pragma once
+
+void auto_destroy_item(player_type *player_ptr, object_type *o_ptr, int autopick_idx);
autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
/*
+ * Automatically destroy an item if it is to be destroyed
+ *
+ * When always_pickup is 'yes', we disable auto-destroyer function of
+ * auto-picker/destroyer, and do only easy-auto-destroyer.
+ */
+object_type autopick_last_destroyed_object;
+
+/*
* A function to delete entry
*/
void autopick_free_entry(autopick_type *entry)
extern int max_autopick;
extern int max_max_autopick;
extern autopick_type *autopick_list;
+extern object_type autopick_last_destroyed_object;
void autopick_free_entry(autopick_type *entry);
#include "autopick/autopick-menu-data-table.h"
#include "autopick/autopick-methods-table.h"
#include "autopick/autopick-keys-table.h"
+#include "autopick/autopick-destroyer.h"
#include "autopick/autopick-describer.h"
#include "autopick/autopick-entry.h"
#include "gameterm.h"
#include "view/display-main-window.h" // 暫定。後で消す
/*
- * Automatically destroy an item if it is to be destroyed
- *
- * When always_pickup is 'yes', we disable auto-destroyer function of
- * auto-picker/destroyer, and do only easy-auto-destroyer.
- */
-static object_type autopick_last_destroyed_object;
-
-/*
* Get file name for autopick preference
*/
static concptr pickpref_filename(player_type *player_ptr, int filename_mode)
/*
- * Automatically destroy items in this grid.
- */
-static bool is_opt_confirm_destroy(player_type *player_ptr, object_type *o_ptr)
-{
- if (!destroy_items) return FALSE;
-
- if (leave_worth)
- if (object_value(o_ptr) > 0) return FALSE;
-
- if (leave_equip)
- if (object_is_weapon_armour_ammo(o_ptr)) return FALSE;
-
- if (leave_chest)
- if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-
- if (leave_wanted)
- {
- if (object_is_bounty(o_ptr)) return FALSE;
- }
-
- if (leave_corpse)
- if (o_ptr->tval == TV_CORPSE) return FALSE;
-
- if (leave_junk)
- if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
-
- if (leave_special)
- {
- if (player_ptr->prace == RACE_DEMON)
- {
- if (o_ptr->tval == TV_CORPSE &&
- o_ptr->sval == SV_CORPSE &&
- my_strchr("pht", r_info[o_ptr->pval].d_char))
- return FALSE;
- }
-
- if (player_ptr->pclass == CLASS_ARCHER)
- {
- if (o_ptr->tval == TV_SKELETON ||
- (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
- return FALSE;
- }
- else if (player_ptr->pclass == CLASS_NINJA)
- {
- if (o_ptr->tval == TV_LITE &&
- o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
- return FALSE;
- }
- else if (player_ptr->pclass == CLASS_BEASTMASTER ||
- player_ptr->pclass == CLASS_CAVALRY)
- {
- if (o_ptr->tval == TV_WAND &&
- o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
- return FALSE;
- }
- }
-
- if (o_ptr->tval == TV_GOLD) return FALSE;
-
- return TRUE;
-}
-
-
-static void auto_destroy_item(player_type *player_ptr, object_type *o_ptr, int autopick_idx)
-{
- bool destroy = FALSE;
- if (is_opt_confirm_destroy(player_ptr, o_ptr)) destroy = TRUE;
-
- if (autopick_idx >= 0 &&
- !(autopick_list[autopick_idx].action & DO_AUTODESTROY))
- destroy = FALSE;
-
- if (!always_pickup)
- {
- if (autopick_idx >= 0 &&
- (autopick_list[autopick_idx].action & DO_AUTODESTROY))
- destroy = TRUE;
- }
-
- if (!destroy) return;
-
- disturb(player_ptr, FALSE, FALSE);
- if (!can_player_destroy_object(o_ptr))
- {
- GAME_TEXT o_name[MAX_NLEN];
- object_desc(player_ptr, o_name, o_ptr, 0);
- msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
- return;
- }
-
- (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
- o_ptr->marked |= OM_AUTODESTROY;
- player_ptr->update |= PU_AUTODESTROY;
-}
-
-
-/*
* Auto-destroy marked item
*/
static void autopick_delayed_alter_aux(player_type *player_ptr, INVENTORY_IDX item)