From 486b4e3cfcd10bed78d64c14cab59effcdd8a7fc Mon Sep 17 00:00:00 2001 From: mogami Date: Wed, 8 May 2002 07:39:07 +0000 Subject: [PATCH] =?utf8?q?can=5Fplayer=5Fdestroy=5Fobject()=E3=81=AEextern?= =?utf8?q?=E5=AE=A3=E8=A8=80=E3=81=8C=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?utf8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82=E3=81=A4=E3=81=84?= =?utf8?q?=E3=81=A7=E3=81=AB=20=E4=BB=96=E3=81=AE=E5=A0=B4=E6=89=80?= =?utf8?q?=E3=81=A7=E3=81=93=E3=81=AE=E9=96=A2=E6=95=B0=E3=81=A8=E5=90=8C?= =?utf8?q?=E3=81=98=E5=87=A6=E7=90=86=E3=82=92=E3=81=97=E3=81=A6=E3=81=84?= =?utf8?q?=E3=82=8B=E3=81=A8=E3=81=93=E3=82=8D=E3=82=92=E3=81=93=E3=81=AE?= =?utf8?q?=E9=96=A2=E6=95=B0=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B?= =?utf8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd1.c | 33 --------------------------------- src/cmd3.c | 22 +--------------------- src/externs.h | 1 + src/object2.c | 33 +++++++++++++++++++++++++++++++++ src/spells3.c | 22 ++-------------------- 5 files changed, 37 insertions(+), 74 deletions(-) diff --git a/src/cmd1.c b/src/cmd1.c index 9a330612d..288541c4b 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -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. diff --git a/src/cmd3.c b/src/cmd3.c index e5c068d76..d5f4bc25f 100644 --- a/src/cmd3.c +++ b/src/cmd3.c @@ -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; } diff --git a/src/externs.h b/src/externs.h index 04a612449..65d072861 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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); diff --git a/src/object2.c b/src/object2.c index 024e4fb77..04386dce6 100644 --- a/src/object2.c +++ b/src/object2.c @@ -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 diff --git a/src/spells3.c b/src/spells3.c index fd0f2f29c..da100ac85 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -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; } -- 2.11.0