OSDN Git Service

[Refactor] #40014 Removed the dependency from monster-generator.c to monster-summon.h
authorHourier <hourier@users.sourceforge.jp>
Sat, 13 Jun 2020 04:11:40 +0000 (13:11 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 13 Jun 2020 04:11:40 +0000 (13:11 +0900)
src/floor/floor-generate.c
src/floor/floor-save.c
src/floor/wild.c
src/monster-floor/monster-generator.c
src/monster-floor/monster-generator.h
src/monster-floor/monster-summon.c
src/wizard/wizard-special-process.c
src/world/world-turn-processor.c

index 79609de..a5f040d 100644 (file)
@@ -32,6 +32,7 @@
 #include "monster/monster-flag-types.h"
 #include "monster-floor/monster-generator.h"
 #include "monster-floor/monster-remover.h"
+#include "monster-floor/monster-summon.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
 #include "monster/monster-util.h"
@@ -847,7 +848,7 @@ static bool cave_gen(player_type *player_ptr, concptr *why)
        /* Put some monsters in the dungeon */
        for (i = i + k; i > 0; i--)
        {
-               (void)alloc_monster(player_ptr, 0, PM_ALLOW_SLEEP);
+               (void)alloc_monster(player_ptr, 0, PM_ALLOW_SLEEP, summon_specific);
        }
 
        /* Place some traps in the dungeon */
index 1fec2bc..58793a1 100644 (file)
 #include "io/uid-checker.h"
 #include "io/write-diary.h"
 #include "mind/mind-mirror-master.h"
+#include "monster-floor/monster-generator.h"
+#include "monster-floor/monster-remover.h"
+#include "monster-floor/monster-summon.h"
 #include "monster-race/race-flags1.h"
 #include "monster-race/race-flags2.h"
 #include "monster-race/race-flags7.h"
 #include "monster/monster-describer.h"
 #include "monster/monster-description-types.h"
 #include "monster/monster-flag-types.h"
-#include "monster-floor/monster-generator.h"
 #include "monster/monster-info.h"
 #include "monster/monster-list.h"
-#include "monster-floor/monster-remover.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
 #include "monster/smart-learn-types.h"
@@ -1274,7 +1275,7 @@ void change_floor(player_type *creature_ptr)
                        for (i = 0; i < alloc_times; i++)
                        {
                                /* Make a (group of) new monster */
-                               (void)alloc_monster(creature_ptr, 0, 0);
+                               (void)alloc_monster(creature_ptr, 0, 0, summon_specific);
                        }
 
                }
index 3f95718..353a2cc 100644 (file)
@@ -23,6 +23,7 @@
 #include "main/init.h"
 #include "monster-floor/monster-generator.h"
 #include "monster-floor/monster-remover.h"
+#include "monster-floor/monster-summon.h"
 #include "monster/monster-status.h"
 #include "monster/monster-util.h"
 #include "monster/monster-info.h"
@@ -683,7 +684,7 @@ void wilderness_gen(player_type *creature_ptr)
                        mode |= PM_ALLOW_SLEEP;
 
                /* Make a resident */
-               (void)alloc_monster(creature_ptr, generate_encounter ? 0 : 3, mode);
+               (void)alloc_monster(creature_ptr, generate_encounter ? 0 : 3, mode, summon_specific);
        }
 
        if(generate_encounter) creature_ptr->ambush_flag = TRUE;
index 544442a..f8ea7c6 100644 (file)
@@ -8,7 +8,6 @@
 #include "monster-floor/monster-generator.h"
 #include "dungeon/dungeon.h"
 #include "floor/floor.h"
-#include "monster-floor/monster-summon.h" // todo 相互依存してしまった、何とかする.
 #include "monster-floor/one-monster-placer.h"
 #include "monster-floor/place-monster-types.h"
 #include "monster-race/monster-race-hook.h"
@@ -334,7 +333,7 @@ bool place_monster(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mo
  * @param x 生成地点x座標
  * @return 生成に成功したらtrue
  */
-bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x)
+bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x, summon_specific_pf summon_specific)
 {
     get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
 
@@ -377,7 +376,7 @@ bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x)
     POSITION cx = x;
     for (attempts = randint1(10) + 5; attempts; attempts--) {
         scatter(player_ptr, &cy, &cx, y, x, 5, 0);
-        (void)summon_specific(player_ptr, m_idx, cy, cx, floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP);
+        (void)(*summon_specific)(player_ptr, m_idx, cy, cx, floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP);
         y = cy;
         x = cx;
     }
@@ -436,7 +435,7 @@ bool alloc_guardian(player_type *player_ptr, bool def_val)
  * Use "slp" to choose the initial "sleep" status
  * Use "floor_ptr->monster_level" for the monster level
  */
-bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode)
+bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode, summon_specific_pf summon_specific)
 {
     if (alloc_guardian(player_ptr, FALSE))
         return TRUE;
@@ -469,7 +468,7 @@ bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode)
     }
 
     if (randint1(5000) <= floor_ptr->dun_level) {
-        if (alloc_horde(player_ptr, y, x)) {
+        if (alloc_horde(player_ptr, y, x, summon_specific)) {
             return TRUE;
         }
     } else {
index 689ce0d..1d3a72d 100644 (file)
@@ -2,10 +2,12 @@
 
 #include "system/angband.h"
 
+typedef bool (*summon_specific_pf)(player_type *, MONSTER_IDX, POSITION, POSITION, DEPTH, int, BIT_FLAGS);
+
 bool mon_scatter(player_type *player_ptr, MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist);
 bool multiply_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode);
 bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode);
 bool place_monster(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
-bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x);
+bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x, summon_specific_pf summon_specific);
 bool alloc_guardian(player_type *player_ptr, bool def_val);
-bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode);
+bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode, summon_specific_pf summon_specific);
index 957027a..e27e07e 100644 (file)
@@ -2,7 +2,7 @@
 #include "dungeon/dungeon.h"
 #include "floor/floor.h"
 #include "main/sound-definitions-table.h"
-#include "monster-floor/monster-generator.h" // todo 相互依存してしまった、何とかする.
+#include "monster-floor/monster-generator.h"
 #include "monster-floor/place-monster-types.h"
 #include "monster-race/monster-race-hook.h"
 #include "monster-race/race-flags1.h"
index e2f8815..1b920e0 100644 (file)
@@ -194,7 +194,7 @@ static void do_cmd_summon_horde(player_type *caster_ptr)
                if (is_cave_empty_bold(caster_ptr, wy, wx)) break;
        }
 
-       (void)alloc_horde(caster_ptr, wy, wx);
+       (void)alloc_horde(caster_ptr, wy, wx, summon_specific);
 }
 
 /*!
index dc94efd..639642e 100644 (file)
@@ -11,8 +11,9 @@
 #include "io/write-diary.h"
 #include "market/arena.h"
 #include "market/bounty.h"
-#include "monster/monster-describer.h"
 #include "monster-floor/monster-generator.h"
+#include "monster-floor/monster-summon.h"
+#include "monster/monster-describer.h"
 #include "monster/monster-status.h"
 #include "mutation/mutation-processor.h"
 #include "object/lite-processor.h"
@@ -145,7 +146,7 @@ void process_world(player_type *player_ptr)
     }
 
     if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) && !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out) {
-        (void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
+        (void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0, summon_specific);
     }
 
     if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out)