OSDN Git Service

[Refactor] #38997 get_mon_num_prep() とchoose_new_monster() にplayer_type * 引数追加 /...
authorHourier <hourier@users.sourceforge.jp>
Sat, 18 Jan 2020 03:54:28 +0000 (12:54 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 18 Jan 2020 14:01:52 +0000 (23:01 +0900)
21 files changed:
src/birth.c
src/bldg.c
src/bldg.h
src/core.c
src/floor-generate.c
src/floor-save.c
src/load.c
src/monster-process.c
src/monster.h
src/monster1.c
src/monster2.c
src/monsterrace-hook.c
src/monsterrace-hook.h
src/object2.c
src/player-status.c
src/quest.c
src/quest.h
src/rooms-pitnest.c
src/rooms-special.c
src/spells1.c
src/wild.c

index f7356a4..58ac5bd 100644 (file)
@@ -1883,11 +1883,12 @@ static void init_dungeon_quests(player_type *creature_ptr)
 
        /* Init the random quests */
        init_flags = INIT_ASSIGN;
-       creature_ptr->current_floor_ptr->inside_quest = MIN_RANDOM_QUEST;
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       floor_ptr->inside_quest = MIN_RANDOM_QUEST;
 
        process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
 
-       creature_ptr->current_floor_ptr->inside_quest = 0;
+       floor_ptr->inside_quest = 0;
 
        /* Generate quests */
        for (i = MIN_RANDOM_QUEST + number_of_quests - 1; i >= MIN_RANDOM_QUEST; i--)
@@ -1896,7 +1897,7 @@ static void init_dungeon_quests(player_type *creature_ptr)
                monster_race *quest_r_ptr;
 
                q_ptr->status = QUEST_STATUS_TAKEN;
-               determine_random_questor(q_ptr);
+               determine_random_questor(creature_ptr, q_ptr);
 
                /* Mark uniques */
                quest_r_ptr = &r_info[q_ptr->r_idx];
@@ -1907,20 +1908,21 @@ static void init_dungeon_quests(player_type *creature_ptr)
 
        /* Init the two main quests (Oberon + Serpent) */
        init_flags = INIT_ASSIGN;
-       creature_ptr->current_floor_ptr->inside_quest = QUEST_OBERON;
+       floor_ptr->inside_quest = QUEST_OBERON;
 
        process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_OBERON].status = QUEST_STATUS_TAKEN;
 
-       creature_ptr->current_floor_ptr->inside_quest = QUEST_SERPENT;
+       floor_ptr->inside_quest = QUEST_SERPENT;
 
        process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_SERPENT].status = QUEST_STATUS_TAKEN;
-       creature_ptr->current_floor_ptr->inside_quest = 0;
+       floor_ptr->inside_quest = 0;
 }
 
+
 /*!
  * @brief ゲームターンを初期化する / Reset turn
  * @details アンデッド系種族は開始時刻を夜からにする。
@@ -2254,7 +2256,7 @@ void player_outfit(player_type *creature_ptr)
 
        case RACE_DEMON:
                /* Demon can drain vitality from humanoid corpse */
