OSDN Git Service

[Refactor] #38997 get_monster_hook() にplayer_type * 引数を追加 / Added player_type * argum...
authorHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 12:35:16 +0000 (21:35 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 12:35:16 +0000 (21:35 +0900)
src/floor-generate.c
src/monster.h
src/monster1.c
src/monster2.c
src/wild.c

index 2824694..14139f9 100644 (file)
@@ -603,7 +603,7 @@ static bool cave_gen(player_type *player_ptr)
 
        /* Fill the arrays of floors and walls in the good proportions */
        set_floor_and_wall(floor_ptr->dungeon_idx);
-       get_mon_num_prep(get_monster_hook(), NULL);
+       get_mon_num_prep(get_monster_hook(player_ptr), NULL);
 
        /* Randomize the dungeon creation values */
        dun_tun_rnd = rand_range(DUN_TUN_RND_MIN, DUN_TUN_RND_MAX);
@@ -1250,7 +1250,7 @@ static void generate_fixed_floor(player_type *player_ptr)
        floor_ptr->monster_level = floor_ptr->base_level;
 
        if (record_stair) exe_write_diary(player_ptr, DIARY_TO_QUEST, floor_ptr->inside_quest, NULL);
-       get_mon_num_prep(get_monster_hook(), NULL);
+       get_mon_num_prep(get_monster_hook(player_ptr), NULL);
 
        init_flags = INIT_CREATE_DUNGEON;
 
index c349610..8a103cc 100644 (file)
@@ -441,7 +441,7 @@ extern void display_roff(player_type *player_ptr);
 extern void output_monster_spoiler(player_type *player_ptr, MONRACE_IDX r_idx, void(*roff_func)(TERM_COLOR attr, concptr str));
 extern concptr extract_note_dies(MONRACE_IDX r_idx);
 extern void monster_death(player_type *player_ptr, MONSTER_IDX m_idx, bool drop_item);
-extern monsterrace_hook_type get_monster_hook(void);
+extern monsterrace_hook_type get_monster_hook(player_type *player_ptr);
 extern monsterrace_hook_type get_monster_hook2(POSITION y, POSITION x);
 extern void set_friendly(monster_type *m_ptr);
 extern void set_pet(monster_type *m_ptr);
index 7538c29..2c9ded5 100644 (file)
@@ -2143,11 +2143,11 @@ void output_monster_spoiler(player_type *player_ptr, MONRACE_IDX r_idx, void(*ro
  * @brief プレイヤーの現在の広域マップ座標から得た地勢を元にモンスターの生成条件関数を返す
  * @return 地勢にあったモンスターの生成条件関数
  */
-monsterrace_hook_type get_monster_hook(void)
+monsterrace_hook_type get_monster_hook(player_type *player_ptr)
 {
-       if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_quest)
+       if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
        {
-               switch (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain)
+               switch (wilderness[player_ptr->wilderness_y][player_ptr->wilderness_x].terrain)
                {
                case TERRAIN_TOWN:
                        return (monsterrace_hook_type)mon_hook_town;
index ec5f315..2b46895 100644 (file)
@@ -2282,7 +2282,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx)
                if (monster_has_hostile_align(&floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
        }
 
-       return (*(get_monster_hook()))(r_idx);
+       return (*(get_monster_hook(p_ptr)))(r_idx);
 }
 
 /*!
@@ -2413,7 +2413,7 @@ static bool monster_hook_tanuki(MONRACE_IDX r_idx)
        if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
                return FALSE;
 
-       return (*(get_monster_hook()))(r_idx);
+       return (*(get_monster_hook(p_ptr)))(r_idx);
 }
 
 
@@ -3210,7 +3210,7 @@ bool place_monster_aux(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_id
 bool place_monster(POSITION y, POSITION x, BIT_FLAGS mode)
 {
        MONRACE_IDX r_idx;
-       get_mon_num_prep(get_monster_hook(), get_monster_hook2(y, x));
+       get_mon_num_prep(get_monster_hook(p_ptr), get_monster_hook2(y, x));
 
        /* Pick a monster */
        r_idx = get_mon_num(p_ptr->current_floor_ptr->monster_level);
@@ -3238,7 +3238,7 @@ bool alloc_horde(POSITION y, POSITION x)
        int attempts = 1000;
        POSITION cy = y;
        POSITION cx = x;
-       get_mon_num_prep(get_monster_hook(), get_monster_hook2(y, x));
+       get_mon_num_prep(get_monster_hook(p_ptr), get_monster_hook2(y, x));
 
        floor_type *floor_ptr = p_ptr->current_floor_ptr;
        while (--attempts)
index 235ba55..f3f0d9c 100644 (file)
@@ -477,7 +477,7 @@ void wilderness_gen(player_type *creature_ptr)
        process_dungeon_file(creature_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
        POSITION x = creature_ptr->wilderness_x;
        POSITION y = creature_ptr->wilderness_y;
-       get_mon_num_prep(get_monster_hook(), NULL);
+       get_mon_num_prep(get_monster_hook(creature_ptr), NULL);
 
        /* North border */
        generate_area(creature_ptr, y - 1, x, TRUE, FALSE);