OSDN Git Service

[Refactor] #40574 Moved lose_mutation() and lose_all_mutations() from mutation.c...
authorHourier <hourier@users.sourceforge.jp>
Sat, 1 Aug 2020 03:31:23 +0000 (12:31 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 1 Aug 2020 03:31:23 +0000 (12:31 +0900)
src/cmd-building/cmd-building.c
src/mutation/mutation-investor-remover.c
src/mutation/mutation-investor-remover.h
src/mutation/mutation-processor.c
src/mutation/mutation.c
src/mutation/mutation.h
src/object-use/quaff-execution.c
src/spell-realm/spells-trump.c
src/status/shape-changer.c

index 7c8a08f..2bb9a7c 100644 (file)
@@ -49,7 +49,7 @@
 #include "market/poker.h"
 #include "monster-race/monster-race.h"
 #include "mutation/mutation-flag-types.h"
-#include "mutation/mutation.h"
+#include "mutation/mutation-investor-remover.h"
 #include "object-hook/hook-armor.h"
 #include "object-hook/hook-bow.h"
 #include "object-hook/hook-weapon.h"
index 689a02f..6e14cbd 100644 (file)
@@ -2,6 +2,7 @@
 #include "core/player-update-types.h"
 #include "core/stuff-handler.h"
 #include "mutation/gain-mutation-switcher.h"
+#include "mutation/lose-mutation-switcher.h"
 #include "mutation/mutation-flag-types.h"
 #include "mutation/mutation-util.h"
 #include "mutation/mutation.h" // todo calc_mutant_regenerate_mod() が相互依存している、後で消す.
@@ -233,3 +234,53 @@ bool gain_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
     handle_stuff(creature_ptr);
     return TRUE;
 }
+
+/*!
+ * @brief プレイヤーから突然変異を取り除く
+ * @param choose_mut 取り除きたい突然変異のID、0ならばランダムに消去
+ * @return なし
+ */
+bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
+{
+    glm_type tmp_glm;
+    glm_type *glm_ptr = initialize_glm_type(&tmp_glm, choose_mut);
+    int attempts_left = 20;
+    if (glm_ptr->choose_mut)
+        attempts_left = 1;
+
+    while (attempts_left--) {
+        switch_lose_mutation(creature_ptr, glm_ptr);
+        if (glm_ptr->muta_class && glm_ptr->muta_which) {
+            if (*(glm_ptr->muta_class) & glm_ptr->muta_which) {
+                glm_ptr->muta_chosen = TRUE;
+            }
+        }
+
+        if (glm_ptr->muta_chosen)
+            break;
+    }
+
+    if (!glm_ptr->muta_chosen)
+        return FALSE;
+
+    msg_print(glm_ptr->muta_desc);
+    if (glm_ptr->muta_class != NULL)
+        *glm_ptr->muta_class &= ~(glm_ptr->muta_which);
+
+    creature_ptr->update |= PU_BONUS;
+    handle_stuff(creature_ptr);
+    creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
+    return TRUE;
+}
+
+void lose_all_mutations(player_type *creature_ptr)
+{
+    if (creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) {
+        chg_virtue(creature_ptr, V_CHANCE, -5);
+        msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
+        creature_ptr->muta1 = creature_ptr->muta2 = creature_ptr->muta3 = 0;
+        creature_ptr->update |= PU_BONUS;
+        handle_stuff(creature_ptr);
+        creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
+    }
+}
index f7e89b8..8b2cf36 100644 (file)
@@ -3,3 +3,5 @@
 #include "system/angband.h"
 
 bool gain_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut);
+bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut);
+void lose_all_mutations(player_type *creature_ptr);
index e8f06d3..ecdb0ff 100644 (file)
@@ -13,7 +13,7 @@
 #include "monster-race/monster-race.h"
 #include "monster/monster-status.h"
 #include "mutation/mutation-flag-types.h"
-#include "mutation/mutation.h"
+#include "mutation/mutation-investor-remover.h"
 #include "object-hook/hook-checker.h"
 #include "object-hook/hook-enchant.h"
 #include "object/lite-processor.h"
