OSDN Git Service

{=g}の処理の仕方を変えて、ハードコードでいちいち判定しないで、
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 18 May 2002 16:39:52 +0000 (16:39 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 18 May 2002 16:39:52 +0000 (16:39 +0000)
自動拾いの登録リストの一番最初に「(:=g」を強制的に入れるようにした。

src/autopick.c
src/cmd4.c
src/dungeon.c
src/externs.h

index 6efa274..0c17e23 100644 (file)
@@ -774,33 +774,6 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
 
 
 /*
- * Determines whether an item has '=g' in its inscription for easy-auto-picker
- */
-static bool is_autopick2( object_type *o_ptr) {
-      cptr s;
-
-      /* No inscription */
-      if (!o_ptr->inscription) return (FALSE);
-
-      /* Find a '=' */
-      s = strchr(quark_str(o_ptr->inscription), '=');
-
-      /* Process inscription */
-      while (s)
-      {
-              /* Auto-pickup on "=g" */
-              if (s[1] == 'g') return (TRUE);
-
-              /* Find another '=' */
-              s = strchr(s + 1, '=');
-      }
-
-      /* Don't auto-pickup */
-      return (FALSE);
-}
-
-
-/*
  *  Auto inscription
  */
 void auto_inscribe_item(s16b item, int idx)
@@ -848,9 +821,6 @@ bool auto_destroy_item(s16b item, int autopick_idx)
        /* Get the item (on the floor) */
        else o_ptr = &o_list[0 - item];
 
-       /* Don't destroy an item inscribed {=g} */
-       if (is_autopick2(o_ptr)) return FALSE;
-
        if ((autopick_idx == -1 && is_opt_confirm_destroy(o_ptr)) ||
            (autopick_idx >= 0 && (autopick_list[autopick_idx].action & DO_AUTODESTROY)))
        {
@@ -927,8 +897,7 @@ void auto_pickup_items(cave_type *c_ptr)
                /* Item index for floor -1,-2,-3,...  */
                auto_inscribe_item((-this_o_idx), idx);
 
-               if (is_autopick2(o_ptr) ||
-                   (idx >= 0 && (autopick_list[idx].action & DO_AUTOPICK)))
+               if (idx >= 0 && (autopick_list[idx].action & DO_AUTOPICK))
                {
                        disturb(0,0);
 
@@ -1860,6 +1829,27 @@ static bool entry_from_object(autopick_type *entry)
 
 
 /*
+ * Initialize auto-picker preference
+ */
+void init_autopicker(void)
+{
+       static const char easy_autopick_inscription[] = "(:=g";
+       autopick_type entry;
+       int i;
+
+       /* Clear old entries */
+       for( i = 0; i < max_autopick; i++)
+               autopick_free_entry(&autopick_list[i]);
+
+       max_autopick = 0;
+
+       /* There is always one entry "=g" */
+       autopick_new_entry(&entry, easy_autopick_inscription);
+       autopick_list[max_autopick++] = entry;
+}
+
+
+/*
  * Description of control commands
  */
 
@@ -1951,6 +1941,9 @@ void do_cmd_edit_autopick()
 
        int wid, hgt, old_wid = -1, old_hgt = -1;
 
+       /* Free old entries */
+       init_autopicker();
+
        /* Name of the Last Destroyed Item */
        last_destroyed = autopick_line_from_entry(&autopick_entry_last_destroyed);
 
@@ -2750,11 +2743,6 @@ void do_cmd_edit_autopick()
        write_text_lines(buf, lines_list);
        free_text_lines(lines_list);
 
-       /* Clear old entries */
-       for( i = 0; i < max_autopick; i++)
-               autopick_free_entry(&autopick_list[i]);
-       max_autopick = 0;
-
        string_free(last_destroyed);
 
        /* Reload autopick pref */
index 0ca1ec0..2123091 100644 (file)
@@ -2413,10 +2413,9 @@ void do_cmd_pickpref(void)
 #else
        if(!get_check("Reload auto-pick preference file? ")) return;
 #endif
-       /* ¤¤¤Þ¤Þ¤Ç»È¤Ã¤Æ¤¤¤¿¥á¥â¥ê²òÊü */
-       for( i = 0; i < max_autopick; i++)
-               autopick_free_entry(&autopick_list[i]);
-       max_autopick = 0;
+
+       /* Free old entries */
+       init_autopicker();
 
        /* ¥­¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
 #ifdef JP
index ded519f..06f5538 100644 (file)
@@ -6104,6 +6104,9 @@ static void load_all_pref_files(void)
        /* Process that file */
        process_pref_file(buf);
 
+       /* Free old entries */
+       init_autopicker();
+
 #ifdef JP
         sprintf(buf, "picktype-%s.prf", player_base);
 #else
index e4f8a94..ffe3bfd 100644 (file)
@@ -549,6 +549,7 @@ extern void auto_inscribe_item(s16b item, int idx);
 extern bool auto_destroy_item(s16b item, int autopick_idx);
 extern void auto_pickup_items(cave_type *c_ptr);
 extern void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr);
+extern void init_autopicker(void);
 extern void do_cmd_edit_autopick();
 
 /* birth.c */