OSDN Git Service

[Refactor] #38997 get_mon_num() にplayer_type * 引数追加 / Added player_type * argument...
[hengband/hengband.git] / src / rooms-pitnest.c
index 6fa1775..be6e7cf 100644 (file)
@@ -24,7 +24,7 @@ struct vault_aux_type
 {
        concptr name;
        bool(*hook_func)(MONRACE_IDX r_idx);
-       void(*prep_func)(void);
+       void(*prep_func)(player_type *player_ptr);
        DEPTH level;
        int chance;
 };
@@ -265,6 +265,7 @@ static vault_aux_type pit_types[] =
 
 /*!
 * @brief タイプ5の部屋…nestを生成する / Type 5 -- Monster nests
+* @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 * @details
 * A monster nest is a "big" room, with an "inner" room, containing\n
@@ -283,7 +284,7 @@ static vault_aux_type pit_types[] =
 *\n
 * Note that "monster nests" will never contain "unique" monsters.\n
 */
-bool build_type5(floor_type *floor_ptr)
+bool build_type5(player_type *player_ptr)
 {
        POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i;
@@ -293,6 +294,7 @@ bool build_type5(floor_type *floor_ptr)
 
        grid_type *g_ptr;
 
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        int cur_nest_type = pick_vault_type(floor_ptr, nest_types, d_info[floor_ptr->dungeon_idx].nest);
        vault_aux_type *n_ptr;
 
@@ -302,8 +304,8 @@ bool build_type5(floor_type *floor_ptr)
        n_ptr = &nest_types[cur_nest_type];
 
        /* Process a preparation function if necessary */
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();
-       get_mon_num_prep(n_ptr->hook_func, NULL);
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
 
        align.sub_align = SUB_ALIGN_NEUTRAL;
 
@@ -317,7 +319,7 @@ bool build_type5(floor_type *floor_ptr)
                while (attempts--)
                {
                        /* Get a (hard) monster type */
-                       r_idx = get_mon_num(floor_ptr->dun_level + 11);
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
                        r_ptr = &r_info[r_idx];
 
                        /* Decline incorrect alignment */
@@ -408,10 +410,10 @@ bool build_type5(floor_type *floor_ptr)
        /* Place a secret door */
        switch (randint1(4))
        {
-       case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
-       case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
-       case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
-       case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
+       case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
+       case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
+       case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
+       case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
        }
 
        msg_format_wizard(CHEAT_DUNGEON, _("モンスター部屋(nest)(%s%s)を生成します。", "Monster nest (%s%s)"), n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
@@ -427,7 +429,7 @@ bool build_type5(floor_type *floor_ptr)
                        r_idx = nest_mon_info[i].r_idx;
 
                        /* Place that "random" monster (no groups) */
-                       (void)place_monster_aux(0, y, x, r_idx, 0L);
+                       (void)place_monster_aux(player_ptr, 0, y, x, r_idx, 0L);
 
                        nest_mon_info[i].used = TRUE;
                }
@@ -491,7 +493,7 @@ bool build_type5(floor_type *floor_ptr)
 *\n
 * Note that "monster pits" will never contain "unique" monsters.\n
 */
-bool build_type6(floor_type *floor_ptr)
+bool build_type6(player_type *player_ptr)
 {
        POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i, j;
@@ -502,6 +504,7 @@ bool build_type6(floor_type *floor_ptr)
 
        grid_type *g_ptr;
 
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
        vault_aux_type *n_ptr;
 
@@ -511,8 +514,8 @@ bool build_type6(floor_type *floor_ptr)
        n_ptr = &pit_types[cur_pit_type];
 
        /* Process a preparation function if necessary */
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();
-       get_mon_num_prep(n_ptr->hook_func, NULL);
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
 
        align.sub_align = SUB_ALIGN_NEUTRAL;
 
@@ -526,7 +529,7 @@ bool build_type6(floor_type *floor_ptr)
                while (attempts--)
                {
                        /* Get a (hard) monster type */
-                       r_idx = get_mon_num(floor_ptr->dun_level + 11);
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
                        r_ptr = &r_info[r_idx];
 
                        /* Decline incorrect alignment */
@@ -614,10 +617,10 @@ bool build_type6(floor_type *floor_ptr)
        /* Place a secret door */
        switch (randint1(4))
        {
-       case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
-       case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
-       case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
-       case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
+       case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
+       case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
+       case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
+       case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
        }
 
        /* Sort the entries */
@@ -655,51 +658,51 @@ bool build_type6(floor_type *floor_ptr)
        /* Top and bottom rows */
        for (x = xval - 9; x <= xval + 9; x++)
        {
-               place_monster_aux(0, yval - 2, x, what[0], PM_NO_KAGE);
-               place_monster_aux(0, yval + 2, x, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval - 2, x, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval + 2, x, what[0], PM_NO_KAGE);
        }
 
        /* Middle columns */
        for (y = yval - 1; y <= yval + 1; y++)
        {
-               place_monster_aux(0, y, xval - 9, what[0], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 9, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 9, what[0], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 9, what[0], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 8, what[1], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 8, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 8, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 8, what[1], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 7, what[1], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 7, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 7, what[1], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 7, what[1], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 6, what[2], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 6, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 6, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 6, what[2], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 5, what[2], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 5, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 5, what[2], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 5, what[2], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 4, what[3], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 4, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 4, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 4, what[3], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 3, what[3], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 3, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 3, what[3], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 3, what[3], PM_NO_KAGE);
 
-               place_monster_aux(0, y, xval - 2, what[4], PM_NO_KAGE);
-               place_monster_aux(0, y, xval + 2, what[4], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval - 2, what[4], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, xval + 2, what[4], PM_NO_KAGE);
        }
 
        /* Above/Below the center monster */
        for (x = xval - 1; x <= xval + 1; x++)
        {
-               place_monster_aux(0, yval + 1, x, what[5], PM_NO_KAGE);
-               place_monster_aux(0, yval - 1, x, what[5], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval + 1, x, what[5], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, yval - 1, x, what[5], PM_NO_KAGE);
        }
 
        /* Next to the center monster */
-       place_monster_aux(0, yval, xval + 1, what[6], PM_NO_KAGE);
-       place_monster_aux(0, yval, xval - 1, what[6], PM_NO_KAGE);
+       place_monster_aux(player_ptr, 0, yval, xval + 1, what[6], PM_NO_KAGE);
+       place_monster_aux(player_ptr, 0, yval, xval - 1, what[6], PM_NO_KAGE);
 
        /* Center monster */
-       place_monster_aux(0, yval, xval, what[7], PM_NO_KAGE);
+       place_monster_aux(player_ptr, 0, yval, xval, what[7], PM_NO_KAGE);
 
        return TRUE;
 }
@@ -767,7 +770,7 @@ static bool vault_aux_trapped_pit(MONRACE_IDX r_idx)
 *\n
 * Note that "monster pits" will never contain "unique" monsters.\n
 */
-bool build_type13(floor_type *floor_ptr)
+bool build_type13(player_type *player_ptr)
 {
        static int placing[][3] = {
                { -2, -9, 0 },{ -2, -8, 0 },{ -3, -7, 0 },{ -3, -6, 0 },
@@ -807,6 +810,7 @@ bool build_type13(floor_type *floor_ptr)
 
        grid_type *g_ptr;
 
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
        vault_aux_type *n_ptr;
 
@@ -819,8 +823,8 @@ bool build_type13(floor_type *floor_ptr)
        n_ptr = &pit_types[cur_pit_type];
 
        /* Process a preparation function if necessary */
-       if (n_ptr->prep_func) (*(n_ptr->prep_func))();
-       get_mon_num_prep(n_ptr->hook_func, vault_aux_trapped_pit);
+       if (n_ptr->prep_func) (*(n_ptr->prep_func))(player_ptr);
+       get_mon_num_prep(player_ptr, n_ptr->hook_func, vault_aux_trapped_pit);
 
        align.sub_align = SUB_ALIGN_NEUTRAL;
 
@@ -834,7 +838,7 @@ bool build_type13(floor_type *floor_ptr)
                while (attempts--)
                {
                        /* Get a (hard) monster type */
-                       r_idx = get_mon_num(floor_ptr->dun_level + 0);
+                       r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0);
                        r_ptr = &r_info[r_idx];
 
                        /* Decline incorrect alignment */
@@ -998,7 +1002,7 @@ bool build_type13(floor_type *floor_ptr)
        {
                y = yval + placing[i][0];
                x = xval + placing[i][1];
-               place_monster_aux(0, y, x, what[placing[i][2]], PM_NO_KAGE);
+               place_monster_aux(player_ptr, 0, y, x, what[placing[i][2]], PM_NO_KAGE);
        }
 
        return TRUE;