OSDN Git Service

[Refactor] #40482 Separated spells-recall.c/h from spells3.c/h
authorHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 12:54:17 +0000 (21:54 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 12:54:17 +0000 (21:54 +0900)
17 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-building/cmd-building.c
src/cmd-item/cmd-activate.c
src/cmd-item/cmd-read.c
src/cmd-item/cmd-zaprod.c
src/mind/mind.c
src/mind/racial.c
src/mutation/mutation.c
src/realm/realm-arcane.c
src/realm/realm-sorcery.c
src/realm/realm-trump.c
src/spell-kind/spells-recall.c [new file with mode: 0644]
src/spell-kind/spells-recall.h [new file with mode: 0644]
src/spell/spells3.c
src/spell/spells3.h

index 54a221f..b5274e6 100644 (file)
     <ClCompile Include="..\..\src\mind\racial-kutar.c" />\r
     <ClCompile Include="..\..\src\mind\stances-table.c" />\r
     <ClCompile Include="..\..\src\player\bad-status-setter.c" />\r
+    <ClCompile Include="..\..\src\spell-kind\spells-recall.c" />\r
     <ClCompile Include="..\..\src\view\display-map.c" />\r
     <ClCompile Include="..\..\src\view\display-sub-windows.c" />\r
     <ClCompile Include="..\..\src\view\main-window-left-frame.c" />\r
     <ClInclude Include="..\..\src\mspell\mspells3.h" />\r
     <ClInclude Include="..\..\src\player\bad-status-setter.h" />\r
     <ClInclude Include="..\..\src\player\special-defense-types.h" />\r
+    <ClInclude Include="..\..\src\spell-kind\spells-recall.h" />\r
     <ClInclude Include="..\..\src\system\alloc-entries.h" />\r
     <ClInclude Include="..\..\src\term\screen-processor.h" />\r
     <ClInclude Include="..\..\src\util\bit-flags-calculator.h" />\r
index 7a5c50e..dfd6efc 100644 (file)
     <ClCompile Include="..\..\src\wizard\wizard-spells.c">
       <Filter>wizard</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell-kind\spells-recall.c">
+      <Filter>spell-kind</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\wizard\wizard-spells.h">
       <Filter>wizard</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell-kind\spells-recall.h">
+      <Filter>spell-kind</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 6a9b712..6c35970 100644 (file)
@@ -527,6 +527,7 @@ hengband_SOURCES = \
        spell-kind/spells-neighbor.c spell-kind/spells-neighbor.h \
        spell-kind/spells-pet.c spell-kind/spells-pet.h \
        spell-kind/spells-random.c spell-kind/spells-random.h \
+       spell-kind/spells-recall.c spell-kind/spells-recall.h \
        spell-kind/spells-sight.c spell-kind/spells-sight.h \
        spell-kind/spells-specific-bolt.c spell-kind/spells-specific-bolt.h \
        spell-kind/spells-teleport.c spell-kind/spells-teleport.h \
index d7fb7d5..b512273 100644 (file)
@@ -52,6 +52,7 @@
 #include "player/player-personalities-types.h"
 #include "player/player-status.h"
 #include "spell/spells-status.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spells3.h"
 #include "system/building-type-definition.h"
index d4d6a3c..b7517ee 100644 (file)
@@ -61,6 +61,7 @@
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-neighbor.h"
 #include "spell-kind/spells-random.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-specific-bolt.h"
 #include "spell-kind/spells-teleport.h"
index aafe8c2..00df792 100644 (file)
@@ -37,6 +37,7 @@
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-neighbor.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell-realm/spells-hex.h"
index c86ebf2..65b7907 100644 (file)
@@ -23,6 +23,7 @@
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-neighbor.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-random.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-specific-bolt.h"
index 4b1e59a..549fd8f 100644 (file)
@@ -56,6 +56,7 @@
 #include "spell-kind/spells-grid.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
index 793df64..87ae5fc 100644 (file)
@@ -55,6 +55,7 @@
 #include "spell-kind/spells-grid.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-neighbor.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell-realm/spells-hex.h"
index d5a703e..bc8aa2d 100644 (file)
@@ -51,6 +51,7 @@
 #include "spell-kind/spells-detection.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spells-status.h"
index 4c8621f..597c286 100644 (file)
@@ -14,6 +14,7 @@
 #include "spell-kind/spells-floor.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
+#include "spell-kind/spells-recall.h"
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
index c7219ce..881187d 100644 (file)
@@ -11,6 +11,7 @@
 #include "spell-kind/spells-grid.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-lite.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spells-status.h"
index 4a180f8..a5ef839 100644 (file)
@@ -9,15 +9,16 @@
 #include "player/player-class.h"
 #include "player/player-effects.h"
 #include "spell-kind/spells-detection.h"
+#include "spell-kind/spells-floor.h"
 #include "spell-kind/spells-launcher.h"
-#include "spell/spells-object.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
-#include "spell/spells-status.h"
-#include "spell/spells-summon.h"
-#include "spell-kind/spells-floor.h"
-#include "spell-realm/spells-trump.h"
 #include "spell-kind/spells-teleport.h"
+#include "spell-realm/spells-trump.h"
 #include "spell/spell-types.h"
+#include "spell/spells-object.h"
+#include "spell/spells-status.h"
+#include "spell/spells-summon.h"
 #include "spell/spells3.h"
 #include "view/display-messages.h"
 
diff --git a/src/spell-kind/spells-recall.c b/src/spell-kind/spells-recall.c
new file mode 100644 (file)
index 0000000..10fd379
--- /dev/null
@@ -0,0 +1,140 @@
+#include "spell-kind/spells-recall.h"
+#include "core/asking-player.h"
+#include "dungeon/dungeon.h"
+#include "dungeon/quest.h"
+#include "floor/floor.h"
+#include "game-option/birth-options.h"
+#include "game-option/play-record-options.h"
+#include "io/write-diary.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief プレイヤーの帰還発動及び中止処理 /
+ * Recall the player to town or dungeon
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param turns 発動までのターン数
+ * @return 常にTRUEを返す
+ */
+bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
+{
+    /*
+     * TODO: Recall the player to the last
+     * visited town when in the wilderness
+     */
+    if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward) {
+        msg_print(_("何も起こらなかった。", "Nothing happens."));
+        return TRUE;
+    }
+
+    bool is_special_floor = creature_ptr->current_floor_ptr->dun_level > 0;
+    is_special_floor &= max_dlv[creature_ptr->dungeon_idx] > creature_ptr->current_floor_ptr->dun_level;
+    is_special_floor &= !creature_ptr->current_floor_ptr->inside_quest;
+    is_special_floor &= !creature_ptr->word_recall;
+    if (is_special_floor) {
+        if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) {
+            max_dlv[creature_ptr->dungeon_idx] = creature_ptr->current_floor_ptr->dun_level;
+            if (record_maxdepth)
+                exe_write_diary(creature_ptr, DIARY_TRUMP, creature_ptr->dungeon_idx, _("帰還のときに", "when recalled from dungeon"));
+        }
+    }
+
+    if (creature_ptr->word_recall) {
+        creature_ptr->word_recall = 0;
+        msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
+        creature_ptr->redraw |= (PR_STATUS);
+        return TRUE;
+    }
+
+    if (!creature_ptr->current_floor_ptr->dun_level) {
+        DUNGEON_IDX select_dungeon;
+        select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
+        if (!select_dungeon)
+            return FALSE;
+        creature_ptr->recall_dungeon = select_dungeon;
+    }
+
+    creature_ptr->word_recall = turns;
+    msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
+    creature_ptr->redraw |= (PR_STATUS);
+    return TRUE;
+}
+
+bool free_level_recall(player_type *creature_ptr)
+{
+    DUNGEON_IDX select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0);
+    if (!select_dungeon)
+        return FALSE;
+
+    DEPTH max_depth = d_info[select_dungeon].maxdepth;
+    if (select_dungeon == DUNGEON_ANGBAND) {
+        if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED)
+            max_depth = 98;
+        else if (quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED)
+            max_depth = 99;
+    }
+
+    QUANTITY amt = get_quantity(
+        format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "), d_name + d_info[select_dungeon].name), (QUANTITY)max_depth);
+    if (amt <= 0) {
+        return FALSE;
+    }
+
+    creature_ptr->word_recall = 1;
+    creature_ptr->recall_dungeon = select_dungeon;
+    max_dlv[creature_ptr->recall_dungeon]
+        = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth
+                                                   : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt));
+    if (record_maxdepth)
+        exe_write_diary(creature_ptr, DIARY_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
+
+    msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
+
+    creature_ptr->redraw |= PR_STATUS;
+    return TRUE;
+}
+
+/*!
+ * @brief フロア・リセット処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return リセット処理が実際に行われたらTRUEを返す
+ */
+bool reset_recall(player_type *caster_ptr)
+{
+    int select_dungeon, dummy = 0;
+    char ppp[80];
+    char tmp_val[160];
+
+    select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14);
+    if (ironman_downward) {
+        msg_print(_("何も起こらなかった。", "Nothing happens."));
+        return TRUE;
+    }
+
+    if (!select_dungeon)
+        return FALSE;
+    sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "), (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
+    sprintf(tmp_val, "%d", (int)MAX(caster_ptr->current_floor_ptr->dun_level, 1));
+
+    if (!get_string(ppp, tmp_val, 10)) {
+        return FALSE;
+    }
+
+    dummy = atoi(tmp_val);
+    if (dummy < 1)
+        dummy = 1;
+    if (dummy > max_dlv[select_dungeon])
+        dummy = max_dlv[select_dungeon];
+    if (dummy < d_info[select_dungeon].mindepth)
+        dummy = d_info[select_dungeon].mindepth;
+
+    max_dlv[select_dungeon] = dummy;
+
+    if (record_maxdepth)
+        exe_write_diary(caster_ptr, DIARY_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
+#ifdef JP
+    msg_format("%sの帰還レベルを %d 階にセット。", d_name + d_info[select_dungeon].name, dummy, dummy * 50);
+#else
+    msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
+#endif
+    return TRUE;
+}
diff --git a/src/spell-kind/spells-recall.h b/src/spell-kind/spells-recall.h
new file mode 100644 (file)
index 0000000..f2d73a1
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
+bool free_level_recall(player_type *creature_ptr);
+bool reset_recall(player_type *caster_ptr);
index 3a21fcf..8743fa5 100644 (file)
@@ -108,137 +108,6 @@ static bool update_player(player_type *caster_ptr);
 static bool redraw_player(player_type *caster_ptr);
 
 /*!
- * @brief プレイヤーの帰還発動及び中止処理 /
- * Recall the player to town or dungeon
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param turns 発動までのターン数
- * @return 常にTRUEを返す
- */
-bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
-{
-    /*
-     * TODO: Recall the player to the last
-     * visited town when in the wilderness
-     */
-    if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward) {
-        msg_print(_("何も起こらなかった。", "Nothing happens."));
-        return TRUE;
-    }
-
-    bool is_special_floor = creature_ptr->current_floor_ptr->dun_level > 0;
-    is_special_floor &= max_dlv[creature_ptr->dungeon_idx] > creature_ptr->current_floor_ptr->dun_level;
-    is_special_floor &= !creature_ptr->current_floor_ptr->inside_quest;
-    is_special_floor &= !creature_ptr->word_recall;
-    if (is_special_floor) {
-        if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) {
-            max_dlv[creature_ptr->dungeon_idx] = creature_ptr->current_floor_ptr->dun_level;
-            if (record_maxdepth)
-                exe_write_diary(creature_ptr, DIARY_TRUMP, creature_ptr->dungeon_idx, _("帰還のときに", "when recalled from dungeon"));
-        }
-    }
-
-    if (creature_ptr->word_recall) {
-        creature_ptr->word_recall = 0;
-        msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
-        creature_ptr->redraw |= (PR_STATUS);
-        return TRUE;
-    }
-
-    if (!creature_ptr->current_floor_ptr->dun_level) {
-        DUNGEON_IDX select_dungeon;
-        select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
-        if (!select_dungeon)
-            return FALSE;
-        creature_ptr->recall_dungeon = select_dungeon;
-    }
-
-    creature_ptr->word_recall = turns;
-    msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
-    creature_ptr->redraw |= (PR_STATUS);
-    return TRUE;
-}
-
-bool free_level_recall(player_type *creature_ptr)
-{
-    DUNGEON_IDX select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0);
-    if (!select_dungeon)
-        return FALSE;
-
-    DEPTH max_depth = d_info[select_dungeon].maxdepth;
-    if (select_dungeon == DUNGEON_ANGBAND) {
-        if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED)
-            max_depth = 98;
-        else if (quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED)
-            max_depth = 99;
-    }
-
-    QUANTITY amt = get_quantity(
-        format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "), d_name + d_info[select_dungeon].name), (QUANTITY)max_depth);
-    if (amt <= 0) {
-        return FALSE;
-    }
-
-    creature_ptr->word_recall = 1;
-    creature_ptr->recall_dungeon = select_dungeon;
-    max_dlv[creature_ptr->recall_dungeon]
-        = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth
-                                                   : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt));
-    if (record_maxdepth)
-        exe_write_diary(creature_ptr, DIARY_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
-
-    msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
-
-    creature_ptr->redraw |= PR_STATUS;
-    return TRUE;
-}
-
-/*!
- * @brief フロア・リセット処理
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return リセット処理が実際に行われたらTRUEを返す
- */
-bool reset_recall(player_type *caster_ptr)
-{
-    int select_dungeon, dummy = 0;
-    char ppp[80];
-    char tmp_val[160];
-
-    select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14);
-    if (ironman_downward) {
-        msg_print(_("何も起こらなかった。", "Nothing happens."));
-        return TRUE;
-    }
-
-    if (!select_dungeon)
-        return FALSE;
-    sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "), (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
-    sprintf(tmp_val, "%d", (int)MAX(caster_ptr->current_floor_ptr->dun_level, 1));
-
-    if (!get_string(ppp, tmp_val, 10)) {
-        return FALSE;
-    }
-
-    dummy = atoi(tmp_val);
-    if (dummy < 1)
-        dummy = 1;
-    if (dummy > max_dlv[select_dungeon])
-        dummy = max_dlv[select_dungeon];
-    if (dummy < d_info[select_dungeon].mindepth)
-        dummy = d_info[select_dungeon].mindepth;
-
-    max_dlv[select_dungeon] = dummy;
-
-    if (record_maxdepth)
-        exe_write_diary(caster_ptr, DIARY_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
-#ifdef JP
-    msg_format("%sの帰還レベルを %d 階にセット。", d_name + d_info[select_dungeon].name, dummy, dummy * 50);
-#else
-    msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
-#endif
-    return TRUE;
-}
-
-/*!
  * @brief プレイヤーの装備劣化処理 /
  * Apply disenchantment to the player's stuff
  * @param target_ptr プレーヤーへの参照ポインタ
index 86f3623..6f78222 100644 (file)
@@ -6,9 +6,6 @@
 
 bool eat_magic(player_type *caster_ptr, int power);
 
-bool recall_player(player_type* creature_ptr, TIME_EFFECT turns);
-bool free_level_recall(player_type* creature_ptr);
-bool reset_recall(player_type* caster_ptr);
 bool apply_disenchant(player_type* target_ptr, BIT_FLAGS mode);
 void call_the_void(player_type* caster_ptr);
 void fetch(player_type* caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los);