OSDN Git Service

[Refactor] #39076 冗長なコメントを削除 (/* Extract the item level */)
[hengband/hengband.git] / src / autopick.c
index 587c767..3487659 100644 (file)
 
 #include "angband.h"
 #include "util.h"
+#include "term.h"
+#include "autopick.h"
+#include "core.h"
 
 #include "mind.h"
 
 #include "store.h"
 #include "player-status.h"
 #include "player-move.h"
+#include "player-class.h"
+#include "player-race.h"
+#include "objectkind.h"
+#include "object-ego.h"
 #include "object-flavor.h"
 #include "object-hook.h"
 
 #include "files.h"
 #include "floor.h"
 #include "world.h"
+#include "monster.h"
+#include "monsterrace.h"
+#include "view-mainwindow.h"
 
 #define MAX_LINELEN 1024
 
@@ -212,6 +222,13 @@ static GAME_TEXT KEY_BOOTS[] = "boots";
 
 
 /*
+ * 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
+ */
+int max_autopick = 0; /*!< 現在登録している自動拾い/破壊設定の数 */
+int max_max_autopick = 0; /*!< 自動拾い/破壊設定の限界数 */
+autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
+
+/*
  * A function to create new entry
  */
 static bool autopick_new_entry(autopick_type *entry, concptr str, bool allow_default)
@@ -753,7 +770,7 @@ static concptr pickpref_filename(int filename_mode)
                return format("%s.prf", namebase);
 
        case PT_WITH_PNAME:
-               return format("%s-%s.prf", namebase, player_base);
+               return format("%s-%s.prf", namebase, p_ptr->base_name);
 
        default:
                return NULL;
@@ -1428,11 +1445,11 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, concptr o_
        {
                /*
                 * 'Collecting' means the item must be absorbed 
-                * into an inventory slot.
+                * into an p_ptr->inventory_list slot.
                 * But an item can not be absorbed into itself!
                 */
-               if ((&inventory[j] != o_ptr) &&
-                   object_similar(&inventory[j], o_ptr))
+               if ((&p_ptr->inventory_list[j] != o_ptr) &&
+                   object_similar(&p_ptr->inventory_list[j], o_ptr))
                        return TRUE;
        }
 
@@ -1623,7 +1640,7 @@ static void autopick_delayed_alter_aux(INVENTORY_IDX item)
        object_type *o_ptr;
 
        /* Get the item (in the pack) */
-       if (item >= 0) o_ptr = &inventory[item];
+       if (item >= 0) o_ptr = &p_ptr->inventory_list[item];
 
        /* Get the item (on the floor) */
        else o_ptr = &current_floor_ptr->o_list[0 - item];
@@ -1681,7 +1698,7 @@ void autopick_delayed_alter(void)
 /*
  * Auto-inscription and/or destroy
  *
- * Auto-destroyer works only on inventory or on floor stack only when
+ * Auto-destroyer works only on p_ptr->inventory_list or on floor stack only when
  * requested.
  */
 void autopick_alter_item(INVENTORY_IDX item, bool destroy)
@@ -1690,7 +1707,7 @@ void autopick_alter_item(INVENTORY_IDX item, bool destroy)
        int idx;
 
        /* Get the item (in the pack) */
-       if (item >= 0) o_ptr = &inventory[item];
+       if (item >= 0) o_ptr = &p_ptr->inventory_list[item];
 
        /* Get the item (on the floor) */
        else o_ptr = &current_floor_ptr->o_list[0 - item];
@@ -2404,7 +2421,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        /*** Collecting items ***/
        /*** Which can be absorbed into a slot as a bundle ***/
        if (IS_FLG(FLG_COLLECTING))
-               which_str[which_n++] = "can be absorbed into an existing inventory slot";
+               which_str[which_n++] = "can be absorbed into an existing p_ptr->inventory_list slot";
        
        /*** Unaware items ***/
        if (IS_FLG(FLG_UNAWARE))
@@ -3254,7 +3271,7 @@ static bool entry_from_choosed_object(autopick_type *entry)
 
        q = _("どのアイテムを登録しますか? ", "Enter which item? ");
        s = _("アイテムを持っていない。", "You have nothing to enter.");
-       o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP);
+       o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0);
        if (!o_ptr) return FALSE;
 
        autopick_entry_from_object(entry, o_ptr);
@@ -3273,7 +3290,7 @@ static byte get_object_for_search(object_type **o_handle, concptr *search_strp)
 
        q = _("どのアイテムを検索しますか? ", "Enter which item? ");
        s = _("アイテムを持っていない。", "You have nothing to enter.");
-       o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP);
+       o_ptr = choose_object(NULL, q, s, USE_INVEN | USE_FLOOR | USE_EQUIP, 0);
        if (!o_ptr) return 0;
 
        *o_handle = o_ptr;
@@ -3952,7 +3969,7 @@ static GAME_TEXT MN_SEARCH[] = "Search";
 static GAME_TEXT MN_SEARCH_STR[] = "Search by string";
 static GAME_TEXT MN_SEARCH_FORW[] = "Search forward";
 static GAME_TEXT MN_SEARCH_BACK[] = "Search backward";
-static GAME_TEXT MN_SEARCH_OBJ[] = "Search by inventory object";
+static GAME_TEXT MN_SEARCH_OBJ[] = "Search by p_ptr->inventory_list object";
 static GAME_TEXT MN_SEARCH_DESTROYED[] = "Search by destroyed object";
 
 static GAME_TEXT MN_INSERT[] = "Insert...";
@@ -6014,7 +6031,7 @@ void do_cmd_edit_autopick(void)
                old_autosave_turn = current_world_ptr->game_turn;
        }
 
-       /* HACK -- Reset start_time to stop counting current_world_ptr->play_time while edit */
+       /* HACK -- Reset current_world_ptr->start_time to stop counting current_world_ptr->play_time while edit */
        update_playtime();
 
        /* Free old entries */
@@ -6140,8 +6157,8 @@ void do_cmd_edit_autopick(void)
        /* Reload autopick pref */
        process_autopick_file(buf);
 
-       /* HACK -- reset start_time so that current_world_ptr->play_time is not increase while edit */
-       start_time = (u32b)time(NULL);
+       /* HACK -- reset current_world_ptr->start_time so that current_world_ptr->play_time is not increase while edit */
+       current_world_ptr->start_time = (u32b)time(NULL);
 
        /* Save cursor location */
        cx_save = tb->cx;