OSDN Git Service

[Refactor] #39963 Separated spells-execution.c/h and spells-util.h from spells.h...
authorHourier <hourier@users.sourceforge.jp>
Wed, 29 Apr 2020 05:46:40 +0000 (14:46 +0900)
committerHourier <hourier@users.sourceforge.jp>
Wed, 29 Apr 2020 05:46:40 +0000 (14:46 +0900)
40 files changed:
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd/cmd-hissatsu.c
src/cmd/cmd-spell.c
src/core.c
src/knowledge/knowledge-experiences.c
src/player-status.c
src/realm/realm-arcane.c
src/realm/realm-arcane.h
src/realm/realm-chaos.c
src/realm/realm-chaos.h
src/realm/realm-craft.c
src/realm/realm-craft.h
src/realm/realm-crusade.c
src/realm/realm-crusade.h
src/realm/realm-daemon.c
src/realm/realm-daemon.h
src/realm/realm-death.c
src/realm/realm-death.h
src/realm/realm-hex.c
src/realm/realm-hex.h
src/realm/realm-hissatsu.c
src/realm/realm-hissatsu.h
src/realm/realm-life.c
src/realm/realm-life.h
src/realm/realm-nature.c
src/realm/realm-nature.h
src/realm/realm-song.c
src/realm/realm-song.h
src/realm/realm-sorcery.c
src/realm/realm-sorcery.h
src/realm/realm-trump.c
src/realm/realm-trump.h
src/spell/spells-execution.c [new file with mode: 0644]
src/spell/spells-execution.h [new file with mode: 0644]
src/spell/spells-util.h [new file with mode: 0644]
src/spells.h
src/spells1.c
src/spells3.c

index 0d5e70e..219c743 100644 (file)
     <ClCompile Include="..\..\src\realm\realm-nature.c" />\r
     <ClCompile Include="..\..\src\realm\realm-song.c" />\r
     <ClCompile Include="..\..\src\realm\realm-sorcery.c" />\r
+    <ClCompile Include="..\..\src\spell\spells-execution.c" />\r
     <ClCompile Include="..\..\src\spell\technic-info-table.c" />\r
     <ClInclude Include="..\..\src\artifact.h" />\r
     <ClInclude Include="..\..\src\autopick\autopick-command-menu.h" />\r
     <ClInclude Include="..\..\src\room\pit-nest-kinds-table.h" />\r
     <ClInclude Include="..\..\src\io\signal-handlers.h" />\r
     <ClInclude Include="..\..\src\io\uid-checker.h" />\r
+    <ClInclude Include="..\..\src\spell\spells-util.h" />\r
+    <ClInclude Include="..\..\src\spell\spells-execution.h" />\r
     <ClInclude Include="..\..\src\spell\technic-info-table.h" />\r
     <ClInclude Include="..\..\src\view\display-characteristic.h" />\r
     <ClInclude Include="..\..\src\view\display-fruit.h" />\r
index 976ab04..be8bf53 100644 (file)
     <ClCompile Include="..\..\src\spell\technic-info-table.c">
       <Filter>spell</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell\spells-execution.c">
+      <Filter>spell</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\gamevalue.h" />
     <ClInclude Include="..\..\src\spell\technic-info-table.h">
       <Filter>spell</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell\spells-execution.h">
+      <Filter>spell</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\spell\spells-util.h">
+      <Filter>spell</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index a7878f2..97b0fdb 100644 (file)
@@ -170,6 +170,8 @@ hengband_SOURCES = \
        effect/spells-effect-util.c effect/spells-effect-util.h \
        \
        spell/technic-info-table.c spell/technic-info-table.h \
+       spell/spells-execution.c spell/spells-execution.h \
+       spell/spells-util.h \
        spells.h \
        spells1.c spells2.c spells3.c \
        spells-diceroll.c spells-diceroll.h \
index 21e2211..130850f 100644 (file)
 #include "cmd-basic.h"
 #include "cmd-spell.h"
 #include "view/display-main-window.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
 #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
 