index 944638b..3dc5589 100644 (file)
@@ -36,8 +36,6 @@
 #include "monster/monster-flag-types.h"
 #include "monster/monster-info.h"
 #include "monster/smart-learn-types.h"
-#include "mutation/gain-mutation-switcher.h"
-#include "mutation/lose-mutation-switcher.h"
 #include "mutation/mutation-flag-types.h"
 #include "mutation/mutation-investor-remover.h" // todo 相互依存している、このファイルからの依存はOK.
 #include "mutation/mutation-techniques.h"
 #include "system/object-type-definition.h"
 #include "target/target-getter.h"
 #include "view/display-messages.h"
-
-/*!
- * @brief プレイヤーから突然変異を取り除く
- * @param choose_mut 取り除きたい突然変異のID、0ならばランダムに消去
- * @return なし
- */
-bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
-{
-    glm_type tmp_glm;
-    glm_type *glm_ptr = initialize_glm_type(&tmp_glm, choose_mut);
-    int attempts_left = 20;
-    if (glm_ptr->choose_mut)
-        attempts_left = 1;
-
-    while (attempts_left--) {
-        switch_lose_mutation(creature_ptr, glm_ptr);
-        if (glm_ptr->muta_class && glm_ptr->muta_which) {
-            if (*(glm_ptr->muta_class)&glm_ptr->muta_which) {
-                glm_ptr->muta_chosen = TRUE;
-            }
-        }
-
-        if (glm_ptr->muta_chosen)
-            break;
-    }
-
-    if (!glm_ptr->muta_chosen)
-        return FALSE;
-
-    msg_print(glm_ptr->muta_desc);
-    if (glm_ptr->muta_class != NULL)
-        *glm_ptr->muta_class &= ~(glm_ptr->muta_which);
-
-    creature_ptr->update |= PU_BONUS;
-    handle_stuff(creature_ptr);
-    creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
-    return TRUE;
-}
-
-void lose_all_mutations(player_type *creature_ptr)
-{
-    if (creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) {
-        chg_virtue(creature_ptr, V_CHANCE, -5);
-        msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
-        creature_ptr->muta1 = creature_ptr->muta2 = creature_ptr->muta3 = 0;
-        creature_ptr->update |= PU_BONUS;
-        handle_stuff(creature_ptr);
-        creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
-    }
-}
-
 /*!
  * @brief 現在プレイヤー得ている突然変異の数を返す。
  * @return 現在得ている突然変異の数
index 3edcf48..560d3cd 100644 (file)
@@ -2,8 +2,6 @@
 
 #include "system/angband.h"
 
-bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut);
-void lose_all_mutations(player_type *creature_ptr);
 int calc_mutant_regenerate_mod(player_type *creature_ptr);
 bool exe_mutation_power(player_type *creature_ptr, int power);
 void become_living_trump(player_type *creature_ptr);
index c395a95..ba85507 100644 (file)
@@ -15,7 +15,6 @@
 #include "main/sound-definitions-table.h"
 #include "main/sound-of-music.h"
 #include "mutation/mutation-investor-remover.h"
-#include "mutation/mutation.h"
 #include "object/object-broken.h"
 #include "object/object-generator.h"
 #include "object/object-info.h"
index ee516b0..718beb9 100644 (file)
@@ -1,7 +1,7 @@
 #include "spell-realm/spells-trump.h"
 #include "monster-floor/monster-summon.h"
 #include "monster-floor/place-monster-types.h"
-#include "mutation/mutation.h"
+#include "mutation/mutation-investor-remover.h"
 #include "player/avatar.h"
 #include "spell-kind/earthquake.h"
 #include "spell-kind/spells-charm.h"
index 598629c..a37f161 100644 (file)
@@ -11,7 +11,6 @@
 #include "game-option/disturbance-options.h"
 #include "grid/grid.h"
 #include "mutation/mutation-investor-remover.h"
-#include "mutation/mutation.h"
 #include "player/avatar.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"