OSDN Git Service

[Refactor] #40014 Moved set_target() and reset_target() from monster2.c/h to monster...
authorHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 11:30:58 +0000 (20:30 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 11:30:58 +0000 (20:30 +0900)
14 files changed:
src/combat/shoot.c
src/effect/effect-monster.c
src/floor/floor-save.c
src/io/load.c
src/melee/melee-postprocess.c
src/monster/monster-generator.c
src/monster/monster-move.c
src/monster/monster-move.h
src/monster/monster-status.c
src/monster/monster2.c
src/monster/monster2.h
src/mspell/mspells1.c
src/mspell/mspells2.c
src/spell-kind/spells-teleport.c

index 0229688..e5cc109 100644 (file)
@@ -20,8 +20,8 @@
 #include "monster/monster-death.h"
 #include "monster/monster-status.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-update.h"
-#include "monster/monster2.h"
 #include "mspell/monster-spell.h"
 #include "object-enchant/artifact.h"
 #include "object-enchant/tr-types.h"
index 537af2c..7496b44 100644 (file)
 #include "monster/monster-description-types.h"
 #include "monster/monster-death.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-remover.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
-#include "monster/monster2.h"
 #include "object-enchant/special-object-flags.h"
 #include "object/object-generator.h"
 #include "object/object-kind-hook.h"
index d7a124d..b267025 100644 (file)
@@ -533,7 +533,7 @@ static void place_pet(player_type *master_ptr)
 {
        int i;
        int max_num = master_ptr->wild_mode ? 1 : MAX_PARTY_MON;
-
+        floor_type *floor_ptr = master_ptr->current_floor_ptr;
        for (i = 0; i < max_num; i++)
        {
                POSITION cy = 0, cx = 0;
@@ -543,7 +543,7 @@ static void place_pet(player_type *master_ptr)
 
                if (i == 0)
                {
-                       m_idx = m_pop(master_ptr);
+                       m_idx = m_pop(floor_ptr);
                        master_ptr->riding = m_idx;
                        if (m_idx)
                        {
@@ -565,7 +565,7 @@ static void place_pet(player_type *master_ptr)
                                }
                                if (j) break;
                        }
-                       m_idx = (d == 6) ? 0 : m_pop(master_ptr);
+                       m_idx = (d == 6) ? 0 : m_pop(floor_ptr);
                }
 
                if (m_idx)
index 5ad0871..66c96c7 100644 (file)
@@ -69,6 +69,7 @@
 #include "monster-race/race-indice-types.h"
 #include "monster/monster-flag-types.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster2.h"
 #include "mutation/mutation.h"
 #include "object-enchant/artifact.h"
@@ -2644,7 +2645,7 @@ static errr rd_dungeon_old(player_type *creature_ptr)
        {
                MONSTER_IDX m_idx;
                monster_type *m_ptr;
-               m_idx = m_pop(creature_ptr);
+               m_idx = m_pop(floor_ptr);
                if (i != m_idx)
                {
                        note(format(_("モンスター配置エラー (%d <> %d)", "Monster allocation error (%d <> %d)"), i, m_idx));
@@ -2870,7 +2871,7 @@ static errr rd_saved_floor(player_type *player_ptr, saved_floor_type *sf_ptr)
                grid_type *g_ptr;
                MONSTER_IDX m_idx;
                monster_type *m_ptr;
-               m_idx = m_pop(player_ptr);
+               m_idx = m_pop(floor_ptr);
                if (i != m_idx) return 162;
 
                m_ptr = &floor_ptr->m_list[m_idx];
index 1193a38..6bccad1 100644 (file)
@@ -23,9 +23,9 @@
 #include "monster/monster-description-types.h"
 #include "monster/monster-death.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-remover.h"
 #include "monster/monster-status.h"
-#include "monster/monster2.h"
 #include "mspell/monster-spell.h"
 #include "pet/pet-fall-off.h"
 #include "player/player-class.h"
index 7f32b23..75ccad8 100644 (file)
@@ -21,6 +21,7 @@
 #include "monster-race/race-indice-types.h"
 #include "monster/monster-flag-types.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
 #include "monster/monster-util.h"
@@ -422,7 +423,7 @@ static bool place_monster_one(player_type *player_ptr, MONSTER_IDX who, POSITION
     if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL) || (r_ptr->level < 10))
         mode &= ~PM_KAGE;
 
-    g_ptr->m_idx = m_pop(player_ptr);
+    g_ptr->m_idx = m_pop(floor_ptr);
     hack_m_idx_ii = g_ptr->m_idx;
     if (!g_ptr->m_idx)
         return FALSE;
index 0d56035..8025692 100644 (file)
@@ -507,3 +507,23 @@ void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy
                msg_format(_("%^s%s", "%^s %s"), m_name, monmessage);
        }
 }
+
+/*!
+ * @brief モンスターの目標地点をセットする / Set the target of counter attack
+ * @param m_ptr モンスターの参照ポインタ
+ * @param y 目標y座標
+ * @param x 目標x座標
+ * @return なし
+ */
+void set_target(monster_type *m_ptr, POSITION y, POSITION x)
+{
+    m_ptr->target_y = y;
+    m_ptr->target_x = x;
+}
+
+/*!
+ * @brief モンスターの目標地点をリセットする / Reset the target of counter attack
+ * @param m_ptr モンスターの参照ポインタ
+ * @return なし
+ */
+void reset_target(monster_type *m_ptr) { set_target(m_ptr, 0, 0); }
index d7bd03d..0e274a2 100644 (file)
@@ -1,7 +1,10 @@
 #pragma once
 
-#include "system/angband.h"
 #include "monster/monster-processor-util.h"
+#include "system/angband.h"
+#include "system/monster-type-definition.h"
 
 bool process_monster_movement(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, DIRECTION *mm, POSITION oy, POSITION ox, int *count);
 void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox, bool aware);