-               get_mon_num_prep(monster_hook_human, NULL);
+               get_mon_num_prep(creature_ptr, monster_hook_human, NULL);
 
                for (i = rand_range(3, 4); i > 0; i--)
                {
index 2adebe4..f7d7761 100644 (file)
@@ -1584,7 +1584,7 @@ void update_gambling_monsters(player_type *player_ptr)
                        int j;
                        while (TRUE)
                        {
-                               get_mon_num_prep(monster_can_entry_arena, NULL);
+                               get_mon_num_prep(player_ptr, monster_can_entry_arena, NULL);
                                player_ptr->phase_out = TRUE;
                                r_idx = get_mon_num(mon_level);
                                player_ptr->phase_out = old_inside_battle;
@@ -4235,7 +4235,7 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
        }
 
        player_ptr->phase_out = TRUE;
-       get_mon_num_prep(NULL, NULL);
+       get_mon_num_prep(player_ptr, NULL, NULL);
 
        while (TRUE)
        {
@@ -4260,11 +4260,12 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
 
 /*!
  * @brief 賞金首となるユニークを確定する / Determine bounty uniques
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void determine_bounty_uniques(void)
+void determine_bounty_uniques(player_type *player_ptr)
 {
-       get_mon_num_prep(NULL, NULL);
+       get_mon_num_prep(player_ptr, NULL, NULL);
        for (int i = 0; i < MAX_BOUNTY; i++)
        {
                while (TRUE)
index b69d805..9c67a6d 100644 (file)
@@ -122,4 +122,4 @@ extern void do_cmd_bldg(player_type *player_ptr);
 
 extern void clear_bldg(int min_row, int max_row);
 extern void determine_daily_bounty(player_type *player_ptr, bool conv_old);
-extern void determine_bounty_uniques(void);
+extern void determine_bounty_uniques(player_type *player_ptr);
index 098fee8..6a5abca 100644 (file)
@@ -4374,7 +4374,7 @@ static void process_fishing(player_type *creature_ptr)
        {
                MONRACE_IDX r_idx;
                bool success = FALSE;
-               get_mon_num_prep(monster_is_fishing_target, NULL);
+               get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
                r_idx = get_mon_num(creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
                msg_print(NULL);
                if (r_idx && one_in_(2))
@@ -5410,7 +5410,7 @@ void play_game(player_type *player_ptr, bool new_game)
 
                load = FALSE;
 
-               determine_bounty_uniques();
+               determine_bounty_uniques(player_ptr);
                determine_daily_bounty(player_ptr, FALSE);
 
                /* Initialize object array */
index 3a354f4..dc16f50 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(player_ptr), NULL);
+       get_mon_num_prep(player_ptr, 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(player_ptr), NULL);
+       get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), NULL);
 
        init_flags = INIT_CREATE_DUNGEON;
 
index e1b5e51..9652fec 100644 (file)
@@ -562,7 +562,7 @@ static void place_pet(player_type *master_ptr)
 
                if (i == 0)
                {
-                       m_idx = m_pop();
+                       m_idx = m_pop(master_ptr);
                        master_ptr->riding = m_idx;
                        if (m_idx)
                        {
@@ -584,7 +584,7 @@ static void place_pet(player_type *master_ptr)
                                }
                                if (j) break;
                        }
-                       m_idx = (d == 6) ? 0 : m_pop();
+                       m_idx = (d == 6) ? 0 : m_pop(master_ptr);
                }
 
                if (m_idx)
