From: Hourier Date: Thu, 16 Jan 2020 12:35:16 +0000 (+0900) Subject: [Refactor] #38997 get_monster_hook() にplayer_type * 引数を追加 / Added player_type * argum... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=d254099df601bf5e7768835caa5f0aff8ca4ed07 [Refactor] #38997 get_monster_hook() にplayer_type * 引数を追加 / Added player_type * argument to get_monster_hook() --- diff --git a/src/floor-generate.c b/src/floor-generate.c index 2824694e6..14139f999 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -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; diff --git a/src/monster.h b/src/monster.h index c3496101c..8a103cc7e 100644 --- a/src/monster.h +++ b/src/monster.h @@ -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); diff --git a/src/monster1.c b/src/monster1.c index 7538c2915..2c9ded5b4 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -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; diff --git a/src/monster2.c b/src/monster2.c index ec5f315ee..2b46895d0 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -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) diff --git a/src/wild.c b/src/wild.c index 235ba5569..f3f0d9ca0 100644 --- a/src/wild.c +++ b/src/wild.c @@ -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);