From e7f0a4ca0f0a9bdbb54243dc2411cd9538e02932 Mon Sep 17 00:00:00 2001 From: Hourier Date: Fri, 21 Aug 2020 14:08:11 +0900 Subject: [PATCH] [Refactor] #40653 Separated spells-arcane.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-arcane.c | 2 +- src/spell-realm/spells-arcane.c | 39 +++++++++++++++++++++++++++ src/spell-realm/spells-arcane.h | 5 ++++ src/spell/spells-object.c | 43 ------------------------------ src/spell/spells-object.h | 1 - 8 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 src/spell-realm/spells-arcane.c create mode 100644 src/spell-realm/spells-arcane.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index 1578973a2..8de55f298 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -406,6 +406,7 @@ + @@ -1068,6 +1069,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index 24edde6d1..e20fd303a 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -2165,6 +2165,9 @@ spell-realm + + spell-realm + @@ -4684,6 +4687,9 @@ spell-realm + + spell-realm + diff --git a/src/Makefile.am b/src/Makefile.am index 75f09ff8d..79c2b8538 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -750,6 +750,7 @@ hengband_SOURCES = \ spell-kind/spells-teleport.c spell-kind/spells-teleport.h \ spell-kind/spells-world.c spell-kind/spells-world.h \ \ + spell-realm/spells-arcane.c spell-realm/spells-arcane.h \ spell-realm/spells-chaos.c spell-realm/spells-chaos.h \ spell-realm/spells-craft.c spell-realm/spells-craft.h \ spell-realm/spells-crusade.c spell-realm/spells-crusade.h \ diff --git a/src/realm/realm-arcane.c b/src/realm/realm-arcane.c index 345b19535..7fbc126fd 100644 --- a/src/realm/realm-arcane.c +++ b/src/realm/realm-arcane.c @@ -13,9 +13,9 @@ #include "spell-kind/spells-perception.h" #include "spell-kind/spells-teleport.h" #include "spell-kind/spells-world.h" +#include "spell-realm/spells-arcane.h" #include "spell/spell-types.h" #include "spell/spells-diceroll.h" -#include "spell/spells-object.h" #include "spell/spells-status.h" #include "spell/spells-summon.h" #include "status/bad-status-setter.h" diff --git a/src/spell-realm/spells-arcane.c b/src/spell-realm/spells-arcane.c new file mode 100644 index 000000000..2262922b8 --- /dev/null +++ b/src/spell-realm/spells-arcane.c @@ -0,0 +1,39 @@ +#include "spell-realm/spells-arcane.h" +#include "core/player-update-types.h" +#include "inventory/inventory-slot-types.h" +#include "sv-definition/sv-lite-types.h" +#include "system/object-type-definition.h" +#include "view/display-messages.h" + +/*! + * @brief Žõ–½‚‚«ŒõŒ¹‚Ì”R‘f’ljÁˆ— / + * Charge a lite (torch or latern) + * @return ‚È‚µ + */ +void phlogiston(player_type *caster_ptr) +{ + GAME_TURN max_flog = 0; + object_type *o_ptr = &caster_ptr->inventory_list[INVEN_LITE]; + if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN)) + max_flog = FUEL_LAMP; + else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH)) + max_flog = FUEL_TORCH; + else { + msg_print(_("”R‘f‚ðÁ”ï‚·‚éƒAƒCƒeƒ€‚ð‘•”õ‚µ‚Ä‚¢‚Ü‚¹‚ñB", "You are not wielding anything which uses phlogiston.")); + return; + } + + if (o_ptr->xtra4 >= max_flog) { + msg_print(_("‚±‚̃AƒCƒeƒ€‚É‚Í‚±‚êˆÈã”R‘f‚ð•â[‚Å‚«‚Ü‚¹‚ñB", "No more phlogiston can be put in this item.")); + return; + } + + o_ptr->xtra4 += (XTRA16)(max_flog / 2); + msg_print(_("Æ–¾—pƒAƒCƒeƒ€‚É”R‘f‚ð•â[‚µ‚½B", "You add phlogiston to your light item.")); + if (o_ptr->xtra4 >= max_flog) { + o_ptr->xtra4 = (XTRA16)max_flog; + msg_print(_("Æ–¾—pƒAƒCƒeƒ€‚Í–žƒ^ƒ“‚É‚È‚Á‚½B", "Your light item is full.")); + } + + caster_ptr->update |= PU_TORCH; +} diff --git a/src/spell-realm/spells-arcane.h b/src/spell-realm/spells-arcane.h new file mode 100644 index 000000000..1873a49d1 --- /dev/null +++ b/src/spell-realm/spells-arcane.h @@ -0,0 +1,5 @@ +#pragma once + +#include "system/angband.h" + +void phlogiston(player_type *caster_ptr); diff --git a/src/spell/spells-object.c b/src/spell/spells-object.c index 03a47720e..8d500ac66 100644 --- a/src/spell/spells-object.c +++ b/src/spell/spells-object.c @@ -423,49 +423,6 @@ bool perilous_secrets(player_type *user_ptr) } /*! - * @brief 寿命つき光源の燃素追加処理 / - * Charge a lite (torch or latern) - * @return なし - */ -void phlogiston(player_type *caster_ptr) -{ - GAME_TURN max_flog = 0; - object_type *o_ptr = &caster_ptr->inventory_list[INVEN_LITE]; - - /* It's a lamp */ - if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN)) { - max_flog = FUEL_LAMP; - } - - /* It's a torch */ - else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH)) { - max_flog = FUEL_TORCH; - } - - /* No torch to refill */ - else { - msg_print(_("燃素を消費するアイテムを装備していません。", "You are not wielding anything which uses phlogiston.")); - return; - } - - if (o_ptr->xtra4 >= max_flog) { - msg_print(_("このアイテムにはこれ以上燃素を補充できません。", "No more phlogiston can be put in this item.")); - return; - } - - /* Refuel */ - o_ptr->xtra4 += (XTRA16)(max_flog / 2); - msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item.")); - - if (o_ptr->xtra4 >= max_flog) { - o_ptr->xtra4 = (XTRA16)max_flog; - msg_print(_("照明用アイテムは満タンになった。", "Your light item is full.")); - } - - caster_ptr->update |= (PU_TORCH); -} - -/*! * @brief 武器の祝福処理 / * Bless a weapon * @return ターン消費を要する処理を行ったならばTRUEを返す diff --git a/src/spell/spells-object.h b/src/spell/spells-object.h index 020f1513e..89d0407d4 100644 --- a/src/spell/spells-object.h +++ b/src/spell/spells-object.h @@ -8,7 +8,6 @@ bool curse_armor(player_type *owner_ptr); bool curse_weapon_object(player_type *creature_ptr, bool force, object_type *o_ptr); void brand_bolts(player_type *caster_ptr); bool perilous_secrets(player_type *user_ptr); -void phlogiston(player_type *caster_ptr); bool bless_weapon(player_type *caster_ptr); bool pulish_shield(player_type *caster_ptr); bool create_ration(player_type *crature_ptr); -- 2.11.0