index 93f9b4d..e14fa11 100644 (file)
@@ -1916,7 +1916,7 @@ static void rd_extra(player_type *creature_ptr)
 
        if (z_older_than(10, 0, 3))
        {
-               determine_bounty_uniques();
+               determine_bounty_uniques(creature_ptr);
 
                for (int i = 0; i < MAX_BOUNTY; i++)
                {
@@ -2882,7 +2882,7 @@ static errr rd_dungeon_old(player_type *creature_ptr)
                monster_type *m_ptr;
 
                /* Get a new record */
-               m_idx = m_pop();
+               m_idx = m_pop(creature_ptr);
 
                if (i != m_idx)
                {
@@ -3169,7 +3169,7 @@ static errr rd_saved_floor(player_type *player_ptr, saved_floor_type *sf_ptr)
                monster_type *m_ptr;
 
                /* Get a new record */
-               m_idx = m_pop();
+               m_idx = m_pop(player_ptr);
 
                if (i != m_idx) return 162;
 
@@ -3549,7 +3549,7 @@ static errr rd_savefile_new_aux(player_type *creature_ptr)
 
                        if ((q_ptr->type == QUEST_TYPE_RANDOM) && (!q_ptr->r_idx))
                        {
-                               determine_random_questor(&quest[i]);
+                               determine_random_questor(creature_ptr, &quest[i]);
                        }
 
                        /* Load quest item index */
index 07cb8da..ac1f03f 100644 (file)
@@ -1270,7 +1270,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
 
        if ((m_ptr->mflag2 & MFLAG2_CHAMELEON) && one_in_(13) && !MON_CSLEEP(m_ptr))
        {
-               choose_new_monster(m_idx, FALSE, 0);
+               choose_new_monster(target_ptr, m_idx, FALSE, 0);
                r_ptr = &r_info[m_ptr->r_idx];
        }
 
index b826e71..d6b00c8 100644 (file)
@@ -472,7 +472,7 @@ extern void delete_monster_idx(MONSTER_IDX i);
 extern void compact_monsters(player_type *player_ptr, int size);
 extern void wipe_monsters_list(player_type *player_ptr);
 extern MONSTER_IDX m_pop(player_type *player_ptr);
-extern errr get_mon_num_prep(monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2);
+extern errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2);
 extern MONRACE_IDX get_mon_num(DEPTH level);
 extern int lore_do_probe(MONRACE_IDX r_idx);
 extern void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold);
@@ -506,7 +506,7 @@ extern bool summon_named_creature(player_type *player_ptr, MONSTER_IDX who, POSI
 #define DRS_REFLECT     32
 extern void update_smart_learn(MONSTER_IDX m_idx, int what);
 
-extern void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx);
+extern void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx);
 extern SPEED get_mspeed(monster_race *r_ptr);
 extern void monster_drop_carried_objects(monster_type *m_ptr);
 
index a72fede..8469327 100644 (file)
@@ -2594,7 +2594,7 @@ void monster_death(player_type *player_ptr, MONSTER_IDX m_idx, bool drop_item)
 
        if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
        {
-               choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
+               choose_new_monster(player_ptr, m_idx, TRUE, MON_CHAMELEON);
                r_ptr = &r_info[m_ptr->r_idx];
        }
 
index 6e1da62..0e49f35 100644 (file)
@@ -825,12 +825,15 @@ static int chameleon_change_m_idx = 0;
 
 
 /*!
+ * todo ここには本来floor_type*を追加したいが、monster.hにfloor.hの参照を追加するとコンパイルエラーが出るので保留
  * @brief 指定されたモンスター種族がダンジョンの制限にかかるかどうかをチェックする / Some dungeon types restrict the possible monsters.
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param r_idx チェックするモンスター種族ID
  * @return 召喚条件が一致するならtrue / Return TRUE is the monster is OK and FALSE otherwise
  */
-static bool restrict_monster_to_dungeon(DUNGEON_IDX d_idx, MONRACE_IDX r_idx)
+static bool restrict_monster_to_dungeon(player_type *player_ptr, MONRACE_IDX r_idx)
 {
+       DUNGEON_IDX d_idx = player_ptr->dungeon_idx;
        dungeon_type *d_ptr = &d_info[d_idx];
        monster_race *r_ptr = &r_info[r_idx];
        byte a;
@@ -859,7 +862,7 @@ static bool restrict_monster_to_dungeon(DUNGEON_IDX d_idx, MONRACE_IDX r_idx)
                        return FALSE;
        }
 
