OSDN Git Service

[Refactor] #40466 Separated sight-setter.c/h from player-effects.c/h
authorHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 12:33:22 +0000 (21:33 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 28 Jun 2020 12:33:22 +0000 (21:33 +0900)
19 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-item/cmd-activate.c
src/cmd-item/cmd-quaff.c
src/core/magic-effects-timeout-reducer.c
src/mind/mind.c
src/mutation/mutation-processor.c
src/player/player-effects.c
src/player/player-effects.h
src/realm/realm-arcane.c
src/realm/realm-craft.c
src/realm/realm-crusade.c
src/realm/realm-demon.c
src/realm/realm-sorcery.c
src/realm/realm-trump.c
src/spell/spells-status.c
src/status/sight-setter.c [new file with mode: 0644]
src/status/sight-setter.h [new file with mode: 0644]

index ca1032b..9968727 100644 (file)
     <ClCompile Include="..\..\src\spell-kind\spells-recall.c" />\r
     <ClCompile Include="..\..\src\spell-realm\spells-chaos.c" />\r
     <ClCompile Include="..\..\src\spell\spell-info.c" />\r
+    <ClCompile Include="..\..\src\status\sight-setter.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\spell-kind\spells-recall.h" />\r
     <ClInclude Include="..\..\src\spell-realm\spells-chaos.h" />\r
     <ClInclude Include="..\..\src\spell\spell-info.h" />\r
+    <ClInclude Include="..\..\src\status\sight-setter.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 098d3e0..4a6f819 100644 (file)
     <ClCompile Include="..\..\src\player\buff-setter.c">
       <Filter>player</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\status\sight-setter.c">
+      <Filter>status</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\player\buff-setter.h">
       <Filter>player</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\status\sight-setter.h">
+      <Filter>status</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
     <Filter Include="object-hook">
       <UniqueIdentifier>{e466c69b-eaf4-4110-bc9d-e865b36cc732}</UniqueIdentifier>
     </Filter>
+    <Filter Include="status">
+      <UniqueIdentifier>{c2656391-c200-4334-8150-88f4691c6079}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\angband.rc" />
index ece0fbe..fa53fbd 100644 (file)
@@ -555,6 +555,8 @@ hengband_SOURCES = \
        spell-realm/spells-song.c spell-realm/spells-song.h \
        spell-realm/spells-trump.c spell-realm/spells-trump.h \
        \
+       status/sight-setter.c status/sight-setter.h \
+       \
        store/store.c store/store.h \
        store/black-market.c store/black-market.h \
        store/rumor.c store/rumor.h \
@@ -655,7 +657,8 @@ COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        -Imind -Imonster -Imonster-attack -Imonster-floor -Imonster-race -Ilore \
        -Imspell -Imutation -Iobject -Iobject-enchant -Iobject-hook -Ipet -Iplayer \
        -Iplayer-attack -Irealm -Iroom -Ispecific-object -Ispell -Ispell-kind \
-       -Ispell-realm -Isv-definition -Isystem -Iterm -Iutil -Iview -Iwizard -Iworld
+       -Ispell-realm -Istatus -Isv-definition -Isystem -Iterm -Iutil -Iview \
+       -Iwizard -Iworld
 
 install-exec-hook:
 if SET_GID
index 869e72c..dd1eea6 100644 (file)
@@ -77,6 +77,7 @@
 #include "spell/spells-summon.h"
 #include "spell/spell-types.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "sv-definition/sv-lite-types.h"
 #include "sv-definition/sv-ring-types.h"
 #include "term/screen-processor.h"
index f50edc5..2a75ddb 100644 (file)
@@ -42,6 +42,7 @@
 #include "spell-realm/spells-hex.h"
 #include "spell/spells-status.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "sv-definition/sv-potion-types.h"
 #include "term/screen-processor.h"
 #include "view/display-messages.h"
index a30dee7..07696d2 100644 (file)
@@ -4,6 +4,7 @@
 #include "player/bad-status-setter.h"
 #include "player/buff-setter.h"
 #include "player/player-effects.h"
+#include "status/sight-setter.h"
 
 /*!
  * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
index 30659be..b3bf1fe 100644 (file)
@@ -65,6 +65,7 @@
 #include "spell-kind/spells-teleport.h"
 #include "spell/spell-types.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "term/screen-processor.h"
 #include "util/buffer-shaper.h"
 #include "util/int-char-converter.h"
index db8f011..91ea438 100644 (file)
@@ -23,6 +23,7 @@
 #include "spell/spells-summon.h"
 #include "spell/spell-types.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "store/store-owners.h"
 #include "store/store-util.h"
 #include "store/store.h"
index 65ec182..cef195b 100644 (file)
@@ -65,6 +65,7 @@
 #include "spell-kind/spells-floor.h"
 #include "spell-realm/spells-hex.h"
 #include "spell/spells-status.h"
+#include "status/sight-setter.h"
 #include "sv-definition/sv-armor-types.h"
 #include "sv-definition/sv-protector-types.h"
 #include "sv-definition/sv-weapon-types.h"
@@ -482,135 +483,6 @@ bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 時限ESPの継続時間をセットする / Set "tim_esp", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (creature_ptr->tim_esp && !do_dec) {
-            if (creature_ptr->tim_esp > v)
-                return FALSE;
-        } else if (!is_time_limit_esp(creature_ptr)) {
-            msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_esp && !music_singing(creature_ptr, MUSIC_MIND)) {
-            msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_esp = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    creature_ptr->update |= (PU_MONSTERS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
- * @brief 時限透明視の継続時間をセットする / Set "tim_invis", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (creature_ptr->tim_invis && !do_dec) {
-            if (creature_ptr->tim_invis > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_invis) {
-            msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_invis) {
-            msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_invis = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    creature_ptr->update |= (PU_MONSTERS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
- * @brief 時限赤外線視力の継続時間をセットする / Set "tim_infra", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (creature_ptr->tim_infra && !do_dec) {
-            if (creature_ptr->tim_infra > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_infra) {
-            msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_infra) {
-            msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_infra = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    creature_ptr->update |= (PU_MONSTERS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief 時限急回復の継続時間をセットする / Set "tim_regen", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
index 822e5a8..2982528 100644 (file)
@@ -8,8 +8,6 @@ bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, bool
 bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_levitation(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
@@ -52,7 +50,6 @@ bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool choose_ele_attack(player_type *creature_ptr);
 bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT turn);
 bool set_wraith_form(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_superstealth(player_type *creature_ptr, bool set);
 void do_poly_wounds(player_type *creature_ptr);
 void change_race(player_type *creature_ptr, player_race_type new_race, concptr effect_msg);
index c2c8a13..3c91b71 100644 (file)
@@ -21,6 +21,7 @@
 #include "spell/spells-summon.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spell-types.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 
 /*!
index 812b40d..032202c 100644 (file)
@@ -14,6 +14,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 
 /*!
index 0806ba9..7320bd3 100644 (file)
@@ -25,6 +25,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 #include "world/world.h"
 
index 2d362aa..07e23c5 100644 (file)
@@ -20,6 +20,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spell-types.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 
 /*!
index ae1f804..9ff6267 100644 (file)
@@ -19,6 +19,7 @@
 #include "spell/spells-status.h"
 #include "spell/spell-types.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 
 /*!
index 2397789..9f585c2 100644 (file)
@@ -7,7 +7,6 @@
 #include "monster-floor/place-monster-types.h"
 #include "mutation/mutation.h"
 #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"
@@ -21,6 +20,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells3.h"
+#include "status/sight-setter.h"
 #include "view/display-messages.h"
 
 /*!
index 78fe80b..15ce608 100644 (file)
@@ -29,6 +29,7 @@
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spell-types.h"
+#include "status/sight-setter.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
 
diff --git a/src/status/sight-setter.c b/src/status/sight-setter.c
new file mode 100644 (file)
index 0000000..ed671c2
--- /dev/null
@@ -0,0 +1,135 @@
+#include "status/sight-setter.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "player/player-move.h"
+#include "realm/realm-song-numbers.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 時限ESPの継続時間をセットする / Set "tim_esp", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (creature_ptr->tim_esp && !do_dec) {
+            if (creature_ptr->tim_esp > v)
+                return FALSE;
+        } else if (!is_time_limit_esp(creature_ptr)) {
+            msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_esp && !music_singing(creature_ptr, MUSIC_MIND)) {
+            msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_esp = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    creature_ptr->update |= (PU_MONSTERS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 時限透明視の継続時間をセットする / Set "tim_invis", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (creature_ptr->tim_invis && !do_dec) {
+            if (creature_ptr->tim_invis > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_invis) {
+            msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_invis) {
+            msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_invis = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    creature_ptr->update |= (PU_MONSTERS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 時限赤外線視力の継続時間をセットする / Set "tim_infra", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (creature_ptr->tim_infra && !do_dec) {
+            if (creature_ptr->tim_infra > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_infra) {
+            msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_infra) {
+            msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_infra = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    creature_ptr->update |= (PU_MONSTERS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
diff --git a/src/status/sight-setter.h b/src/status/sight-setter.h
new file mode 100644 (file)
index 0000000..e58bdc5
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);