OSDN Git Service

always_pickupがオンのとき、自動拾い/破壊の設定による破壊だけを無視して
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 2 Jun 2002 19:55:47 +0000 (19:55 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 2 Jun 2002 19:55:47 +0000 (19:55 +0000)
簡易自動破壊オプションの破壊は適用するようにするはず(したつもり)だったのに、
適用されていなかったので修正。

src/autopick.c

index 95eabb5..d19ebc4 100644 (file)
@@ -898,9 +898,11 @@ void auto_inscribe_item(int item, int idx)
 
 /*
  * Automatically destroy an item if it is to be destroyed
+ *
  */
 bool auto_destroy_item(int item, int autopick_idx)
 {
+       bool destroy = FALSE;
        char o_name[MAX_NLEN];
        object_type *o_ptr;
 
@@ -913,56 +915,73 @@ bool auto_destroy_item(int item, int autopick_idx)
        /* Get the item (on the floor) */
        else o_ptr = &o_list[0 - item];
 
-       if ((autopick_idx == -1 && is_opt_confirm_destroy(o_ptr)) ||
-           (autopick_idx >= 0 && (autopick_list[autopick_idx].action & DO_AUTODESTROY)))
+       /* Easy-Auto-Destroyer */
+       if (is_opt_confirm_destroy(o_ptr)) destroy = TRUE;
+
+       if (always_pickup)
+       {
+               /* Protected by auto-picker */
+               if (autopick_idx >= 0 &&
+                   !(autopick_list[autopick_idx].action & DO_AUTODESTROY))
+                       destroy = FALSE;
+       }
+       else
        {
-               disturb(0,0);
+               /* Auto-picker/destroyer */
+               if (autopick_idx >= 0 &&
+                   (autopick_list[autopick_idx].action & DO_AUTODESTROY))
+                       destroy = TRUE;
+       }
 
-               /* Describe the object (with {terrible/special}) */
-               object_desc(o_name, o_ptr, TRUE, 3);
+       /* Not to be destroyed */
+       if (!destroy) return FALSE;
 
-               /* Artifact? */
-               if (!can_player_destroy_object(o_ptr))
-               {
-                       /* Message */
+       /* Now decided to destroy */
+
+       disturb(0,0);
+
+       /* Describe the object (with {terrible/special}) */
+       object_desc(o_name, o_ptr, TRUE, 3);
+
+       /* Artifact? */
+       if (!can_player_destroy_object(o_ptr))
+       {
+               /* Message */
 #ifdef JP
-                       msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
+               msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
 #else
-                       msg_format("You cannot auto-destroy %s.", o_name);
+               msg_format("You cannot auto-destroy %s.", o_name);
 #endif
 
-                       /* Done */
-                       return TRUE;
-               }
+               /* Done */
+               return TRUE;
+       }
 
-               /* Record name of destroyed item */
-               autopick_free_entry(&autopick_entry_last_destroyed);
-               autopick_entry_from_object(&autopick_entry_last_destroyed, o_ptr);
+       /* Record name of destroyed item */
+       autopick_free_entry(&autopick_entry_last_destroyed);
+       autopick_entry_from_object(&autopick_entry_last_destroyed, o_ptr);
 
-               /* Eliminate the item (from the pack) */
-               if (item >= 0)
-               {
-                       inven_item_increase(item, -(o_ptr->number));
-                       inven_item_optimize(item);
-               }
+       /* Eliminate the item (from the pack) */
+       if (item >= 0)
+       {
+               inven_item_increase(item, -(o_ptr->number));
+               inven_item_optimize(item);
+       }
 
-               /* Eliminate the item (from the floor) */
-               else
-               {
-                       delete_object_idx(0 - item);
-               }
+       /* Eliminate the item (from the floor) */
+       else
+       {
+               delete_object_idx(0 - item);
+       }
 
-               /* Print a message */
+       /* Print a message */
 #ifdef JP
-               msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
+       msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
 #else
-               msg_format("Auto-destroying %s.", o_name);
+       msg_format("Auto-destroying %s.", o_name);
 #endif
                        
-               return TRUE;
-       }
-
-       return FALSE;
+       return TRUE;
 }
 
 
@@ -1021,7 +1040,7 @@ void auto_pickup_items(cave_type *c_ptr)
                 */
                else
                {
-                       if (auto_destroy_item((-this_o_idx), (!always_pickup ? idx : -2)))
+                       if (auto_destroy_item((-this_o_idx), idx))
                                continue;
                }
        }