-
 /*!
  * @brief 使用可能な剣術を選択する /
  * Allow user to choose a blade arts.
index 1fc450a..db07984 100644 (file)
@@ -33,6 +33,8 @@
 #include "floor.h"
 #include "autopick/autopick-reader-writer.h"
 #include "japanese.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
  /*!
   * 魔法領域フラグ管理テーブル /
index d8f5041..84b2f8c 100644 (file)
 #include "realm/realm.h"
 #include "realm/realm-song.h"
 #include "targeting.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
  /*!
   * コピーライト情報 /
index ebfcfd2..9dd402e 100644 (file)
@@ -12,6 +12,8 @@
 #include "object/object-kind.h"
 #include "player-skill.h"
 #include "spell/technic-info-table.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
 /*
  * Display weapon-exp
index 21b7159..d6dbbcc 100644 (file)
@@ -48,6 +48,8 @@
 
 #include "horror-descriptions.h"
 #include "market/arena-info-table.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
 /*!
  * @brief 能力値テーブル / Abbreviations of healthy stats
index 8af897e..c0599d1 100644 (file)
@@ -13,6 +13,7 @@
 #include "player-status.h"
 #include "player-effects.h"
 #include "targeting.h"
+#include "realm/realm-arcane.h"
 
 /*!
 * @brief 秘術領域魔法の各処理を行う
index 59a6e6a..4cb51b2 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 1344578..afb31ff 100644 (file)
@@ -12,6 +12,7 @@
 #include "spells.h"
 #include "targeting.h"
 #include "view/display-main-window.h"
+#include "realm/realm-chaos.h"
 
 /*!
 * @brief カオス領域魔法の各処理を行う
index c2bbc7f..ff2c20f 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_chaos_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index b71a669..46df580 100644 (file)
@@ -10,8 +10,7 @@
 #include "mutation.h"
 #include "player-status.h"
 #include "player-effects.h"
-
-
+#include "realm/realm-craft.h"
 
 /*!
 * @brief 匠領域魔法の各処理を行う
index e844984..d99c834 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_craft_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index adaa217..f7e76a2 100644 (file)
@@ -13,8 +13,7 @@
 #include "player-class.h"
 #include "player-effects.h"
 #include "targeting.h"
-
-
+#include "realm/realm-crusade.h"
 
 /*!
 * @brief 破邪領域魔法の各処理を行う
index f8f17b4..8e0e1cd 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_crusade_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 495bb39..3265152 100644 (file)
@@ -1,5 +1,4 @@
-
-#include "angband.h"
+#include "angband.h"
 #include "util.h"
 
 #include "player-class.h"
@@ -14,6 +13,7 @@
 #include "player-race.h"
 #include "player-damage.h"
 #include "targeting.h"
+#include "realm/realm-daemon.h"
 
 /*!
 * @brief 悪魔領域魔法の各処理を行う
index 850b53d..209f6c8 100644 (file)
@@ -1,4 +1,6 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_daemon_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
 
index 362f5e4..04f311d 100644 (file)
@@ -12,6 +12,7 @@
 #include "player-class.h"
 #include "player-damage.h"
 #include "player-race.h"
+#include "realm/realm-death.h"
 
 /*!
 * @brief 暗黒領域魔法の各処理を行う
index d5fafff..c31cda7 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_death_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index a82fe32..4b9532b 100644 (file)
@@ -37,6 +37,8 @@
 #include "realm/realm-song.h"
 #include "view/display-main-window.h"
 #include "world.h"
+#include "realm/realm-hex.h"
+#include "spell/spells-execution.h"
 
 #define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
 
index f764c3b..92c9e99 100644 (file)
@@ -1,8 +1,6 @@
 #pragma once
 
-/*!
- * @file realm/realm-hex.h
- */
+#include "spell/spells-util.h"
 
 #define hex_spelling_any(CREATURE_PTR) \
        (((CREATURE_PTR)->realm1 == REALM_HEX) && ((CREATURE_PTR)->magic_num1[0]))
index b32c9b7..e4e3368 100644 (file)
@@ -22,6 +22,7 @@
 #include "spells-floor.h"
 #include "world.h"
 #include "effect/spells-effect-util.h"