+void set_target(monster_type *m_ptr, POSITION y, POSITION x);
+void reset_target(monster_type *m_ptr);
index 8aaa532..3be0db8 100644 (file)
@@ -3,6 +3,7 @@
 #include "autopick/autopick-pref-processor.h"
 #include "cmd-io/cmd-dump.h"
 #include "cmd/cmd-draw.h"
+#include "core/speed-table.h"
 #include "core/stuff-handler.h"
 #include "dungeon/dungeon.h"
 #include "floor/floor.h"
@@ -13,6 +14,7 @@
 #include "main/sound-definitions-table.h"
 #include "monster-attack/monster-attack-effect.h"
 #include "monster-attack/monster-attack-types.h"
+#include "monster-race/monster-race-hook.h"
 #include "monster-race/race-flags-ability2.h"
 #include "monster-race/race-flags-resistance.h"
 #include "monster-race/race-flags1.h"
 #include "monster-race/race-flags4.h"
 #include "monster-race/race-flags7.h"
 #include "monster-race/race-flags8.h"
-#include "monster-race/monster-race-hook.h"
 #include "monster-race/race-indice-types.h"
-#include "core/speed-table.h"
-#include "monster/monster-describer.h"
 #include "monster/monster-death.h"
+#include "monster/monster-describer.h"
 #include "monster/monster-description-types.h"
 #include "monster/monster-flag-types.h"
 #include "monster/monster-generator.h"
+#include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-processor.h"
 #include "monster/monster-remover.h"
 #include "monster/monster-update.h"
 #include "monster/monster-util.h"
-#include "monster/monster-info.h"
 #include "monster/monster2.h"
 #include "monster/place-monster-types.h"
 #include "monster/smart-learn-types.h"
index 77b903d..1c07645 100644 (file)
 #define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
 
 /*!
- * @brief モンスターの目標地点をセットする / Set the target of counter attack
- * @param m_ptr モンスターの参照ポインタ
- * @param y 目標y座標
- * @param x 目標x座標
- * @return なし
- */
-void set_target(monster_type *m_ptr, POSITION y, POSITION x)
-{
-    m_ptr->target_y = y;
-    m_ptr->target_x = x;
-}
-
-/*!
- * @brief モンスターの目標地点をリセットする / Reset the target of counter attack
- * @param m_ptr モンスターの参照ポインタ
- * @return なし
- */
-void reset_target(monster_type *m_ptr) { set_target(m_ptr, 0, 0); }
-
-/*!
- * todo ここには本来floor_type*を追加したいが、monster.hにfloor.hの参照を追加するとコンパイルエラーが出るので保留
  * @brief モンスター配列の空きを探す / Acquires and returns the index of a "free" monster.
  * @return 利用可能なモンスター配列の添字
  * @details
  * This routine should almost never fail, but it *can* happen.
  */
-MONSTER_IDX m_pop(player_type *player_ptr)
+MONSTER_IDX m_pop(floor_type *floor_ptr)
 {
     /* Normal allocation */
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
     if (floor_ptr->m_max < current_world_ptr->max_m_idx) {
         MONSTER_IDX i = floor_ptr->m_max;
         floor_ptr->m_max++;
index bc1cbe0..c650127 100644 (file)
@@ -4,9 +4,7 @@
 #include "floor/floor.h"
 #include "system/monster-type-definition.h"
 
-void set_target(monster_type *m_ptr, POSITION y, POSITION x);
-void reset_target(monster_type *m_ptr);
-MONSTER_IDX m_pop(player_type *player_ptr);
+MONSTER_IDX m_pop(floor_type *floor_ptr);
 
 #define GMN_ARENA 0x00000001 //!< 賭け闘技場向け生成
 MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option);
index c8e715f..180f49b 100644 (file)
@@ -56,8 +56,8 @@
 #include "monster/monster-description-types.h"
 #include "monster/monster-flag-types.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-status.h"
-#include "monster/monster2.h"
 #include "monster/smart-learn-types.h"
 #include "mspell/assign-monster-spell.h"
 #include "mspell/monster-spell.h"
index 239f880..0a30be6 100644 (file)
@@ -26,8 +26,8 @@
 #include "monster/monster-describer.h"
 #include "monster/monster-description-types.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-status.h"
-#include "monster/monster2.h"
 #include "mspell/assign-monster-spell.h"
 #include "mspell/monster-spell.h"
 #include "pet/pet-util.h"
index d534220..c03a33a 100644 (file)
 #include "monster/monster-describer.h"
 #include "monster/monster-description-types.h"
 #include "monster/monster-info.h"
+#include "monster/monster-move.h"
 #include "monster/monster-remover.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
-#include "monster/monster2.h"
 #include "monster/smart-learn-types.h"
 #include "object-enchant/tr-types.h"
 #include "object/object-flags.h"