From e733adf7572822dce4526311e2c4bb09e309b0a1 Mon Sep 17 00:00:00 2001 From: Hourier Date: Fri, 21 Aug 2020 14:02:52 +0900 Subject: [PATCH] [Refactor] #40653 Separated spells-nature.c/h from spells-object.c/h --- Hengband/Hengband/Hengband.vcxproj | 2 ++ Hengband/Hengband/Hengband.vcxproj.filters | 6 ++++ src/Makefile.am | 1 + src/realm/realm-nature.c | 1 + src/spell-realm/spells-nature.c | 48 ++++++++++++++++++++++++++++++ src/spell-realm/spells-nature.h | 5 ++++ src/spell/spells-object.c | 44 --------------------------- src/spell/spells-object.h | 1 - 8 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 src/spell-realm/spells-nature.c create mode 100644 src/spell-realm/spells-nature.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index 91352a722..1578973a2 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -408,6 +408,7 @@ + @@ -1069,6 +1070,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index a053e5d95..24edde6d1 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -2162,6 +2162,9 @@ mind + + spell-realm + @@ -4678,6 +4681,9 @@ mind + + spell-realm + diff --git a/src/Makefile.am b/src/Makefile.am index 7e4d515b0..75f09ff8d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -755,6 +755,7 @@ hengband_SOURCES = \ spell-realm/spells-crusade.c spell-realm/spells-crusade.h \ spell-realm/spells-demon.c spell-realm/spells-demon.h \ spell-realm/spells-hex.c spell-realm/spells-hex.h \ + spell-realm/spells-nature.c spell-realm/spells-nature.h \ spell-realm/spells-song.c spell-realm/spells-song.h \ spell-realm/spells-sorcery.c spell-realm/spells-sorcery.h \ spell-realm/spells-trump.c spell-realm/spells-trump.h \ diff --git a/src/realm/realm-nature.c b/src/realm/realm-nature.c index 4cb0f0b04..b038f170d 100644 --- a/src/realm/realm-nature.c +++ b/src/realm/realm-nature.c @@ -25,6 +25,7 @@ #include "spell-kind/spells-neighbor.h" #include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" +#include "spell-realm/spells-nature.h" #include "spell/spell-types.h" #include "spell/spells-diceroll.h" #include "spell/spells-object.h" diff --git a/src/spell-realm/spells-nature.c b/src/spell-realm/spells-nature.c new file mode 100644 index 000000000..32535f904 --- /dev/null +++ b/src/spell-realm/spells-nature.c @@ -0,0 +1,48 @@ +#include "spell-realm/spells-nature.h" +#include "flavor/flavor-describer.h" +#include "flavor/object-flavor-types.h" +#include "floor/floor-object.h" +#include "object-enchant/tr-types.h" +#include "object-hook/hook-armor.h" +#include "object-hook/hook-checker.h" +#include "object/item-tester-hooker.h" +#include "object/item-use-flags.h" +#include "racial/racial-android.h" +#include "util/bit-flags-calculator.h" +#include "view/display-messages.h" + +/*! + * @brief –h‹ï‚ÌŽKŽ~‚ß–hŽ~ˆ— + * @param caster_ptr ŽKŽ~‚ߎÀsŽÒ‚ÌŽQÆƒ|ƒCƒ“ƒ^ + * @return ƒ^[ƒ“Á”ï‚ð—v‚·‚鏈—‚ðs‚Á‚½‚È‚ç‚ÎTRUE‚ð•Ô‚· + */ +bool rustproof(player_type *caster_ptr) +{ + item_tester_hook = object_is_armour; + concptr q = _("‚Ç‚Ì–h‹ï‚ÉŽKŽ~‚ß‚ð‚µ‚Ü‚·‚©H", "Rustproof which piece of armour? "); + concptr s = _("ŽKŽ~‚ß‚Å‚«‚é‚à‚Ì‚ª‚ ‚è‚Ü‚¹‚ñB", "You have nothing to rustproof."); + OBJECT_IDX item; + object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, 0); + if (o_ptr == NULL) + return FALSE; + + GAME_TEXT o_name[MAX_NLEN]; + describe_flavor(caster_ptr, o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY); + add_flag(o_ptr->art_flags, TR_IGNORE_ACID); + if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr)) { +#ifdef JP + msg_format("%s‚͐V•i“¯—l‚É‚È‚Á‚½I", o_name); +#else + msg_format("%s %s look%s as good as new!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); +#endif + o_ptr->to_a = 0; + } + +#ifdef JP + msg_format("%s‚Í•…H‚µ‚È‚­‚È‚Á‚½B", o_name); +#else + msg_format("%s %s %s now protected against corrosion.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "are" : "is")); +#endif + calc_android_exp(caster_ptr); + return TRUE; +} diff --git a/src/spell-realm/spells-nature.h b/src/spell-realm/spells-nature.h new file mode 100644 index 000000000..024054379 --- /dev/null +++ b/src/spell-realm/spells-nature.h @@ -0,0 +1,5 @@ +#pragma once + +#include "system/angband.h" + +bool rustproof(player_type *caster_ptr); diff --git a/src/spell/spells-object.c b/src/spell/spells-object.c index 95b5d20b5..03a47720e 100644 --- a/src/spell/spells-object.c +++ b/src/spell/spells-object.c @@ -340,50 +340,6 @@ bool curse_weapon_object(player_type *owner_ptr, bool force, object_type *o_ptr) } /*! - * @brief 防具の錆止め防止処理 - * @param caster_ptr 錆止め実行者の参照ポインタ - * @return ターン消費を要する処理を行ったならばTRUEを返す - */ -bool rustproof(player_type *caster_ptr) -{ - /* Select a piece of armour */ - item_tester_hook = object_is_armour; - - concptr q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? "); - concptr s = _("錆止めできるものがありません。", "You have nothing to rustproof."); - - OBJECT_IDX item; - object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); - if (!o_ptr) - return FALSE; - - GAME_TEXT o_name[MAX_NLEN]; - describe_flavor(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - add_flag(o_ptr->art_flags, TR_IGNORE_ACID); - - if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr)) { -#ifdef JP - msg_format("%sは新品同様になった!", o_name); -#else - msg_format("%s %s look%s as good as new!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); -#endif - - o_ptr->to_a = 0; - } - -#ifdef JP - msg_format("%sは腐食しなくなった。", o_name); -#else - msg_format("%s %s %s now protected against corrosion.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "are" : "is")); -#endif - - calc_android_exp(caster_ptr); - return TRUE; -} - -/*! * @brief ボルトのエゴ化処理(火炎エゴのみ) / * Enchant some bolts * @param caster_ptr プレーヤーへの参照ポインタ diff --git a/src/spell/spells-object.h b/src/spell/spells-object.h index 33b83d1f7..020f1513e 100644 --- a/src/spell/spells-object.h +++ b/src/spell/spells-object.h @@ -6,7 +6,6 @@ void amusement(player_type *creature_ptr, POSITION y1, POSITION x1, int num, boo void acquirement(player_type *caster_ptr, POSITION y1, POSITION x1, int num, bool great, bool special, bool known); bool curse_armor(player_type *owner_ptr); bool curse_weapon_object(player_type *creature_ptr, bool force, object_type *o_ptr); -bool rustproof(player_type *caster_ptr); void brand_bolts(player_type *caster_ptr); bool perilous_secrets(player_type *user_ptr); void phlogiston(player_type *caster_ptr); -- 2.11.0