+#include "spell/spells-util.h"
 
 /*!
 * @brief 剣術の各処理を行う
index 7c3f82f..64c63b7 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 6ac0c69..2af7072 100644 (file)
@@ -7,6 +7,7 @@
 #include "player-effects.h"
 #include "floor.h"
 #include "targeting.h"
+#include "realm/realm-life.h"
 
 /*!
 * @brief 生命領域魔法の各処理を行う
index 664e600..ba4ceca 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 1cf2fb0..52e3100 100644 (file)
@@ -13,6 +13,7 @@
 #include "player-damage.h"
 #include "targeting.h"
 #include "effect/spells-effect-util.h"
+#include "realm/realm-nature.h"
 
 /*!
 * @brief 自然領域魔法の各処理を行う
index 91ee793..d91adcc 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 7deef0a..4e8032b 100644 (file)
@@ -1,8 +1,6 @@
 #include "angband.h"
 #include "util.h"
 
-#include "realm/realm-song.h"
-
 #include "cmd-spell.h"
 #include "spells.h"
 #include "spells-status.h"
@@ -11,6 +9,7 @@
 #include "player-effects.h"
 #include "targeting.h"
 #include "view/display-main-window.h"
+#include "realm/realm-song.h"
 
 /*!
 * @brief 歌の開始を処理する / Start singing if the player is a Bard
index 1affe70..163140b 100644 (file)
@@ -30,4 +30,6 @@
 
 #define MUSIC_DETECT            101
 
-extern concptr do_music_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
+#include "spell/spells-util.h"
+
+concptr do_music_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index ade2831..fe5d146 100644 (file)
@@ -10,6 +10,7 @@
 #include "spells-floor.h"
 #include "player-effects.h"
 #include "targeting.h"
+#include "realm/realm-sorcery.h"
 
 /*!
 * @brief 仙術領域魔法の各処理を行う
index 075e349..031eb8c 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
index 90bd8c4..10867d9 100644 (file)
@@ -10,6 +10,7 @@
 #include "player-class.h"
 #include "targeting.h"
 #include "effect/spells-effect-util.h"
+#include "realm/realm-trump.h"
 
 /*!
 * @brief トランプ領域魔法の各処理を行う
index 812caaa..492ad33 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
+#include "spell/spells-util.h"
+
 concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode);
diff --git a/src/spell/spells-execution.c b/src/spell/spells-execution.c
new file mode 100644 (file)
index 0000000..11c987d
--- /dev/null
@@ -0,0 +1,46 @@
+#include "angband.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
+#include "realm/realm.h"
+#include "realm/realm-arcane.h"
+#include "realm/realm-chaos.h"
+#include "realm/realm-craft.h"
+#include "realm/realm-crusade.h"
+#include "realm/realm-daemon.h"
+#include "realm/realm-death.h"
+#include "realm/realm-hex.h"
+#include "realm/realm-hissatsu.h"
+#include "realm/realm-life.h"
+#include "realm/realm-nature.h"
+#include "realm/realm-song.h"
+#include "realm/realm-sorcery.h"
+#include "realm/realm-trump.h"
+
+/*!
+ * @brief 魔法処理のメインルーチン
+ * @param realm 魔法領域のID
+ * @param spell 各領域の魔法ID
+ * @param mode 求める処理
+ * @return 各領域魔法に各種テキストを求めた場合は文字列参照ポインタ、そうでない場合はNULLポインタを返す。
+ */
+concptr exe_spell(player_type *caster_ptr, REALM_IDX realm, SPELL_IDX spell, spell_type mode)
+{
+       switch (realm)
+       {
+       case REALM_LIFE:     return do_life_spell(caster_ptr, spell, mode);
+       case REALM_SORCERY:  return do_sorcery_spell(caster_ptr, spell, mode);
+       case REALM_NATURE:   return do_nature_spell(caster_ptr, spell, mode);
+       case REALM_CHAOS:    return do_chaos_spell(caster_ptr, spell, mode);
+       case REALM_DEATH:    return do_death_spell(caster_ptr, spell, mode);
+       case REALM_TRUMP:    return do_trump_spell(caster_ptr, spell, mode);
+       case REALM_ARCANE:   return do_arcane_spell(caster_ptr, spell, mode);
+       case REALM_CRAFT:    return do_craft_spell(caster_ptr, spell, mode);
+       case REALM_DAEMON:   return do_daemon_spell(caster_ptr, spell, mode);
+       case REALM_CRUSADE:  return do_crusade_spell(caster_ptr, spell, mode);
+       case REALM_MUSIC:    return do_music_spell(caster_ptr, spell, mode);
+       case REALM_HISSATSU: return do_hissatsu_spell(caster_ptr, spell, mode);
+       case REALM_HEX:      return do_hex_spell(caster_ptr, spell, mode);
+       }
+
+       return NULL;
+}
diff --git a/src/spell/spells-execution.h b/src/spell/spells-execution.h
new file mode 100644 (file)
index 0000000..a491d32
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+concptr exe_spell(player_type *caster_ptr, REALM_IDX realm, SPELL_IDX spell, spell_type mode);
diff --git a/src/spell/spells-util.h b/src/spell/spells-util.h
new file mode 100644 (file)
index 0000000..80b409f
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+typedef enum
+{
+       SPELL_NAME = 0,
+       SPELL_DESC = 1,
+       SPELL_INFO = 2,
+       SPELL_CAST = 3,
+       SPELL_FAIL = 4,
+       SPELL_STOP = 5,
+       SPELL_CONT = 6
+} spell_type;
index 7c56af2..9fc9b1c 100644 (file)
@@ -1,19 +1,6 @@
 #pragma once
 #include "realm/realm.h"
 