-       floor_type *floor_ptr = p_ptr->current_floor_ptr;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (d_ptr->flags1 & DF1_BEGINNER)
        {
                if (r_ptr->level > floor_ptr->dun_level)
@@ -1027,12 +1030,12 @@ monsterrace_hook_type get_mon_num2_hook;
 
 /*!
  * @brief モンスター生成制限関数最大2つから / Apply a "monster restriction function" to the "monster allocation table"
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param monster_hook 制限関数1
  * @param monster_hook2 制限関数2
  * @return エラーコード
  */
-errr get_mon_num_prep(monsterrace_hook_type monster_hook,
-       monsterrace_hook_type monster_hook2)
+errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2)
 {
        int i;
 
@@ -1043,7 +1046,7 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook,
        get_mon_num2_hook = monster_hook2;
 
        /* Scan the allocation table */
-       floor_type *floor_ptr = p_ptr->current_floor_ptr;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        for (i = 0; i < alloc_race_size; i++)
        {
                monster_race *r_ptr;
@@ -1059,7 +1062,7 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook,
                        (get_mon_num2_hook && !((*get_mon_num2_hook)(entry->index))))
                        continue;
 
-               if (!p_ptr->phase_out && !chameleon_change_m_idx &&
+               if (!player_ptr->phase_out && !chameleon_change_m_idx &&
                        summon_specific_type != SUMMON_GUARDIANS)
                {
                        /* Hack -- don't create questors */
@@ -1079,9 +1082,9 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook,
                entry->prob2 = entry->prob1;
 
                if (floor_ptr->dun_level && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest)) &&
-                       !restrict_monster_to_dungeon(p_ptr->dungeon_idx, entry->index) && !p_ptr->phase_out)
+                       !restrict_monster_to_dungeon(player_ptr, entry->index) && !player_ptr->phase_out)
                {
-                       int hoge = entry->prob2 * d_info[p_ptr->dungeon_idx].special_div;
+                       int hoge = entry->prob2 * d_info[player_ptr->dungeon_idx].special_div;
                        entry->prob2 = hoge / 64;
                        if (randint0(64) < (hoge & 0x3f)) entry->prob2++;
                }
@@ -2295,15 +2298,16 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx)
 
 /*!
  * @brief モンスターの変身処理
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param m_idx 変身処理を受けるモンスター情報のID
  * @param born 生成時の初変身先指定ならばtrue
  * @param r_idx 旧モンスター種族のID
  * @return なし
  */
-void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
+void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 {
        int oldmaxhp;
-       floor_type *floor_ptr = p_ptr->current_floor_ptr;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        monster_race *r_ptr;
        char old_m_name[MAX_NLEN];
@@ -2323,18 +2327,18 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 
                chameleon_change_m_idx = m_idx;
                if (old_unique)
-                       get_mon_num_prep(monster_hook_chameleon_lord, NULL);
+                       get_mon_num_prep(player_ptr, monster_hook_chameleon_lord, NULL);
                else
-                       get_mon_num_prep(monster_hook_chameleon, NULL);
+                       get_mon_num_prep(player_ptr, monster_hook_chameleon, NULL);
 
                if (old_unique)
                        level = r_info[MON_CHAMELEON_K].level;
                else if (!floor_ptr->dun_level)
-                       level = wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level;
+                       level = wilderness[player_ptr->wilderness_y][player_ptr->wilderness_x].level;
                else
                        level = floor_ptr->dun_level;
 
-               if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level += 2 + randint1(3);
+               if (d_info[player_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level += 2 + randint1(3);
 
                r_idx = get_mon_num(level);
                r_ptr = &r_info[r_idx];
@@ -2345,12 +2349,12 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 
        m_ptr->r_idx = r_idx;
        m_ptr->ap_r_idx = r_idx;
-       update_monster(p_ptr, m_idx, FALSE);
+       update_monster(player_ptr, m_idx, FALSE);
        lite_spot(m_ptr->fy, m_ptr->fx);
 
        if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) ||
                (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)))
-               p_ptr->update |= (PU_MON_LITE);
+               player_ptr->update |= (PU_MON_LITE);
 
        if (born)
        {
@@ -2364,13 +2368,13 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
                return;
        }
 
-       if (m_idx == p_ptr->riding)
+       if (m_idx == player_ptr->riding)
        {
                GAME_TEXT m_name[MAX_NLEN];
                monster_desc(m_name, m_ptr, 0);
                msg_format(_("突然%sが変身した。", "Suddenly, %s transforms!"), old_m_name);
                if (!(r_ptr->flags7 & RF7_RIDING))
-                       if (rakuba(p_ptr, 0, TRUE)) msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
+                       if (rakuba(player_ptr, 0, TRUE)) msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
        }
 
        /* Extract the monster base speed */
