OSDN Git Service

can_player_destroy_object()のextern宣言がなかったのを修正。ついでに
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 8 May 2002 07:39:07 +0000 (07:39 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 8 May 2002 07:39:07 +0000 (07:39 +0000)
他の場所でこの関数と同じ処理をしているところをこの関数を使用するように修正。

src/cmd1.c
src/cmd3.c
src/externs.h
src/object2.c
src/spells3.c

index 9a33061..288541c 100644 (file)
@@ -771,39 +771,6 @@ void py_pickup_aux(int o_idx)
 }
 
 
-bool can_player_destroy_object(object_type *o_ptr)
-{
-       /* Artifacts cannot be destroyed */
-       if (artifact_p(o_ptr) || o_ptr->art_name)
-       {
-               byte feel = FEEL_SPECIAL;
-
-               /* Hack -- Handle icky artifacts */
-               if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
-
-               /* Hack -- inscribe the artifact */
-               o_ptr->feeling = feel;
-
-               /* We have "felt" it (again) */
-               o_ptr->ident |= (IDENT_SENSE);
-
-               /* Combine the pack */
-               p_ptr->notice |= (PN_COMBINE);
-
-               /* Redraw equippy chars */
-               p_ptr->redraw |= (PR_EQUIPPY);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-               /* Done */
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-
 /*
  * Player "wants" to pick up an object or gold.
  * Note that we ONLY handle things that can be picked up.
index e5c068d..d5f4bc2 100644 (file)
@@ -1010,10 +1010,8 @@ void do_cmd_destroy(void)
        energy_use = 100;
 
        /* Artifacts cannot be destroyed */
-       if (artifact_p(o_ptr) || o_ptr->art_name)
+       if (!can_player_destroy_object(o_ptr))
        {
-               byte feel = FEEL_SPECIAL;
-
                energy_use = 0;
 
                /* Message */
@@ -1023,24 +1021,6 @@ void do_cmd_destroy(void)
                msg_format("You cannot destroy %s.", o_name);
 #endif
 
-
-               /* Hack -- Handle icky artifacts */
-               if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
-
-               /* Hack -- inscribe the artifact */
-               o_ptr->feeling = feel;
-
-               /* We have "felt" it (again) */
-               o_ptr->ident |= (IDENT_SENSE);
-
-               /* Combine the pack */
-               p_ptr->notice |= (PN_COMBINE);
-
-               p_ptr->redraw |= (PR_EQUIPPY);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
                /* Done */
                return;
        }
index 04a6124..65d0728 100644 (file)
@@ -883,6 +883,7 @@ extern void object_aware(object_type *o_ptr);
 extern void object_tried(object_type *o_ptr);
 extern s32b object_value(object_type *o_ptr);
 extern s32b object_value_real(object_type *o_ptr);
+extern bool can_player_destroy_object(object_type *o_ptr);
 extern void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
 extern void reduce_charges(object_type *o_ptr, int amt);
 extern bool object_similar(object_type *o_ptr, object_type *j_ptr);
index 024e4fb..04386dc 100644 (file)
@@ -1423,6 +1423,39 @@ s32b object_value(object_type *o_ptr)
 
 
 /*
+ * Determines whether an object can be destroyed, and makes fake inscription.
+ */
+bool can_player_destroy_object(object_type *o_ptr)
+{
+       /* Artifacts cannot be destroyed */
+       if (artifact_p(o_ptr) || o_ptr->art_name)
+       {
+               byte feel = FEEL_SPECIAL;
+
+               /* Hack -- Handle icky artifacts */
+               if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
+
+               /* Hack -- inscribe the artifact */
+               o_ptr->feeling = feel;
+
+               /* We have "felt" it (again) */
+               o_ptr->ident |= (IDENT_SENSE);
+
+               /* Combine the pack */
+               p_ptr->notice |= (PN_COMBINE);
+
+               /* Window stuff */
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+
+               /* Done */
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+/*
  * Distribute charges of rods or wands.
  *
  * o_ptr = source item
index fd0f2f2..da100ac 100644 (file)
@@ -1905,33 +1905,15 @@ sprintf(out_val, "
        }
 
        /* Artifacts cannot be destroyed */
-       if (artifact_p(o_ptr) || o_ptr->art_name)
+       if (!can_player_destroy_object(o_ptr))
        {
-               byte feel = FEEL_SPECIAL;
-
                /* Message */
 #ifdef JP
-msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
+               msg_format("%s¤ò¶â¤ËÊѤ¨¤ë¤³¤È¤Ë¼ºÇÔ¤·¤¿¡£", o_name);
 #else
                msg_format("You fail to turn %s to gold!", o_name);
 #endif
 
-
-               /* Hack -- Handle icky artifacts */
-               if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = FEEL_TERRIBLE;
-
-               /* Hack -- inscribe the artifact */
-               o_ptr->feeling = feel;
-
-               /* We have "felt" it (again) */
-               o_ptr->ident |= (IDENT_SENSE);
-
-               /* Combine the pack */
-               p_ptr->notice |= (PN_COMBINE);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
                /* Done */
                return FALSE;
        }