-typedef enum
-{
-       SPELL_NAME = 0,
-       SPELL_DESC = 1,
-       SPELL_INFO = 2,
-       SPELL_CAST = 3,
-       SPELL_FAIL = 4,
-       SPELL_STOP = 5,
-       SPELL_CONT = 6
-} spell_type;
-
-concptr exe_spell(player_type *caster_ptr, REALM_IDX realm, SPELL_IDX spell, spell_type mode);
-
 #define DETECT_RAD_DEFAULT 30
 #define DETECT_RAD_MAP     30
 #define DETECT_RAD_ALL     255
index 9fa20ec..8b05e33 100644 (file)
 #include "feature.h"
 #include "view/display-main-window.h"
 
-#include "realm/realm.h"
-#include "realm/realm-arcane.h"
-#include "realm/realm-chaos.h"
-#include "realm/realm-craft.h"
-#include "realm/realm-crusade.h"
-#include "realm/realm-daemon.h"
-#include "realm/realm-death.h"
-#include "realm/realm-hex.h"
-#include "realm/realm-hissatsu.h"
-#include "realm/realm-life.h"
-#include "realm/realm-nature.h"
-#include "realm/realm-song.h"
-#include "realm/realm-sorcery.h"
-#include "realm/realm-trump.h"
-
 #include "effect/effect-feature.h"
 #include "effect/effect-item.h"
 #include "effect/spells-effect-util.h"
-
-/*!
- * @brief 魔法処理のメインルーチン
- * @param realm 魔法領域のID
- * @param spell 各領域の魔法ID
- * @param mode 求める処理
- * @return 各領域魔法に各種テキストを求めた場合は文字列参照ポインタ、そうでない場合はNULLポインタを返す。
- */
-concptr exe_spell(player_type *caster_ptr, REALM_IDX realm, SPELL_IDX spell, spell_type mode)
-{
-       switch (realm)
-       {
-       case REALM_LIFE:     return do_life_spell(caster_ptr, spell, mode);
-       case REALM_SORCERY:  return do_sorcery_spell(caster_ptr, spell, mode);
-       case REALM_NATURE:   return do_nature_spell(caster_ptr, spell, mode);
-       case REALM_CHAOS:    return do_chaos_spell(caster_ptr, spell, mode);
-       case REALM_DEATH:    return do_death_spell(caster_ptr, spell, mode);
-       case REALM_TRUMP:    return do_trump_spell(caster_ptr, spell, mode);
-       case REALM_ARCANE:   return do_arcane_spell(caster_ptr, spell, mode);
-       case REALM_CRAFT:    return do_craft_spell(caster_ptr, spell, mode);
-       case REALM_DAEMON:   return do_daemon_spell(caster_ptr, spell, mode);
-       case REALM_CRUSADE:  return do_crusade_spell(caster_ptr, spell, mode);
-       case REALM_MUSIC:    return do_music_spell(caster_ptr, spell, mode);
-       case REALM_HISSATSU: return do_hissatsu_spell(caster_ptr, spell, mode);
-       case REALM_HEX:      return do_hex_spell(caster_ptr, spell, mode);
-       }
-
-       return NULL;
-}
-
+#include "realm/realm-hex.h"
 
 /*!
  * @brief 配置した鏡リストの次を取得する /
index 42b36cd..c787d63 100644 (file)
@@ -63,6 +63,8 @@
 #include "autopick/autopick.h"
 #include "targeting.h"
 #include "effect/spells-effect-util.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
 
 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
 #define MAX_TRIES 100