@@ -2426,11 +2430,12 @@ static bool monster_hook_tanuki(MONRACE_IDX r_idx)
 
 
 /*!
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @brief モンスターの表層IDを設定する / Set initial racial appearance of a monster
  * @param r_idx モンスター種族ID
  * @return モンスター種族の表層ID
  */
-static MONRACE_IDX initial_r_appearance(MONRACE_IDX r_idx, BIT_FLAGS generate_mode)
+static MONRACE_IDX initial_r_appearance(player_type *player_ptr, MONRACE_IDX r_idx, BIT_FLAGS generate_mode)
 {
        floor_type *floor_ptr = p_ptr->current_floor_ptr;
        int attempts = 1000;
@@ -2446,7 +2451,7 @@ static MONRACE_IDX initial_r_appearance(MONRACE_IDX r_idx, BIT_FLAGS generate_mo
        if (!(r_info[r_idx].flags7 & RF7_TANUKI))
                return r_idx;
 
-       get_mon_num_prep(monster_hook_tanuki, NULL);
+       get_mon_num_prep(player_ptr, monster_hook_tanuki, NULL);
 
        while (--attempts)
        {
@@ -2627,7 +2632,7 @@ static bool place_monster_one(player_type *player_ptr, MONSTER_IDX who, POSITION
 
        /* Save the race */
        m_ptr->r_idx = r_idx;
-       m_ptr->ap_r_idx = initial_r_appearance(r_idx, mode);
+       m_ptr->ap_r_idx = initial_r_appearance(player_ptr, r_idx, mode);
 
        /* No flags */
        m_ptr->mflag = 0;
@@ -2683,7 +2688,7 @@ static bool place_monster_one(player_type *player_ptr, MONSTER_IDX who, POSITION
 
        if (r_ptr->flags7 & RF7_CHAMELEON)
        {
-               choose_new_monster(g_ptr->m_idx, TRUE, 0);
+               choose_new_monster(player_ptr, g_ptr->m_idx, TRUE, 0);
                r_ptr = &r_info[m_ptr->r_idx];
                m_ptr->mflag2 |= MFLAG2_CHAMELEON;
 
@@ -3185,7 +3190,7 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
 
                        /* Require empty grids */
                        if (!cave_empty_bold2(player_ptr->current_floor_ptr, ny, nx)) continue;
-                       get_mon_num_prep(place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
+                       get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
 
                        /* Pick a random race */
                        z = get_mon_num(r_ptr->level);
@@ -3221,7 +3226,7 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
 bool place_monster(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode)
 {
        MONRACE_IDX r_idx;
-       get_mon_num_prep(get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
+       get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
 
        /* Pick a monster */
        r_idx = get_mon_num(player_ptr->current_floor_ptr->monster_level);
@@ -3250,7 +3255,7 @@ bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x)
        int attempts = 1000;
        POSITION cy = y;
        POSITION cx = x;
-       get_mon_num_prep(get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
+       get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
 
        floor_type *floor_ptr = player_ptr->current_floor_ptr;
        while (--attempts)
@@ -3505,7 +3510,7 @@ bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSI
        summon_specific_type = type;
 
        summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE;
-       get_mon_num_prep(summon_specific_okay, get_monster_hook2(player_ptr, y, x));
+       get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
 
        /* Pick a monster, using the level calculation */
        r_idx = get_mon_num((floor_ptr->dun_level + lev) / 2 + 5);
index 64be91d..7a9757a 100644 (file)
@@ -21,37 +21,39 @@ BIT_FLAGS vault_aux_dragon_mask4;
 
 /*!
 * @brief pit/nestの基準となる単種モンスターを決める /
+* @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
-void vault_prep_clone(void)
+void vault_prep_clone(player_type *player_ptr)
 {
        /* Apply the monster restriction */
-       get_mon_num_prep(vault_aux_simple, NULL);
+       get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
 
        /* Pick a race to clone */
        vault_aux_race = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10);
 
        /* Remove the monster restriction */
-       get_mon_num_prep(NULL, NULL);
+       get_mon_num_prep(player_ptr, NULL, NULL);
 }
 
 
 /*!
 * @brief pit/nestの基準となるモンスターシンボルを決める /
+* @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
-void vault_prep_symbol(void)
+void vault_prep_symbol(player_type *player_ptr)
 {
        MONRACE_IDX r_idx;
 
        /* Apply the monster restriction */
-       get_mon_num_prep(vault_aux_simple, NULL);
+       get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
 
        /* Pick a race to clone */
        r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10);
 
        /* Remove the monster restriction */
-       get_mon_num_prep(NULL, NULL);
+       get_mon_num_prep(player_ptr, NULL, NULL);
 
        /* Extract the symbol */
        vault_aux_char = r_info[r_idx].d_char;
@@ -59,11 +61,14 @@ void vault_prep_symbol(void)
 
 
 /*!
+* todo 関数ポインタ設計の都合上、使わないが引数に含めなければならない
 * @brief pit/nestの基準となるドラゴンの種類を決める /
+* @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
-void vault_prep_dragon(void)
+void vault_prep_dragon(player_type *player_ptr)
 {
+       (void)player_ptr;
        /* Pick dragon type */
        switch (randint0(6))
        {
index 2f978dd..b9a504f 100644 (file)
@@ -34,9 +34,9 @@ extern bool mon_hook_shallow_water(MONRACE_IDX r_idx);
 extern bool mon_hook_lava(MONRACE_IDX r_idx);
 extern bool mon_hook_floor(MONRACE_IDX r_idx);
 
-extern void vault_prep_clone(void);
-extern void vault_prep_dragon(void);
-extern void vault_prep_symbol(void);
+extern void vault_prep_clone(player_type *player_ptr);
+extern void vault_prep_dragon(player_type *player_ptr);
+extern void vault_prep_symbol(player_type *player_ptr);
 
 extern bool vault_aux_lite(MONRACE_IDX r_idx);
 extern bool vault_aux_shards(MONRACE_IDX r_idx);
index cc3bf68..71524c3 100644 (file)
@@ -3516,7 +3516,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                }
 
                /* Hack -- Remove the monster restriction */
-               get_mon_num_prep(item_monster_okay, NULL);
+               get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
 
                /* Pick a random non-unique monster race */
                while (TRUE)
index 36ef485..ac5fb40 100644 (file)
@@ -5193,13 +5193,13 @@ void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
                GAME_TEXT m_name[MAX_NLEN];
                concptr desc;
 
-               get_mon_num_prep(get_nightmare, NULL);
+               get_mon_num_prep(creature_ptr, get_nightmare, NULL);
 
                r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
                power = r_ptr->level + 10;
                desc = r_name + r_ptr->name;
 
-               get_mon_num_prep(NULL, NULL);
+               get_mon_num_prep(creature_ptr, NULL, NULL);
 
 #ifdef JP
 #else
index def946b..77db2b5 100644 (file)
@@ -43,9 +43,9 @@ static concptr find_quest[] =
  * @param q_ptr クエスト構造体の参照ポインタ
  * @return なし
  */
-void determine_random_questor(quest_type *q_ptr)
+void determine_random_questor(player_type *player_ptr, quest_type *q_ptr)
 {
-       get_mon_num_prep(mon_hook_quest, NULL);
+       get_mon_num_prep(player_ptr, mon_hook_quest, NULL);
 
        MONRACE_IDX r_idx;
        while (TRUE)
index 5b90d64..8c13e88 100644 (file)
@@ -85,7 +85,7 @@ extern char quest_text[10][80];
 extern int quest_text_line;
 extern int leaving_quest;
 
-extern void determine_random_questor(quest_type *q_ptr);
+extern void determine_random_questor(player_type *player_ptr, quest_type *q_ptr);
 extern void complete_quest(player_type *player_ptr, QUEST_IDX quest_num);
 extern void check_quest_completion(player_type *player_ptr, monster_type *m_ptr);
 extern void check_find_art_quest_completion(player_type *player_ptr, object_type *o_ptr);
index 02743c1..4ed6b65 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;
 };
@@ -304,8 +304,8 @@ bool build_type5(player_type *player_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;
 
@@ -514,8 +514,8 @@ bool build_type6(player_type *player_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;
 
@@ -823,8 +823,8 @@ bool build_type13(player_type *player_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;
 
index 79b0d0d..693e120 100644 (file)
@@ -65,6 +65,7 @@ bool build_type15(player_type *player_ptr)
                place_outer_grid(g_ptr);
                g_ptr->feat = feat_glass_wall;
        }
+
        for (x = x1 - 1; x <= x2 + 1; x++)
        {
                g_ptr = &floor_ptr->grid_array[y1 - 1][x];
@@ -80,7 +81,7 @@ bool build_type15(player_type *player_ptr)
        case 1: /* 4 lite breathers + potion */
        {
                DIRECTION dir1, dir2;
-               get_mon_num_prep(vault_aux_lite, NULL);
+               get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
 
                /* Place fixed lite berathers */
                for (dir1 = 4; dir1 < 8; dir1++)
@@ -147,7 +148,7 @@ bool build_type15(player_type *player_ptr)
                g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
                place_inner_grid(g_ptr);
                g_ptr->feat = feat_glass_wall;
-               get_mon_num_prep(vault_aux_lite, NULL);
+               get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
 
                r_idx = get_mon_num(floor_ptr->dun_level);
                if (r_idx) place_monster_aux(player_ptr, 0, yval, xval, r_idx, 0L);
@@ -166,6 +167,7 @@ bool build_type15(player_type *player_ptr)
                        place_secret_door(player_ptr, y, xval - 2, DOOR_CURTAIN);
                        place_secret_door(player_ptr, y, xval + 2, DOOR_CURTAIN);
                }
+
                for (x = xval - 1; x <= xval + 1; x++)
                {
                        place_secret_door(player_ptr, yval - 2, x, DOOR_CURTAIN);
@@ -192,6 +194,7 @@ bool build_type15(player_type *player_ptr)
                        place_inner_grid(g_ptr);
                        g_ptr->feat = feat_glass_wall;
                }
+
                for (x = xval - 2; x <= xval + 2; x++)
                {
                        g_ptr = &floor_ptr->grid_array[yval - 3][x];
@@ -201,13 +204,15 @@ bool build_type15(player_type *player_ptr)
                        place_inner_grid(g_ptr);
                        g_ptr->feat = feat_glass_wall;
                }
+
                for (dir1 = 4; dir1 < 8; dir1++)
                {
                        g_ptr = &floor_ptr->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]];
                        place_inner_grid(g_ptr);
                        g_ptr->feat = feat_glass_wall;
                }
-               get_mon_num_prep(vault_aux_shards, NULL);
+
+               get_mon_num_prep(player_ptr, vault_aux_shards, NULL);
 
                /* Place shard berathers */
                for (dir1 = 4; dir1 < 8; dir1++)
index 2ed7760..0c4d6ee 100644 (file)
@@ -3346,7 +3346,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        }
                        else if (m_ptr->hp < randint0(nokori_hp))
                        {
-                               if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
+                               if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(caster_ptr, g_ptr->m_idx, FALSE, MON_CHAMELEON);
                                msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
                                cap_mon = m_ptr->r_idx;
                                cap_mspeed = m_ptr->mspeed;
index 22faffa..d3ed0d7 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(creature_ptr), NULL);
+       get_mon_num_prep(creature_ptr, get_monster_hook(creature_ptr), NULL);
 
        /* North border */
        generate_area(creature_ptr, y - 1, x, TRUE, FALSE);