From 3b87c7250e7a560a11398daa278da2018efaeff8 Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 27 Feb 2019 14:08:03 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38993=20m=5Flist=20=E3=81=A8=20max?= =?utf8?q?=5Fm=5Fidx=20=E3=82=92=20floor=5Ftype=20=E3=81=AB=E5=8F=96?= =?utf8?q?=E3=82=8A=E8=BE=BC=E3=82=80=E3=80=82=20/=20Move=20m=5Flist=20and?= =?utf8?q?=20max=5Fm=5Fidx=20to=20floor=5Ftype=20structure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/birth.c | 2 +- src/cmd-activate.c | 22 +++++------ src/cmd-pet.c | 30 +++++++-------- src/cmd2.c | 10 ++--- src/cmd4.c | 2 +- src/defines.h | 2 +- src/dungeon.c | 38 +++++++++--------- src/externs.h | 3 -- src/files.c | 6 +-- src/floor-events.c | 2 +- src/floor-generate.c | 8 ++-- src/floor-save.c | 22 +++++------ src/floor-streams.c | 2 +- src/gamevalue.h | 2 +- src/grid.c | 8 ++-- src/init1.c | 4 +- src/init2.c | 4 +- src/load.c | 12 +++--- src/mane.c | 2 +- src/melee1.c | 16 ++++---- src/mind.c | 2 +- src/monster-process.c | 56 +++++++++++++-------------- src/monster-status.c | 28 +++++++------- src/monster1.c | 2 +- src/monster2.c | 70 ++++++++++++++++----------------- src/mspells1.c | 16 ++++---- src/mspells2.c | 12 +++--- src/mspells3.c | 2 +- src/mspells4.c | 104 +++++++++++++++++++++++++------------------------- src/mutation.c | 2 +- src/object2.c | 12 +++--- src/player-move.c | 14 +++---- src/player-status.c | 6 +-- src/realm-hex.c | 6 +-- src/realm-hissatsu.c | 6 +-- src/save.c | 2 +- src/shoot.c | 6 +-- src/spells-status.c | 2 +- src/spells-summon.c | 4 +- src/spells1.c | 38 +++++++++--------- src/spells2.c | 50 ++++++++++++------------ src/spells3.c | 38 +++++++++--------- src/trap.c | 4 +- src/types.h | 6 ++- src/variable.c | 11 +----- src/view-mainwindow.c | 42 ++++++++++---------- src/wild.c | 2 +- src/wizard2.c | 4 +- src/xtra2.c | 24 ++++++------ 49 files changed, 380 insertions(+), 388 deletions(-) diff --git a/src/birth.c b/src/birth.c index 9777edb31..3aa2406f5 100644 --- a/src/birth.c +++ b/src/birth.c @@ -4548,7 +4548,7 @@ void player_birth(void) /* * Wipe monsters in old dungeon - * This wipe destroys value of m_list[].cur_num . + * This wipe destroys value of current_floor_ptr->m_list[].cur_num . */ wipe_m_list(); diff --git a/src/cmd-activate.c b/src/cmd-activate.c index 0ef37da34..e69cea226 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -308,8 +308,8 @@ static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b) int w1 = who[a]; int w2 = who[b]; - monster_type *m_ptr1 = &m_list[w1]; - monster_type *m_ptr2 = &m_list[w2]; + monster_type *m_ptr1 = ¤t_floor_ptr->m_list[w1]; + monster_type *m_ptr2 = ¤t_floor_ptr->m_list[w2]; monster_race *r_ptr1 = &r_info[m_ptr1->r_idx]; monster_race *r_ptr2 = &r_info[m_ptr2->r_idx]; @@ -463,12 +463,12 @@ void do_cmd_activate_aux(INVENTORY_IDX item) u16b dummy_why; /* Allocate the "who" array */ - C_MAKE(who, max_m_idx, MONSTER_IDX); + C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) { - if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr)) + if (is_pet(¤t_floor_ptr->m_list[pet_ctr]) && (p_ptr->riding != pet_ctr)) who[max_pet++] = pet_ctr; } @@ -486,7 +486,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item) } /* Free the "who" array */ - C_KILL(who, max_m_idx, IDX); + C_KILL(who, current_floor_ptr->max_m_idx, IDX); } o_ptr->timeout = 100 + randint1(100); return; @@ -557,10 +557,10 @@ void do_cmd_activate_aux(INVENTORY_IDX item) { if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE))) { - if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3; - if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5; - if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4; - m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp; + if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3; + if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5; + if (o_ptr->xtra4) current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4; + current_floor_ptr->m_list[hack_m_idx_ii].maxhp = current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp; if (o_ptr->inscription) { char buf[80]; @@ -602,7 +602,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item) s--; #endif *s = '\0'; - m_list[hack_m_idx_ii].nickname = quark_add(buf); + current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf); t = quark_str(o_ptr->inscription); s = buf; while(*t && (*t != '#')) @@ -1605,7 +1605,7 @@ bool activate_artifact(object_type *o_ptr) for (i = m_max - 1; i >= 1; i--) { /* Access the monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!m_ptr->r_idx) continue; diff --git a/src/cmd-pet.c b/src/cmd-pet.c index adcd0ad8e..46f6fbaa1 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -65,8 +65,8 @@ static bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b) int w1 = who[a]; int w2 = who[b]; - monster_type *m_ptr1 = &m_list[w1]; - monster_type *m_ptr2 = &m_list[w2]; + monster_type *m_ptr1 = ¤t_floor_ptr->m_list[w1]; + monster_type *m_ptr2 = ¤t_floor_ptr->m_list[w2]; monster_race *r_ptr1 = &r_info[m_ptr1->r_idx]; monster_race *r_ptr2 = &r_info[m_ptr2->r_idx]; @@ -114,7 +114,7 @@ int calculate_upkeep(void) monster_type *m_ptr; monster_race *r_ptr; - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; if (!m_ptr->r_idx) continue; r_ptr = &r_info[m_ptr->r_idx]; @@ -180,12 +180,12 @@ void do_cmd_pet_dismiss(void) Term->scr->cv = 1; /* Allocate the "who" array */ - C_MAKE(who, max_m_idx, MONSTER_IDX); + C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) { - if (is_pet(&m_list[pet_ctr])) + if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) who[max_pet++] = pet_ctr; } @@ -204,7 +204,7 @@ void do_cmd_pet_dismiss(void) /* Access the monster */ pet_ctr = who[i]; - m_ptr = &m_list[pet_ctr]; + m_ptr = ¤t_floor_ptr->m_list[pet_ctr]; delete_this = FALSE; kakunin = ((pet_ctr == p_ptr->riding) || (m_ptr->nickname)); @@ -286,7 +286,7 @@ void do_cmd_pet_dismiss(void) Term->scr->cv = cv; Term_fresh(); - C_KILL(who, max_m_idx, MONSTER_IDX); + C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX); #ifdef JP msg_format("%d 体のペットを放しました。", Dismissed); @@ -348,7 +348,7 @@ bool do_riding(bool force) { if (cmd_limit_confused(p_ptr)) return FALSE; - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; if (!g_ptr->m_idx || !m_ptr->ml) { @@ -444,7 +444,7 @@ static void do_name_pet(void) if (current_floor_ptr->grid_array[target_row][target_col].m_idx) { - m_ptr = &m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; if (!is_pet(m_ptr)) { @@ -532,10 +532,10 @@ void do_cmd_pet(void) #ifdef JP sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)", - (pet_t_m_idx ? (p_ptr->image ? "何か奇妙な物" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "指定なし")); + (pet_t_m_idx ? (p_ptr->image ? "何か奇妙な物" : (r_name + r_info[current_floor_ptr->m_list[pet_t_m_idx].ap_r_idx].name)) : "指定なし")); #else sprintf(target_buf, "specify a target of pet (now:%s)", - (pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[m_list[pet_t_m_idx].ap_r_idx].name)) : "nothing")); + (pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[current_floor_ptr->m_list[pet_t_m_idx].ap_r_idx].name)) : "nothing")); #endif power_desc[num] = target_buf; powers[num++] = PET_TARGET; @@ -859,7 +859,7 @@ void do_cmd_pet(void) for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) { /* Player has pet */ - if (is_pet(&m_list[pet_ctr])) break; + if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) break; } if (!pet_ctr) @@ -878,7 +878,7 @@ void do_cmd_pet(void) else { grid_type *g_ptr = ¤t_floor_ptr->grid_array[target_row][target_col]; - if (g_ptr->m_idx && (m_list[g_ptr->m_idx].ml)) + if (g_ptr->m_idx && (current_floor_ptr->m_list[g_ptr->m_idx].ml)) { pet_t_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; p_ptr->pet_follow_distance = PET_DESTROY_DIST; @@ -937,7 +937,7 @@ void do_cmd_pet(void) for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) { /* Access the monster */ - m_ptr = &m_list[pet_ctr]; + m_ptr = ¤t_floor_ptr->m_list[pet_ctr]; if (is_pet(m_ptr)) { @@ -1042,7 +1042,7 @@ bool rakuba(HIT_POINT dam, bool force) int i, y, x, oy, ox; int sn = 0, sy = 0, sx = 0; GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool fall_dam = FALSE; diff --git a/src/cmd2.c b/src/cmd2.c index fe2d5ab45..cc71a8501 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -2580,7 +2580,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) if (current_floor_ptr->grid_array[y][x].m_idx) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Check the visibility */ visible = m_ptr->ml; @@ -2713,17 +2713,17 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) if (potion_smash_effect(0, y, x, q_ptr->k_idx)) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; /* ToDo (Robert): fix the invulnerability */ if (current_floor_ptr->grid_array[y][x].m_idx && - is_friendly(&m_list[current_floor_ptr->grid_array[y][x].m_idx]) && + is_friendly(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]) && !MON_INVULNER(m_ptr)) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); + monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sは怒った!", "%^s gets angry!"), m_name); - set_hostile(&m_list[current_floor_ptr->grid_array[y][x].m_idx]); + set_hostile(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]); } } do_drop = FALSE; diff --git a/src/cmd4.c b/src/cmd4.c index f8b48e5aa..d6cd31c96 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5851,7 +5851,7 @@ static void do_cmd_knowledge_pets(void) for (i = m_max - 1; i >= 1; i--) { /* Access the monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!m_ptr->r_idx) continue; diff --git a/src/defines.h b/src/defines.h index 47756f2f3..3f40e680f 100644 --- a/src/defines.h +++ b/src/defines.h @@ -3246,7 +3246,7 @@ (bool)(((A)->smart & SM_FRIENDLY) ? TRUE : FALSE) #define is_friendly_idx(IDX) \ - (bool)((IDX) > 0 && is_friendly(&m_list[(IDX)])) + (bool)((IDX) > 0 && is_friendly(¤t_floor_ptr->m_list[(IDX)])) #define is_pet(A) \ (bool)(((A)->smart & SM_PET) ? TRUE : FALSE) diff --git a/src/dungeon.c b/src/dungeon.c index 57a0bdfd3..616a22b64 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -902,7 +902,7 @@ static void regen_monsters(void) for (i = 1; i < m_max; i++) { /* Check the i'th monster */ - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1675,27 +1675,27 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->riding) { HIT_POINT damage; - if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire) + if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire) { - damage = r_info[m_list[p_ptr->riding].r_idx].level / 2; + damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2; if (prace_is_(RACE_ENT)) damage += damage / 3; if (p_ptr->resist_fire) damage = damage / 3; if (IS_OPPOSE_FIRE()) damage = damage / 3; msg_print(_("熱い!", "It's hot!")); take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1); } - if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec) + if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec) { - damage = r_info[m_list[p_ptr->riding].r_idx].level / 2; + damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2; if (prace_is_(RACE_ANDROID)) damage += damage / 3; if (p_ptr->resist_elec) damage = damage / 3; if (IS_OPPOSE_ELEC()) damage = damage / 3; msg_print(_("痛い!", "It hurts!")); take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1); } - if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold) + if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold) { - damage = r_info[m_list[p_ptr->riding].r_idx].level / 2; + damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2; if (p_ptr->resist_cold) damage = damage / 3; if (IS_OPPOSE_COLD()) damage = damage / 3; msg_print(_("冷たい!", "It's cold!")); @@ -2527,7 +2527,7 @@ static void process_world_aux_mutation(void) for (monster = 0; monster < m_max; monster++) { - monster_type *m_ptr = &m_list[monster]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[monster]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Paranoia -- Skip dead monsters */ @@ -3149,7 +3149,7 @@ static void process_world_aux_movement(void) */ static int get_monster_crowd_number(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; POSITION my = m_ptr->fy; POSITION mx = m_ptr->fx; int i; @@ -3193,7 +3193,7 @@ static byte get_dungeon_feeling(void) /* Examine each monster */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr; int delta = 0; @@ -3430,7 +3430,7 @@ static void process_world(void) GAME_TEXT m_name[MAX_NLEN]; monster_type *wm_ptr; - wm_ptr = &m_list[win_m_idx]; + wm_ptr = ¤t_floor_ptr->m_list[win_m_idx]; monster_desc(m_name, wm_ptr, 0); msg_format(_("%sが勝利した!", "%s is winner!"), m_name); @@ -4746,7 +4746,7 @@ static void process_player(void) { for(i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; @@ -4818,7 +4818,7 @@ static void process_player(void) if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE)) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); + monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sが釣れた!", "You have a good catch!"), m_name); success = TRUE; } @@ -4855,7 +4855,7 @@ static void process_player(void) if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CSLEEP(m_ptr)) @@ -5115,7 +5115,7 @@ static void process_player(void) monster_race *r_ptr; /* Access monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -5151,7 +5151,7 @@ static void process_player(void) monster_type *m_ptr; /* Access monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -5439,7 +5439,7 @@ static void dungeon(bool load_game) while (TRUE) { /* Hack -- Compact the monster list occasionally */ - if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64); + if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64); /* Hack -- Compress the monster list occasionally */ if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0); @@ -5942,7 +5942,7 @@ void play_game(bool new_game) p_ptr->riding = 0; for (i = m_max; i > 0; i--) { - if (player_bold(m_list[i].fy, m_list[i].fx)) + if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx)) { p_ptr->riding = i; break; @@ -6103,7 +6103,7 @@ void play_game(bool new_game) monster_race *r_ptr = &r_info[pet_r_idx]; place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx, (PM_FORCE_PET | PM_NO_KAGE)); - m_ptr = &m_list[hack_m_idx_ii]; + m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii]; m_ptr->mspeed = r_ptr->speed; m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2; m_ptr->max_maxhp = m_ptr->maxhp; diff --git a/src/externs.h b/src/externs.h index 28b960274..ed5a76e80 100644 --- a/src/externs.h +++ b/src/externs.h @@ -261,8 +261,6 @@ extern floor_type *current_floor_ptr; extern saved_floor_type saved_floors[MAX_SAVED_FLOORS]; extern FLOOR_IDX max_floor_id; extern u32b saved_floor_file_sign; -extern object_type *o_list; -extern monster_type *m_list; extern s16b *mproc_list[MAX_MTIMED]; extern s16b mproc_max[MAX_MTIMED]; extern TOWN_IDX max_towns; @@ -340,7 +338,6 @@ extern FEAT_IDX max_f_idx; extern ARTIFACT_IDX max_a_idx; extern EGO_IDX max_e_idx; extern DUNGEON_IDX max_d_idx; -extern MONSTER_IDX max_m_idx; extern POSITION max_wild_x; extern POSITION max_wild_y; extern quest_type *quest; diff --git a/src/files.c b/src/files.c index c098b824f..f80b92784 100644 --- a/src/files.c +++ b/src/files.c @@ -1820,8 +1820,8 @@ static void display_player_middle(void) } else { - if (MON_FAST(&m_list[p_ptr->riding])) tmp_speed += 10; - if (MON_SLOW(&m_list[p_ptr->riding])) tmp_speed -= 10; + if (MON_FAST(¤t_floor_ptr->m_list[p_ptr->riding])) tmp_speed += 10; + if (MON_SLOW(¤t_floor_ptr->m_list[p_ptr->riding])) tmp_speed -= 10; } if (tmp_speed) @@ -4187,7 +4187,7 @@ static void dump_aux_pet(FILE *fff) for (i = m_max - 1; i >= 1; i--) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; if (!is_pet(m_ptr)) continue; diff --git a/src/floor-events.c b/src/floor-events.c index 104362fd8..e3f8bd66a 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -103,7 +103,7 @@ MONSTER_NUMBER count_all_hostile_monsters(void) { MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - if (m_idx > 0 && is_hostile(&m_list[m_idx])) + if (m_idx > 0 && is_hostile(¤t_floor_ptr->m_list[m_idx])) { ++number_mon; } diff --git a/src/floor-generate.c b/src/floor-generate.c index daae1e71c..76c895ecd 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -1164,11 +1164,11 @@ static void generate_gambling_arena(void) for(i = 0; i < 4; i++) { place_monster_aux(0, p_ptr->y + 8 + (i/2)*4, p_ptr->x - 2 + (i%2)*4, battle_mon[i], (PM_NO_KAGE | PM_NO_PET)); - set_friendly(&m_list[current_floor_ptr->grid_array[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]); + set_friendly(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]); } for(i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; @@ -1320,7 +1320,7 @@ void clear_cave(void) /* Very simplified version of wipe_m_list() */ for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0; - (void)C_WIPE(m_list, m_max, monster_type); + (void)C_WIPE(current_floor_ptr->m_list, m_max, monster_type); m_max = 1; m_cnt = 0; for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0; @@ -1424,7 +1424,7 @@ void generate_random_floor(void) okay = FALSE; } /* Prevent monster over-flow */ - else if (m_max >= max_m_idx) + else if (m_max >= current_floor_ptr->max_m_idx) { why = _("モンスターが多すぎる", "too many monsters"); okay = FALSE; diff --git a/src/floor-save.c b/src/floor-save.c index cf886a62d..2a538baf7 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -367,7 +367,7 @@ static void preserve_pet(void) if (p_ptr->riding) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; /* Pet of other pet don't follow. */ if (m_ptr->parent_m_idx) @@ -394,7 +394,7 @@ static void preserve_pet(void) { for (i = m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; if (!is_pet(m_ptr)) continue; @@ -430,7 +430,7 @@ static void preserve_pet(void) } } - (void)COPY(&party_mon[num], &m_list[i], monster_type); + (void)COPY(&party_mon[num], ¤t_floor_ptr->m_list[i], monster_type); num++; @@ -443,7 +443,7 @@ static void preserve_pet(void) { for (i = m_max - 1; i >=1; i--) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; GAME_TEXT m_name[MAX_NLEN]; if (!m_ptr->r_idx) continue; @@ -460,10 +460,10 @@ static void preserve_pet(void) /* Pet of other pet may disappear. */ for (i = m_max - 1; i >=1; i--) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Are there its parent? */ - if (m_ptr->parent_m_idx && !m_list[m_ptr->parent_m_idx].r_idx) + if (m_ptr->parent_m_idx && !current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) { /* Its parent have gone, it also goes away. */ @@ -549,7 +549,7 @@ static void place_pet(void) if (m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr; current_floor_ptr->grid_array[cy][cx].m_idx = m_idx; @@ -634,7 +634,7 @@ static void update_unique_artifact(s16b cur_floor_id) for (i = 1; i < m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -717,7 +717,7 @@ static void get_out_monster(void) /*** It's a good place ***/ - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Update the old location */ current_floor_ptr->grid_array[oy][ox].m_idx = 0; @@ -891,7 +891,7 @@ void leave_floor(void) for (i = 1; i < m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -1201,7 +1201,7 @@ void change_floor(void) for (i = 1; i < m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; diff --git a/src/floor-streams.c b/src/floor-streams.c index 2642103f3..a53a0456a 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -281,7 +281,7 @@ void build_streamer(IDX feat, int chance) if (is_closed_door(g_ptr->feat)) continue; } - if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[m_list[g_ptr->m_idx].r_idx], 0))) + if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[current_floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) { /* Delete the monster (if any) */ delete_monster(ty, tx); diff --git a/src/gamevalue.h b/src/gamevalue.h index aa35032a2..292631d09 100644 --- a/src/gamevalue.h +++ b/src/gamevalue.h @@ -44,7 +44,7 @@ * @details * A monster can only "multiply" (reproduce) if there are fewer than 100 * monsters on the level capable of such spontaneous reproduction. This -* is a hack which prevents the "m_list[]" array from exploding due to +* is a hack which prevents the "current_floor_ptr->m_list[]" array from exploding due to * reproducing monsters. Messy, but necessary. */ #define MAX_REPRO 100 diff --git a/src/grid.c b/src/grid.c index bf980ce60..f43ec82f5 100644 --- a/src/grid.c +++ b/src/grid.c @@ -1989,7 +1989,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO /* Handle monsters */ if (g_ptr->m_idx && display_autopick == 0) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) @@ -2501,7 +2501,7 @@ void prt_path(POSITION y, POSITION x) TERM_COLOR ta = default_color; char tc = '*'; - if (g_ptr->m_idx && m_list[g_ptr->m_idx].ml) + if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml) { /* Determine what is there */ map_info(ny, nx, &a, &c, &ta, &tc); @@ -3737,7 +3737,7 @@ void update_mon_lite(void) /* Loop through monsters, adding newly lit squares to changes list */ for (i = 1; i < m_max; i++) { - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -5636,7 +5636,7 @@ void glow_deep_lava_and_bldg(void) */ bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; diff --git a/src/init1.c b/src/init1.c index 96b75cd44..08bcfbdf5 100644 --- a/src/init1.c +++ b/src/init1.c @@ -4047,7 +4047,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in if (clone) { /* clone */ - m_list[hack_m_idx_ii].smart |= SM_CLONED; + current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; /* Make alive again for real unique monster */ r_info[monster_index].cur_num = old_cur_num; @@ -4383,7 +4383,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Maximum m_idx */ else if (zz[0][0] == 'M') { - max_m_idx = (IDX)atoi(zz[1]); + current_floor_ptr->max_m_idx = (IDX)atoi(zz[1]); } /* Wilderness size */ diff --git a/src/init2.c b/src/init2.c index 2325fbabc..9200b56c5 100644 --- a/src/init2.c +++ b/src/init2.c @@ -1224,12 +1224,12 @@ static errr init_other(void) C_MAKE(current_floor_ptr->o_list, current_floor_ptr->max_o_idx, object_type); /* Allocate and Wipe the monster list */ - C_MAKE(m_list, max_m_idx, monster_type); + C_MAKE(current_floor_ptr->m_list, current_floor_ptr->max_m_idx, monster_type); /* Allocate and Wipe the monster process list */ for (i = 0; i < MAX_MTIMED; i++) { - C_MAKE(mproc_list[i], max_m_idx, s16b); + C_MAKE(mproc_list[i], current_floor_ptr->max_m_idx, s16b); } /* Allocate and Wipe the max dungeon level */ diff --git a/src/load.c b/src/load.c index 1d561e01c..6424fa78e 100644 --- a/src/load.c +++ b/src/load.c @@ -2874,7 +2874,7 @@ static errr rd_dungeon_old(void) monster_type *m_ptr; /* Monster */ - m_ptr = &m_list[o_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; /* Build a stack */ o_ptr->next_o_idx = m_ptr->hold_o_idx; @@ -2904,7 +2904,7 @@ static errr rd_dungeon_old(void) rd_u16b(&limit); /* Hack -- verify */ - if (limit > max_m_idx) + if (limit > current_floor_ptr->max_m_idx) { note(format(_("モンスターの配列が大きすぎる(%d)!", "Too many (%d) monster entries!"), limit)); return (161); @@ -2927,7 +2927,7 @@ static errr rd_dungeon_old(void) /* Acquire monster */ - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Read the monster */ rd_monster(m_ptr); @@ -3192,7 +3192,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) monster_type *m_ptr; /* Monster */ - m_ptr = &m_list[o_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; /* Build a stack */ o_ptr->next_o_idx = m_ptr->hold_o_idx; @@ -3222,7 +3222,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) rd_u16b(&limit); /* Hack -- verify */ - if (limit > max_m_idx) return 161; + if (limit > current_floor_ptr->max_m_idx) return 161; /* Read the monsters */ for (i = 1; i < limit; i++) @@ -3238,7 +3238,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) /* Acquire monster */ - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Read the monster */ rd_monster(m_ptr); diff --git a/src/mane.c b/src/mane.c index 2fcdcc746..8823dc402 100644 --- a/src/mane.c +++ b/src/mane.c @@ -677,7 +677,7 @@ static bool use_mane(int spell) if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; - m_ptr = &m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) diff --git a/src/melee1.c b/src/melee1.c index 95a52b195..36a0bf937 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -301,7 +301,7 @@ static void natural_attack(MONSTER_IDX m_idx, int attack, bool *fear, bool *mdea HIT_POINT k; int bonus, chance; WEIGHT n_weight = 0; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -438,7 +438,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Access the weapon */ @@ -1152,7 +1152,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b } /* Hack -- Get new monster */ - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Oops, we need a different name... */ monster_desc(m_name, m_ptr, 0); @@ -1163,7 +1163,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b } else if (o_ptr->name1 == ART_G_HAMMER) { - monster_type *target_ptr = &m_list[g_ptr->m_idx]; + monster_type *target_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; if (target_ptr->hold_o_idx) { @@ -1327,7 +1327,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode) bool stormbringer = FALSE; grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -1448,7 +1448,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode) if (cur < max) { - DEPTH ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level; + DEPTH ridinglevel = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level; DEPTH targetlevel = r_ptr->level; int inc = 0; @@ -1511,7 +1511,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode) */ bool make_attack_normal(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int ap_cnt; @@ -3203,7 +3203,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) if (p_ptr->riding && damage) { char m_steed_name[MAX_NLEN]; - monster_desc(m_steed_name, &m_list[p_ptr->riding], 0); + monster_desc(m_steed_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0); if (rakuba((damage > 200) ? 200 : damage, FALSE)) { msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name); diff --git a/src/mind.c b/src/mind.c index f27470b0a..b3c64eb28 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1638,7 +1638,7 @@ static bool cast_ninja_spell(int spell) if (m_idx == p_ptr->riding) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sを引き戻した。", "You pull back %s."), m_name); path_n = project_path(path_g, MAX_RANGE, target_row, target_col, p_ptr->y, p_ptr->x, 0); diff --git a/src/monster-process.c b/src/monster-process.c index 3b8bc1aa4..125c5b889 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -42,19 +42,19 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) int start; int plus = 1; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_type *t_ptr; if (riding_t_m_idx && player_bold(m_ptr->fy, m_ptr->fx)) { - y = m_list[riding_t_m_idx].fy; - x = m_list[riding_t_m_idx].fx; + y = current_floor_ptr->m_list[riding_t_m_idx].fy; + x = current_floor_ptr->m_list[riding_t_m_idx].fx; } else if (is_pet(m_ptr) && pet_t_m_idx) { - y = m_list[pet_t_m_idx].fy; - x = m_list[pet_t_m_idx].fx; + y = current_floor_ptr->m_list[pet_t_m_idx].fy; + x = current_floor_ptr->m_list[pet_t_m_idx].fx; } else { @@ -73,7 +73,7 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) if (!dummy) continue; t_idx = dummy; - t_ptr = &m_list[t_idx]; + t_ptr = ¤t_floor_ptr->m_list[t_idx]; /* The monster itself isn't a target */ if (t_ptr == m_ptr) continue; @@ -203,7 +203,7 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) */ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, concptr note, IDX who) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[160]; bool seen = is_seen(m_ptr); @@ -356,9 +356,9 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr) && (who != m_idx)) { - if (is_pet(&m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x)) + if (is_pet(¤t_floor_ptr->m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x)) { - set_target(m_ptr, m_list[who].fy, m_list[who].fx); + set_target(m_ptr, current_floor_ptr->m_list[who].fy, current_floor_ptr->m_list[who].fx); } } @@ -397,7 +397,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, */ static bool mon_will_run(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; #ifdef ALLOW_TERROR @@ -479,7 +479,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) bool can_open_door = FALSE; int now_cost; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Monster location */ @@ -583,7 +583,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no grid_type *g_ptr; bool use_scent = FALSE; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Can monster cast attack spell? */ @@ -700,7 +700,7 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) int score = -1; int i; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Monster location */ fy = m_ptr->fy; @@ -887,7 +887,7 @@ static POSITION *dist_offsets_x[10] = */ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; POSITION fy = m_ptr->fy; POSITION fx = m_ptr->fx; @@ -981,7 +981,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) */ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; POSITION fy = m_ptr->fy; @@ -1055,7 +1055,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) */ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; POSITION y = 0, ay, x = 0, ax; int move_val = 0; @@ -1074,7 +1074,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) /* The monster must be an enemy, and in LOS */ if (t_m_idx && - are_enemies(m_ptr, &m_list[t_m_idx]) && + are_enemies(m_ptr, ¤t_floor_ptr->m_list[t_m_idx]) && los(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x) && projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x)) { @@ -1424,8 +1424,8 @@ static int check_hit2(int power, DEPTH level, ARMOUR_CLASS ac, int stun) */ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *m_ptr = &m_list[m_idx]; - monster_type *t_ptr = &m_list[t_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; @@ -2078,7 +2078,7 @@ static bool check_hp_for_feat_destruction(feature_type *f_ptr, monster_type *m_p */ void process_monster(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; @@ -2120,7 +2120,7 @@ void process_monster(MONSTER_IDX m_idx) msg_print("地面に落とされた。"); #else GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[p_ptr->riding], 0); + monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0); msg_format("You have fallen from %s.", m_name); #endif } @@ -2144,7 +2144,7 @@ void process_monster(MONSTER_IDX m_idx) } /* Are there its parent? */ - if (m_ptr->parent_m_idx && !m_list[m_ptr->parent_m_idx].r_idx) + if (m_ptr->parent_m_idx && !current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) { /* Its parent have gone, it also goes away. */ @@ -2358,7 +2358,7 @@ void process_monster(MONSTER_IDX m_idx) if (multiply_monster(m_idx, FALSE, (is_pet(m_ptr) ? PM_FORCE_PET : 0))) { /* Take note if visible */ - if (m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(m_ptr)) + if (current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags2 |= (RF2_MULTIPLY); } @@ -2386,7 +2386,7 @@ void process_monster(MONSTER_IDX m_idx) { if (summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode), '\0')) { - if (m_list[hack_m_idx_ii].ml) count++; + if (current_floor_ptr->m_list[hack_m_idx_ii].ml) count++; } } @@ -2452,7 +2452,7 @@ void process_monster(MONSTER_IDX m_idx) MONSTER_IDX t_m_idx = current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; /* The monster must be an enemy, and projectable */ - if (t_m_idx && are_enemies(m_ptr, &m_list[t_m_idx]) && + if (t_m_idx && are_enemies(m_ptr, ¤t_floor_ptr->m_list[t_m_idx]) && projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x)) { counterattack = TRUE; @@ -2628,7 +2628,7 @@ void process_monster(MONSTER_IDX m_idx) can_cross = monster_can_cross_terrain(g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0); /* Access that grid's contents */ - y_ptr = &m_list[g_ptr->m_idx]; + y_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- player 'in' wall */ if (player_bold(ny, nx)) @@ -2942,7 +2942,7 @@ void process_monster(MONSTER_IDX m_idx) if (is_riding_mon) { - if (!p_ptr->riding_ryoute && !MON_MONFEAR(&m_list[p_ptr->riding])) do_move = FALSE; + if (!p_ptr->riding_ryoute && !MON_MONFEAR(¤t_floor_ptr->m_list[p_ptr->riding])) do_move = FALSE; } if (did_kill_wall && do_move) @@ -3370,7 +3370,7 @@ void process_monsters(void) for (i = m_max - 1; i >= 1; i--) { /* Access the monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; r_ptr = &r_info[m_ptr->r_idx]; /* Handle "leaving" */ diff --git a/src/monster-status.c b/src/monster-status.c index 6c154cfe1..5a3cff4eb 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -165,7 +165,7 @@ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type) */ static void mproc_add(MONSTER_IDX m_idx, int mproc_type) { - if (mproc_max[mproc_type] < max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx; + if (mproc_max[mproc_type] < current_floor_ptr->max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx; } @@ -199,7 +199,7 @@ void mproc_init(void) for (i = m_max - 1; i >= 1; i--) { /* Access the monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!m_ptr->r_idx) continue; @@ -221,7 +221,7 @@ void mproc_init(void) */ bool set_monster_csleep(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; @@ -272,7 +272,7 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v) */ bool set_monster_fast(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -312,7 +312,7 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v) */ bool set_monster_slow(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -356,7 +356,7 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v) */ bool set_monster_stunned(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -396,7 +396,7 @@ bool set_monster_stunned(MONSTER_IDX m_idx, int v) */ bool set_monster_confused(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -436,7 +436,7 @@ bool set_monster_confused(MONSTER_IDX m_idx, int v) */ bool set_monster_monfear(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -486,7 +486,7 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v) */ bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -537,7 +537,7 @@ static u32b csleep_noise; */ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; switch (mtimed_idx) { @@ -748,7 +748,7 @@ void process_monsters_mtimed(int mtimed_idx) */ void dispel_monster_status(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); @@ -775,7 +775,7 @@ void dispel_monster_status(MONSTER_IDX m_idx) */ bool process_the_world(int num, MONSTER_IDX who, bool vs_player) { - monster_type *m_ptr = &m_list[hack_m_idx]; /* the world monster */ + monster_type *m_ptr = ¤t_floor_ptr->m_list[hack_m_idx]; /* the world monster */ if (world_monster) return (FALSE); @@ -839,7 +839,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, IDX s_idx) /* Paranoia */ if (m_idx <= 0 || s_idx <= 0) return; - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) return; @@ -973,7 +973,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, IDX s_idx) */ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_type exp_mon; diff --git a/src/monster1.c b/src/monster1.c index d92c270fd..3edc18976 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -2531,7 +2531,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) int dump_gold = 0; int number = 0; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE)); diff --git a/src/monster2.c b/src/monster2.c index b9362ca6b..e34d39ae6 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -235,7 +235,7 @@ MONRACE_IDX real_r_idx(monster_type *m_ptr) void delete_monster_idx(MONSTER_IDX i) { POSITION x, y; - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -343,7 +343,7 @@ static void compact_monsters_aux(IDX i1, IDX i2) if (i1 == i2) return; /* Old monster */ - m_ptr = &m_list[i1]; + m_ptr = ¤t_floor_ptr->m_list[i1]; y = m_ptr->fy; x = m_ptr->fx; @@ -385,7 +385,7 @@ static void compact_monsters_aux(IDX i1, IDX i2) { for (i = 1; i < m_max; i++) { - monster_type *m2_ptr = &m_list[i]; + monster_type *m2_ptr = ¤t_floor_ptr->m_list[i]; if (m2_ptr->parent_m_idx == i1) m2_ptr->parent_m_idx = i2; @@ -393,10 +393,10 @@ static void compact_monsters_aux(IDX i1, IDX i2) } /* Structure copy */ - (void)COPY(&m_list[i2], &m_list[i1], monster_type); + (void)COPY(¤t_floor_ptr->m_list[i2], ¤t_floor_ptr->m_list[i1], monster_type); /* Wipe the hole */ - (void)WIPE(&m_list[i1], monster_type); + (void)WIPE(¤t_floor_ptr->m_list[i1], monster_type); for (i = 0; i < MAX_MTIMED; i++) { @@ -442,7 +442,7 @@ void compact_monsters(int size) /* Check all the monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -488,7 +488,7 @@ void compact_monsters(int size) for (i = m_max - 1; i >= 1; i--) { /* Get the i'th monster */ - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip real monsters */ if (m_ptr->r_idx) continue; @@ -535,7 +535,7 @@ void wipe_m_list(void) /* Delete all the monsters */ for (i = m_max - 1; i >= 1; i--) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -590,7 +590,7 @@ MONSTER_IDX m_pop(void) MONSTER_IDX i; /* Normal allocation */ - if (m_max < max_m_idx) + if (m_max < current_floor_ptr->max_m_idx) { /* Access the next hole */ i = m_max; @@ -611,7 +611,7 @@ MONSTER_IDX m_pop(void) monster_type *m_ptr; /* Acquire monster */ - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip live monsters */ if (m_ptr->r_idx) continue; @@ -1663,7 +1663,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode) /* Inside monster arena, and it is not your mount */ else if (p_ptr->inside_battle && - !(p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr))) + !(p_ptr->riding && (¤t_floor_ptr->m_list[p_ptr->riding] == m_ptr))) { /* It is a fake unique monster */ (void)sprintf(desc, _("%sもどき", "fake %s"), name); @@ -1708,7 +1708,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode) strcat(desc,buf); } - if (p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr)) + if (p_ptr->riding && (¤t_floor_ptr->m_list[p_ptr->riding] == m_ptr)) { strcat(desc,_("(乗馬中)", "(riding)")); } @@ -1869,7 +1869,7 @@ int lore_do_probe(MONRACE_IDX r_idx) */ void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -2234,7 +2234,7 @@ void sanity_blast(monster_type *m_ptr, bool necro) */ void update_monster(MONSTER_IDX m_idx, bool full) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -2630,7 +2630,7 @@ void update_monsters(bool full) /* Update each (live) monster */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -2647,7 +2647,7 @@ void update_monsters(bool full) static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - monster_type *m_ptr = &m_list[chameleon_change_m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[chameleon_change_m_idx]; monster_race *old_r_ptr = &r_info[m_ptr->r_idx]; if (!(r_ptr->flags1 & (RF1_UNIQUE))) return FALSE; @@ -2669,7 +2669,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) /* Born now */ else if (summon_specific_who > 0) { - if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; + if (monster_has_hostile_align(¤t_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return TRUE; @@ -2683,7 +2683,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) static bool monster_hook_chameleon(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - monster_type *m_ptr = &m_list[chameleon_change_m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[chameleon_change_m_idx]; monster_race *old_r_ptr = &r_info[m_ptr->r_idx]; if (r_ptr->flags1 & (RF1_UNIQUE)) return FALSE; @@ -2706,7 +2706,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) /* Born now */ else if (summon_specific_who > 0) { - if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; + if (monster_has_hostile_align(¤t_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return (*(get_monster_hook()))(r_idx); @@ -2722,7 +2722,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) { int oldmaxhp; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr; char old_m_name[MAX_NLEN]; bool old_unique = FALSE; @@ -3005,7 +3005,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I for (i2 = 0; i2 < current_floor_ptr->width; ++i2) for (j2 = 0; j2 < current_floor_ptr->height; j2++) if (current_floor_ptr->grid_array[j2][i2].m_idx > 0) - if (m_list[current_floor_ptr->grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx) + if (current_floor_ptr->m_list[current_floor_ptr->grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx) number_mon++; if(number_mon + quest[hoge].cur_num >= quest[hoge].max_num) return FALSE; @@ -3048,7 +3048,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* Get a new monster record */ - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Save the race */ m_ptr->r_idx = r_idx; @@ -3059,17 +3059,17 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I m_ptr->mflag2 = 0; /* Hack -- Appearance transfer */ - if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&m_list[who])) + if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(¤t_floor_ptr->m_list[who])) { - m_ptr->ap_r_idx = m_list[who].ap_r_idx; + m_ptr->ap_r_idx = current_floor_ptr->m_list[who].ap_r_idx; /* Hack -- Shadower spawns Shadower */ - if (m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE; + if (current_floor_ptr->m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE; } /* Sub-alignment of a monster */ if ((who > 0) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD))) - m_ptr->sub_align = m_list[who].sub_align; + m_ptr->sub_align = current_floor_ptr->m_list[who].sub_align; else { m_ptr->sub_align = SUB_ALIGN_NEUTRAL; @@ -3096,7 +3096,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* Your pet summons its pet. */ - if (who > 0 && is_pet(&m_list[who])) + if (who > 0 && is_pet(¤t_floor_ptr->m_list[who])) { mode |= PM_FORCE_PET; m_ptr->parent_m_idx = who; @@ -3503,7 +3503,7 @@ static MONSTER_IDX place_monster_m_idx = 0; static bool place_monster_can_escort(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[place_monster_idx]; - monster_type *m_ptr = &m_list[place_monster_m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[place_monster_m_idx]; monster_race *z_ptr = &r_info[r_idx]; @@ -3708,7 +3708,7 @@ bool alloc_horde(POSITION y, POSITION x) m_idx = current_floor_ptr->grid_array[y][x].m_idx; - if (m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx]; + if (current_floor_ptr->m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[current_floor_ptr->m_list[m_idx].r_idx]; for (attempts = randint1(10) + 5; attempts; attempts--) { @@ -3846,7 +3846,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx) /* Hack -- identify the summoning monster */ if (summon_specific_who > 0) { - monster_type *m_ptr = &m_list[summon_specific_who]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[summon_specific_who]; /* Do not summon enemies */ @@ -3995,7 +3995,7 @@ bool summon_named_creature(MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_ID */ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; POSITION y, x; if (!mon_scatter(m_ptr->r_idx, &y, &x, m_ptr->fy, m_ptr->fx, 1)) @@ -4010,8 +4010,8 @@ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode) /* Hack -- Transfer "clone" flag */ if (clone || (m_ptr->smart & SM_CLONED)) { - m_list[hack_m_idx_ii].smart |= SM_CLONED; - m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET; + current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; + current_floor_ptr->m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET; } return TRUE; @@ -4033,7 +4033,7 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam) HIT_POINT tmp; PERCENTAGE percentage; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -4357,7 +4357,7 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam) */ void update_smart_learn(MONSTER_IDX m_idx, int what) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Not allowed to learn */ diff --git a/src/mspells1.c b/src/mspells1.c index cb621d636..878354d7c 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -73,7 +73,7 @@ static bool int_outof(monster_race *r_ptr, PERCENTAGE prob) */ static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; u32b f4 = (*f4p); @@ -485,7 +485,7 @@ bool clean_shot(POSITION y1, POSITION x1, POSITION y2, POSITION x2, bool is_frie if ((current_floor_ptr->grid_array[y][x].m_idx > 0) && !((y == y2) && (x == x2))) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; if (is_friend == is_pet(m_ptr)) { return (FALSE); @@ -580,7 +580,7 @@ void beam(MONSTER_IDX m_idx, POSITION y, POSITION x, EFFECT_ID typ, int dam_hp, */ void breath(POSITION y, POSITION x, MONSTER_IDX m_idx, EFFECT_ID typ, int dam_hp, POSITION rad, bool breath, int monspell, int target_type) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool learnable = spell_learnable(m_idx); BIT_FLAGS flg = 0x00; @@ -861,7 +861,7 @@ static bool spell_dispel(byte spell) */ bool dispel_check(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Invulnabilty (including the song) */ @@ -947,9 +947,9 @@ bool dispel_check(MONSTER_IDX m_idx) /* Light speed */ if (p_ptr->lightspeed && (m_ptr->mspeed < 136)) return (TRUE); - if (p_ptr->riding && (m_list[p_ptr->riding].mspeed < 135)) + if (p_ptr->riding && (current_floor_ptr->m_list[p_ptr->riding].mspeed < 135)) { - if (MON_FAST(&m_list[p_ptr->riding])) return (TRUE); + if (MON_FAST(¤t_floor_ptr->m_list[p_ptr->riding])) return (TRUE); } /* No need to cast dispel spell */ @@ -978,7 +978,7 @@ bool dispel_check(MONSTER_IDX m_idx) */ static int choose_attack_spell(MONSTER_IDX m_idx, byte spells[], byte num) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; byte escape[96], escape_num = 0; @@ -1347,7 +1347,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) PERCENTAGE failrate; byte spell[96], num = 0; BIT_FLAGS f4, f5, f6; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; #ifndef JP diff --git a/src/mspells2.c b/src/mspells2.c index 146d739bc..c5a68904f 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -51,7 +51,7 @@ static bool direct_beam(POSITION y1, POSITION x1, POSITION y2, POSITION x2, mons if (y == y2 && x == x2) hit2 = TRUE; else if (is_friend && current_floor_ptr->grid_array[y][x].m_idx > 0 && - !are_enemies(m_ptr, &m_list[current_floor_ptr->grid_array[y][x].m_idx])) + !are_enemies(m_ptr, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx])) { /* Friends don't shoot friends */ return FALSE; @@ -228,7 +228,7 @@ void get_project_point(POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT */ static bool dispel_check_monster(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; /* Invulnabilty */ if (MON_INVULNER(t_ptr)) return TRUE; @@ -276,7 +276,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) char m_poss[160]; #endif - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_type *t_ptr = NULL; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -305,7 +305,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (pet_t_m_idx && pet) { target_idx = pet_t_m_idx; - t_ptr = &m_list[target_idx]; + t_ptr = ¤t_floor_ptr->m_list[target_idx]; /* Cancel if not projectable (for now) */ if ((m_idx == target_idx) || !projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) @@ -321,7 +321,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (target_idx) { - t_ptr = &m_list[target_idx]; + t_ptr = ¤t_floor_ptr->m_list[target_idx]; /* Cancel if neither enemy nor a given target */ if ((m_idx == target_idx) || @@ -359,7 +359,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (!dummy) continue; target_idx = dummy; - t_ptr = &m_list[target_idx]; + t_ptr = ¤t_floor_ptr->m_list[target_idx]; /* Skip dead monsters */ if (!t_ptr->r_idx) continue; diff --git a/src/mspells3.c b/src/mspells3.c index 21514d4cd..e14dcde29 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -1054,7 +1054,7 @@ static bool cast_learned_spell(int spell, bool success) if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; - m_ptr = &m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) diff --git a/src/mspells4.c b/src/mspells4.c index 57bef5ec6..72dfccc8a 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -20,7 +20,7 @@ */ void monster_name(MONSTER_IDX m_idx, char* m_name) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_desc(m_name, m_ptr, 0x00); } @@ -32,8 +32,8 @@ void monster_name(MONSTER_IDX m_idx, char* m_name) */ bool monster_near_player(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *m_ptr = &m_list[m_idx]; - monster_type *t_ptr = &m_list[t_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; return (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT); } @@ -44,7 +44,7 @@ bool monster_near_player(MONSTER_IDX m_idx, MONSTER_IDX t_idx) */ bool see_monster(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; return is_seen(m_ptr); } @@ -55,7 +55,7 @@ bool see_monster(MONSTER_IDX m_idx) */ bool spell_learnable(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Extract the "see-able-ness" */ bool seen = (!p_ptr->blind && m_ptr->ml); @@ -70,7 +70,7 @@ bool spell_learnable(MONSTER_IDX m_idx) */ int monster_level_idx(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); return rlev; @@ -83,7 +83,7 @@ int monster_level_idx(MONSTER_IDX m_idx) */ bool monster_is_powerful(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool powerful = r_ptr->flags2 & RF2_POWERFUL ? TRUE : FALSE; return powerful; @@ -97,7 +97,7 @@ bool monster_is_powerful(MONSTER_IDX m_idx) u32b monster_u_mode(MONSTER_IDX m_idx) { u32b u_mode = 0L; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool pet = is_pet(m_ptr); if (!pet) u_mode |= PM_ALLOW_UNIQUE; return u_mode; @@ -316,7 +316,7 @@ HIT_POINT spell_RF4_BREATH(int GF_TYPE, POSITION y, POSITION x, MONSTER_IDX m_id HIT_POINT dam, ms_type, drs_type = 0; concptr type_s; bool smart_learn_aux = TRUE; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool known = monster_near_player(m_idx, t_idx); bool see_either = see_monster(m_idx) || see_monster(t_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -632,7 +632,7 @@ HIT_POINT spell_RF5_BA_ELEC(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_I HIT_POINT spell_RF5_BA_FIRE(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { HIT_POINT dam, rad; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; if (m_ptr->r_idx == MON_ROLENTO) { @@ -880,7 +880,7 @@ HIT_POINT spell_RF5_DRAIN_MANA(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTE */ HIT_POINT spell_RF5_MIND_BLAST(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); HIT_POINT dam; GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN]; @@ -917,7 +917,7 @@ HIT_POINT spell_RF5_MIND_BLAST(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTE */ HIT_POINT spell_RF5_BRAIN_SMASH(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); HIT_POINT dam; GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN]; @@ -1467,7 +1467,7 @@ void spell_badstatus_message(MONSTER_IDX m_idx, MONSTER_IDX t_idx, concptr msg1, */ void spell_RF5_SCARE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1517,7 +1517,7 @@ void spell_RF5_SCARE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_BLIND(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1580,7 +1580,7 @@ void spell_RF5_BLIND(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1630,7 +1630,7 @@ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_SLOW(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1693,7 +1693,7 @@ void spell_RF5_SLOW(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_HOLD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1744,7 +1744,7 @@ void spell_RF5_HOLD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) void spell_RF6_HASTE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { bool see_m = see_monster(m_idx); - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_name(m_idx, m_name); @@ -1803,7 +1803,7 @@ HIT_POINT spell_RF6_HAND_DOOM(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ void spell_RF6_HEAL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; int rlev = monster_level_idx(m_idx); bool seen = (!p_ptr->blind && m_ptr->ml); GAME_TEXT m_name[MAX_NLEN]; @@ -1869,7 +1869,7 @@ void spell_RF6_HEAL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_INVULNER(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); monspell_message_base(m_idx, t_idx, @@ -1946,7 +1946,7 @@ void spell_RF6_TPORT(MONSTER_IDX m_idx, int TARGET_TYPE) */ HIT_POINT spell_RF6_WORLD(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; MONSTER_IDX who = 0; GAME_TEXT m_name[MAX_NLEN]; monster_name(m_idx, m_name); @@ -1964,7 +1964,7 @@ HIT_POINT spell_RF6_WORLD(MONSTER_IDX m_idx) */ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; HIT_POINT dummy_hp, dummy_maxhp; MONSTER_IDX k; POSITION dummy_y = m_ptr->fy; @@ -1982,11 +1982,11 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) delete_monster_idx(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx); summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode); - m_list[hack_m_idx_ii].hp = dummy_hp; - m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode); - m_list[hack_m_idx_ii].hp = dummy_hp; - m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; msg_print(_("『バーノール・ルパート』が分裂した!","Banor=Rupart splits in two person!")); break; @@ -2001,21 +2001,21 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) for (k = 1; k < m_max; k++) { - if (m_list[k].r_idx == MON_BANOR || m_list[k].r_idx == MON_LUPART) + if (current_floor_ptr->m_list[k].r_idx == MON_BANOR || current_floor_ptr->m_list[k].r_idx == MON_LUPART) { - dummy_hp += m_list[k].hp; - dummy_maxhp += m_list[k].maxhp; - if (m_list[k].r_idx != m_ptr->r_idx) + dummy_hp += current_floor_ptr->m_list[k].hp; + dummy_maxhp += current_floor_ptr->m_list[k].maxhp; + if (current_floor_ptr->m_list[k].r_idx != m_ptr->r_idx) { - dummy_y = m_list[k].fy; - dummy_x = m_list[k].fx; + dummy_y = current_floor_ptr->m_list[k].fy; + dummy_x = current_floor_ptr->m_list[k].fx; } delete_monster_idx(k); } } summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode); - m_list[hack_m_idx_ii].hp = dummy_hp; - m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; msg_print(_("『バーノール』と『ルパート』が合体した!", "Banor and Rupart combine into one!")); break; @@ -2067,8 +2067,8 @@ HIT_POINT spell_RF6_SPECIAL_ROLENTO(POSITION y, POSITION x, MONSTER_IDX m_idx, M HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { HIT_POINT dam = -1; - monster_type *m_ptr = &m_list[m_idx]; - monster_type *t_ptr = &m_list[t_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; bool monster_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); bool monster_to_monster = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -2144,7 +2144,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER } if(monster_to_player && p_ptr->riding) - mon_take_hit_mon(p_ptr->riding, dam, &dead, &fear, extract_note_dies(real_r_idx(&m_list[p_ptr->riding])), m_idx); + mon_take_hit_mon(p_ptr->riding, dam, &dead, &fear, extract_note_dies(real_r_idx(¤t_floor_ptr->m_list[p_ptr->riding])), m_idx); if(monster_to_monster) mon_take_hit_mon(t_idx, dam, &dead, &fear, extract_note_dies(real_r_idx(t_ptr)), m_idx); @@ -2163,7 +2163,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ HIT_POINT spell_RF6_SPECIAL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; disturb(TRUE, TRUE); @@ -2203,8 +2203,8 @@ HIT_POINT spell_RF6_SPECIAL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_I */ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; - monster_type *t_ptr = &m_list[t_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; simple_monspell_message(m_idx, t_idx, @@ -2265,7 +2265,7 @@ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; simple_monspell_message(m_idx, t_idx, @@ -2334,7 +2334,7 @@ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_TELE_LEVEL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = &m_list[t_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -2411,8 +2411,8 @@ HIT_POINT spell_RF6_PSY_SPEAR(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ void spell_RF6_DARKNESS(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; - monster_type *t_ptr = &m_list[t_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool can_use_lite_area = FALSE; bool monster_to_monster = TARGET_TYPE == MONSTER_TO_MONSTER; @@ -2541,7 +2541,7 @@ void spell_RF6_FORGET(MONSTER_IDX m_idx) */ void spell_RF6_RAISE_DEAD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monspell_message(m_idx, t_idx, _("%^sが何かをつぶやいた。", "%^s mumbles."), @@ -2680,7 +2680,7 @@ MONSTER_NUMBER summon_LOUSE(POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx) MONSTER_NUMBER summon_Kin(POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx) { int k, count = 0; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; for (k = 0; k < 4; k++) @@ -2705,7 +2705,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id bool see_either = see_monster(m_idx) || see_monster(t_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int rlev = monster_level_idx(m_idx); int count = 0; @@ -2795,7 +2795,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id void spell_RF6_S_CYBER(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { int count = 0; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; int rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); @@ -3047,7 +3047,7 @@ void spell_RF6_S_ANGEL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ { int count = 0, k; int num = 1; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -3253,7 +3253,7 @@ void spell_RF6_S_HI_UNDEAD(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID { bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; int rlev = monster_level_idx(m_idx); int k, count = 0; GAME_TEXT m_name[MAX_NLEN]; @@ -3381,7 +3381,7 @@ void spell_RF6_S_AMBERITES(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID void spell_RF6_S_UNIQUE(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { int count = 0, k; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; int rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); @@ -4106,7 +4106,7 @@ HIT_POINT monspell_damage_base(int SPELL_NUM, int hp, int rlev, bool powerful, i */ HIT_POINT monspell_damage(int SPELL_NUM, MONSTER_IDX m_idx, int TYPE) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int hp; int rlev = monster_level_idx(m_idx); diff --git a/src/mutation.c b/src/mutation.c index 681d0f4a2..ab245caa0 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2296,7 +2296,7 @@ bool mutation_power_aux(int power) break; } - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; r_ptr = &r_info[m_ptr->r_idx]; if ((r_ptr->flags3 & RF3_EVIL) && diff --git a/src/object2.c b/src/object2.c index 7b6618d43..9b3065f0d 100644 --- a/src/object2.c +++ b/src/object2.c @@ -78,7 +78,7 @@ void excise_object_idx(OBJECT_IDX o_idx) monster_type *m_ptr; /* Monster */ - m_ptr = &m_list[j_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[j_ptr->held_m_idx]; /* Scan all objects in the grid */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -287,7 +287,7 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) monster_type *m_ptr; /* Acquire monster */ - m_ptr = &m_list[o_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; /* Repair monster */ if (m_ptr->hold_o_idx == i1) @@ -384,7 +384,7 @@ void compact_objects(int size) monster_type *m_ptr; /* Acquire monster */ - m_ptr = &m_list[o_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; y = m_ptr->fy; x = m_ptr->fx; @@ -479,7 +479,7 @@ void wipe_o_list(void) monster_type *m_ptr; /* Monster */ - m_ptr = &m_list[o_ptr->held_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; /* Hack -- see above */ m_ptr->hold_o_idx = 0; @@ -6464,7 +6464,7 @@ static void spell_damcalc(monster_type *m_ptr, EFFECT_ID typ, HIT_POINT dam, int */ void spell_damcalc_by_spellnum(int spell_num, EFFECT_ID typ, MONSTER_IDX m_idx, int *max) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; HIT_POINT dam = monspell_damage((spell_num), m_idx, DAM_MAX); spell_damcalc(m_ptr, typ, dam, max); } @@ -6577,7 +6577,7 @@ bool process_warning(POSITION xx, POSITION yy) if (!g_ptr->m_idx) continue; - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; if (MON_CSLEEP(m_ptr)) continue; if (!is_hostile(m_ptr)) continue; diff --git a/src/player-move.c b/src/player-move.c index 360bf23bb..c62c61ce5 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -800,7 +800,7 @@ bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode) { feature_type *f_ptr = &f_info[feature]; - if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING); + if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx], mode | CEM_RIDING); if (have_flag(f_ptr->flags, FF_PATTERN)) { @@ -850,7 +850,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */ { - monster_type *om_ptr = &m_list[om_idx]; + monster_type *om_ptr = ¤t_floor_ptr->m_list[om_idx]; om_ptr->fy = ny; om_ptr->fx = nx; update_monster(om_idx, TRUE); @@ -858,7 +858,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) if (nm_idx > 0) /* Monster on new spot */ { - monster_type *nm_ptr = &m_list[nm_idx]; + monster_type *nm_ptr = ¤t_floor_ptr->m_list[nm_idx]; nm_ptr->fy = oy; nm_ptr->fx = ox; update_monster(nm_idx, TRUE); @@ -1113,7 +1113,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) monster_type *m_ptr; - monster_type *riding_m_ptr = &m_list[p_ptr->riding]; + monster_type *riding_m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */ GAME_TEXT m_name[MAX_NLEN]; @@ -1213,7 +1213,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) p_can_enter = FALSE; } - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE; if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE; @@ -1792,7 +1792,7 @@ static bool run_test(void) /* Visible monsters abort running */ if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) return (TRUE); @@ -2182,7 +2182,7 @@ static DIRECTION travel_test(DIRECTION prev_dir) /* Visible monsters abort running */ if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) return (0); diff --git a/src/player-status.c b/src/player-status.c index 258976b36..93df4b2f4 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -1800,7 +1800,7 @@ void calc_bonuses(void) } else { - monster_type *riding_m_ptr = &m_list[p_ptr->riding]; + monster_type *riding_m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; SPEED speed = riding_m_ptr->mspeed; @@ -2169,7 +2169,7 @@ void calc_bonuses(void) } else { - penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; + penalty = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } @@ -2208,7 +2208,7 @@ void calc_bonuses(void) } else { - penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; + penalty = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } diff --git a/src/realm-hex.c b/src/realm-hex.c index 5761d11f7..dd3303cd9 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -277,7 +277,7 @@ void revenge_store(HIT_POINT dam) */ bool teleport_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_TELE)) return FALSE; @@ -293,7 +293,7 @@ bool teleport_barrier(MONSTER_IDX m_idx) */ bool magic_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_MAGIC)) return FALSE; @@ -309,7 +309,7 @@ bool magic_barrier(MONSTER_IDX m_idx) */ bool multiply_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_MULTI)) return FALSE; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 6bcb5a684..e4534ea9c 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -288,7 +288,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) POSITION ty = y, tx = x; POSITION oy = y, ox = x; MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); @@ -526,7 +526,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; g_ptr = ¤t_floor_ptr->grid_array[y][x]; - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) @@ -661,7 +661,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) ny = y + ddy[dir]; nx = x + ddx[dir]; m_idx = g_ptr->m_idx; - m_ptr = &m_list[m_idx]; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Monster cannot move back? */ if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) diff --git a/src/save.c b/src/save.c index 7b627fcdc..032d047ad 100644 --- a/src/save.c +++ b/src/save.c @@ -1134,7 +1134,7 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) /* Dump the monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Dump it */ wr_monster(m_ptr); diff --git a/src/shoot.c b/src/shoot.c index db345eaa8..da42019c5 100644 --- a/src/shoot.c +++ b/src/shoot.c @@ -599,7 +599,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) { grid_type *c_mon_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[c_mon_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[c_mon_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Check the visibility */ @@ -632,7 +632,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) if (p_ptr->riding) { if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) - && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) + && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level) && one_in_(2)) { p_ptr->skill_exp[GINOU_RIDING] += 1; @@ -826,7 +826,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) if (stick_to) { MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; OBJECT_IDX o_idx = o_pop(); if (!o_idx) diff --git a/src/spells-status.c b/src/spells-status.c index 4bde3984e..04aef6c25 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -409,7 +409,7 @@ bool fishing(player_type *creature_ptr) else if (current_floor_ptr->grid_array[y][x].m_idx) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); + monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name); free_turn(creature_ptr); return FALSE; diff --git a/src/spells-summon.c b/src/spells-summon.c index efbd32b4a..6506f5225 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -371,7 +371,7 @@ int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x) /* Summoned by a monster */ if (who > 0) { - monster_type *m_ptr = &m_list[who]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[who]; if (is_pet(m_ptr)) mode |= PM_FORCE_PET; } @@ -408,7 +408,7 @@ void mitokohmon(void) { for (i = m_max - 1; i > 0; i--) { - m_ptr = &m_list[i]; + m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue; if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue; diff --git a/src/spells1.c b/src/spells1.c index 18ec2c3c7..35676e6eb 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -842,7 +842,7 @@ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P int i; BIT_FLAGS mode = 0L; - if (!who || is_pet(&m_list[who])) + if (!who || is_pet(¤t_floor_ptr->m_list[who])) mode |= PM_FORCE_PET; for (i = 0; i < o_ptr->number ; i++) @@ -997,8 +997,8 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; - monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -3586,7 +3586,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P } /* Hack -- Get new monster */ - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- Get new race */ r_ptr = &r_info[m_ptr->r_idx]; @@ -3911,16 +3911,16 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { do { - t_y = m_list[who].fy - 1 + randint1(3); - t_x = m_list[who].fx - 1 + randint1(3); + t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3); + t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3); max_attempts--; } while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x)); if (max_attempts < 1) { - t_y = m_list[who].fy; - t_x = m_list[who].fx; + t_y = current_floor_ptr->m_list[who].fy; + t_x = current_floor_ptr->m_list[who].fx; } } else @@ -3948,7 +3948,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (who > 0) { - m_ptr = &m_list[who]; + m_ptr = ¤t_floor_ptr->m_list[who]; rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1); monster_desc(m_name, m_ptr, 0); @@ -5503,9 +5503,9 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da /* Start at monster */ else if (who > 0) { - x1 = m_list[who].fx; - y1 = m_list[who].fy; - monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); + x1 = current_floor_ptr->m_list[who].fx; + y1 = current_floor_ptr->m_list[who].fy; + monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); } else @@ -5673,7 +5673,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE; if (!who && (project_m_n == 1) && !jump) { if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { @@ -5697,7 +5697,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (!who && (project_m_n == 1) && !jump) { if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { @@ -5826,7 +5826,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE); if(!who && (project_m_n == 1) && !jump){ if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){ - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { @@ -6106,7 +6106,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (flg & PROJECT_KILL) { - see_s_msg = (who > 0) ? is_seen(&m_list[who]) : + see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) : (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1))); } @@ -6204,7 +6204,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da /* A single bolt may be reflected */ if (grids <= 1) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; monster_race *ref_ptr = &r_info[m_ptr->r_idx]; if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && @@ -6350,7 +6350,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da /* Track if possible */ if (current_floor_ptr->grid_array[y][x].m_idx > 0) { - monster_type *m_ptr = &m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; if (m_ptr->ml) { @@ -6441,7 +6441,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[p_ptr->riding], 0); + monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0); if (rakubadam_m > 0) { diff --git a/src/spells2.c b/src/spells2.c index e86bca33a..f671658dc 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -371,7 +371,7 @@ bool detect_monsters_normal(POSITION range) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -419,7 +419,7 @@ bool detect_monsters_invis(POSITION range) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -472,7 +472,7 @@ bool detect_monsters_evil(POSITION range) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -529,7 +529,7 @@ bool detect_monsters_nonliving(POSITION range) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -579,7 +579,7 @@ bool detect_monsters_mind(POSITION range) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -632,7 +632,7 @@ bool detect_monsters_string(POSITION range, concptr Match) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -687,7 +687,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Skip dead monsters */ @@ -790,7 +790,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) /* Mark all (nearby) monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -808,7 +808,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) /* Affect all marked monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Skip unmarked monsters */ if (!(m_ptr->mflag & (MFLAG_TEMP))) continue; @@ -980,7 +980,7 @@ void aggravate_monsters(MONSTER_IDX who) /* Aggravate everyone nearby */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -1029,7 +1029,7 @@ void aggravate_monsters(MONSTER_IDX who) bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name) { int msec = delay_factor * delay_factor * delay_factor; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool resist = FALSE; @@ -1130,7 +1130,7 @@ bool symbol_genocide(int power, bool player_cast) /* Delete the monsters of that "type" */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Paranoia -- Skip dead monsters */ @@ -1172,7 +1172,7 @@ bool mass_genocide(int power, bool player_cast) /* Delete the (nearby) monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -1214,7 +1214,7 @@ bool mass_genocide_undead(int power, bool player_cast) /* Delete the (nearby) monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Paranoia -- Skip dead monsters */ @@ -1260,7 +1260,7 @@ bool probing(void) /* Probe all (nearby) monsters */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Paranoia -- Skip dead monsters */ @@ -1450,7 +1450,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (in_generate) /* In generation */ @@ -1837,7 +1837,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (m_idx) { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Get the monster's real name */ monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); @@ -1871,7 +1871,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Process monsters */ if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Quest monsters */ @@ -1950,7 +1950,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (g_ptr->m_idx) { - if (record_named_pet && is_pet(&m_list[g_ptr->m_idx]) && m_list[g_ptr->m_idx].nickname) + if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname) { char m2_name[MAX_NLEN]; @@ -2125,7 +2125,7 @@ void discharge_minion(void) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx || !is_pet(m_ptr)) continue; if (m_ptr->nickname) okay = FALSE; } @@ -2137,7 +2137,7 @@ void discharge_minion(void) for (i = 1; i < m_max; i++) { HIT_POINT dam; - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr; if (!m_ptr->r_idx || !is_pet(m_ptr)) continue; @@ -2213,7 +2213,7 @@ static void cave_temp_room_lite(void) if (g_ptr->m_idx) { int chance = 25; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; update_monster(g_ptr->m_idx, FALSE); @@ -2925,7 +2925,7 @@ bool teleport_swap(DIRECTION dir) return FALSE; } - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; r_ptr = &r_info[m_ptr->r_idx]; (void)set_monster_csleep(g_ptr->m_idx, 0); @@ -3821,7 +3821,7 @@ bool rush_attack(bool *mdeath) update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE); /* Found a monster */ - m_ptr = &m_list[current_floor_ptr->grid_array[ny][nx].m_idx]; + m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx]; if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx) { @@ -5143,7 +5143,7 @@ bool rodeo(player_type *creature_ptr) } if (!do_riding(TRUE)) return TRUE; - m_ptr = &m_list[creature_ptr->riding]; + m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sに乗った。", "You ride on %s."), m_name); diff --git a/src/spells3.c b/src/spells3.c index d14084981..ca22199d8 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -47,7 +47,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) bool look = TRUE; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Paranoia */ if (!m_ptr->r_idx) return (FALSE); @@ -154,7 +154,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, int attempts = 500; POSITION dis = 2; bool look = TRUE; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Paranoia */ if(!m_ptr->r_idx) return; @@ -387,7 +387,7 @@ void teleport_player(POSITION dis, BIT_FLAGS mode) /* A monster except your mount may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx)) { - monster_type *m_ptr = &m_list[tmp_m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[tmp_m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* @@ -429,7 +429,7 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) /* A monster except your mount or caster may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx)) { - monster_type *m_ptr = &m_list[tmp_m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[tmp_m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* @@ -503,7 +503,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) void teleport_away_followable(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; POSITION oldfy = m_ptr->fy; POSITION oldfx = m_ptr->fx; bool old_ml = m_ptr->ml; @@ -566,7 +566,7 @@ bool teleport_level_other(player_type *creature_ptr) if (!target_m_idx) return TRUE; if (!player_has_los_bold(target_row, target_col)) return TRUE; if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE; - m_ptr = &m_list[target_m_idx]; + m_ptr = ¤t_floor_ptr->m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name); @@ -598,7 +598,7 @@ void teleport_level(MONSTER_IDX m_idx) } else /* To monster */ { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Get the monster name (or "it") */ monster_desc(m_name, m_ptr, 0); @@ -738,7 +738,7 @@ void teleport_level(MONSTER_IDX m_idx) /* Monster level teleportation is simple deleting now */ if (m_idx > 0) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Check for quest completion */ check_quest_completion(m_ptr); @@ -1402,7 +1402,7 @@ static bool vanish_dungeon(void) /* Lose room and vault */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Awake monster */ if (g_ptr->m_idx && MON_CSLEEP(m_ptr)) @@ -3560,7 +3560,7 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm) chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1); if (p_ptr->riding) - chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0)); + chance += (MAX(r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0)); /* Extract mana consumption rate */ need_mana = mod_need_mana(s_ptr->smana, spell, use_realm); @@ -3912,7 +3912,7 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) bool polymorph_monster(POSITION y, POSITION x) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; bool polymorphed = FALSE; MONRACE_IDX new_r_idx; MONRACE_IDX old_r_idx = m_ptr->r_idx; @@ -3951,9 +3951,9 @@ bool polymorph_monster(POSITION y, POSITION x) /* Create a new monster (no groups) */ if (place_monster_aux(0, y, x, new_r_idx, mode)) { - m_list[hack_m_idx_ii].nickname = back_m.nickname; - m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx; - m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx; + current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname; + current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx; + current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx; /* Success */ polymorphed = TRUE; @@ -3963,7 +3963,7 @@ bool polymorph_monster(POSITION y, POSITION x) /* Placing the new monster failed */ if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN))) { - m_list[hack_m_idx_ii] = back_m; + current_floor_ptr->m_list[hack_m_idx_ii] = back_m; /* Re-initialize monster process */ mproc_init(); @@ -4358,7 +4358,7 @@ void massacre(void) y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; g_ptr = ¤t_floor_ptr->grid_array[y][x]; - m_ptr = &m_list[g_ptr->m_idx]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) @@ -4392,7 +4392,7 @@ bool eat_lock(void) } else if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; msg_print(_("何かが邪魔しています!", "There's something in the way!")); if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0); @@ -4449,7 +4449,7 @@ bool shock_power(void) POSITION ty = y, tx = x; POSITION oy = y, ox = x; MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -4539,7 +4539,7 @@ bool detonation(player_type *creature_ptr) void blood_curse_to_enemy(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; grid_type *g_ptr = ¤t_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP); int count = 0; diff --git a/src/trap.c b/src/trap.c index 8e8d0f53c..f36aa5d5e 100644 --- a/src/trap.c +++ b/src/trap.c @@ -535,8 +535,8 @@ void hit_trap(bool break_trap) /* Let them fight each other */ if (evil_idx && good_idx) { - monster_type *evil_ptr = &m_list[evil_idx]; - monster_type *good_ptr = &m_list[good_idx]; + monster_type *evil_ptr = ¤t_floor_ptr->m_list[evil_idx]; + monster_type *good_ptr = ¤t_floor_ptr->m_list[good_idx]; evil_ptr->target_y = good_ptr->fy; evil_ptr->target_x = good_ptr->fx; good_ptr->target_y = evil_ptr->fy; diff --git a/src/types.h b/src/types.h index 082695444..59636b110 100644 --- a/src/types.h +++ b/src/types.h @@ -440,7 +440,7 @@ struct skill_table * amound of memory, but they all seem rather complicated, and would * probably add enough code that the savings would be lost. So for * these reasons, we simply store an index into the "o_list" and - * "m_list" arrays, using "zero" when no monster/object is present. + * "current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present. * * Note that "o_idx" is the index of the top object in a stack of * objects, using the "next_o_idx" field of objects (see below) to @@ -1887,5 +1887,9 @@ typedef struct { object_type *o_list; /*!< The array of dungeon items [current_floor_ptr->max_o_idx] */ OBJECT_IDX max_o_idx; /*!< Maximum number of objects in the level */ + monster_type *m_list; /*!< The array of dungeon monsters [current_floor_ptr->max_m_idx] */ + MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */ + + } floor_type; diff --git a/src/variable.c b/src/variable.c index 23006b6c3..a40964bb7 100644 --- a/src/variable.c +++ b/src/variable.c @@ -482,13 +482,9 @@ FLOOR_IDX max_floor_id; u32b saved_floor_file_sign; -/* - * The array of dungeon monsters [max_m_idx] - */ -monster_type *m_list; /* - * The array to process dungeon monsters [max_m_idx] + * The array to process dungeon monsters [current_floor_ptr->max_m_idx] */ s16b *mproc_list[MAX_MTIMED]; s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */ @@ -767,11 +763,6 @@ EGO_IDX max_e_idx; DUNGEON_IDX max_d_idx; /* - * Maximum number of monsters in the level - */ -MONSTER_IDX max_m_idx; - -/* * Maximum size of the wilderness */ POSITION max_wild_x; diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 24d0f0fa4..823b54082 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -1191,7 +1191,7 @@ static void prt_speed(void) { if (p_ptr->riding) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE; else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET; else attr = TERM_GREEN; @@ -1212,7 +1212,7 @@ static void prt_speed(void) { if (p_ptr->riding) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE; else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET; else attr = TERM_RED; @@ -1398,7 +1398,7 @@ static void health_redraw(bool riding) col = COL_INFO; } - m_ptr = &m_list[health_who]; + m_ptr = ¤t_floor_ptr->m_list[health_who]; if (p_ptr->wizard && p_ptr->inside_battle) { @@ -1410,32 +1410,32 @@ static void health_redraw(bool riding) Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / "); Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / "); - if(m_list[1].r_idx) + if(current_floor_ptr->m_list[1].r_idx) { - Term_putstr(col - 2, row, 2, r_info[m_list[1].r_idx].x_attr, format("%c", r_info[m_list[1].r_idx].x_char)); - Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", m_list[1].hp)); - Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", m_list[1].max_maxhp)); + Term_putstr(col - 2, row, 2, r_info[current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[1].r_idx].x_char)); + Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp)); + Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp)); } - if(m_list[2].r_idx) + if(current_floor_ptr->m_list[2].r_idx) { - Term_putstr(col - 2, row + 1, 2, r_info[m_list[2].r_idx].x_attr, format("%c", r_info[m_list[2].r_idx].x_char)); - Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", m_list[2].hp)); - Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", m_list[2].max_maxhp)); + Term_putstr(col - 2, row + 1, 2, r_info[current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[2].r_idx].x_char)); + Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp)); + Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp)); } - if(m_list[3].r_idx) + if(current_floor_ptr->m_list[3].r_idx) { - Term_putstr(col - 2, row + 2, 2, r_info[m_list[3].r_idx].x_attr, format("%c", r_info[m_list[3].r_idx].x_char)); - Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", m_list[3].hp)); - Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", m_list[3].max_maxhp)); + Term_putstr(col - 2, row + 2, 2, r_info[current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[3].r_idx].x_char)); + Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp)); + Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp)); } - if(m_list[4].r_idx) + if(current_floor_ptr->m_list[4].r_idx) { - Term_putstr(col - 2, row + 3, 2, r_info[m_list[4].r_idx].x_attr, format("%c", r_info[m_list[4].r_idx].x_char)); - Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", m_list[4].hp)); - Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", m_list[4].max_maxhp)); + Term_putstr(col - 2, row + 3, 2, r_info[current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[4].r_idx].x_char)); + Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp)); + Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp)); } } else @@ -1696,8 +1696,8 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){ for(i=0;igrid_array[temp_y[i]][temp_x[i]]; - if(!g_ptr->m_idx || !m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look - m_ptr = &m_list[g_ptr->m_idx]; + if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; if(is_pet(m_ptr))continue;//pet if(!m_ptr->r_idx)continue;//dead? { diff --git a/src/wild.c b/src/wild.c index 00898b74e..5064911ae 100644 --- a/src/wild.c +++ b/src/wild.c @@ -1138,7 +1138,7 @@ bool change_wild_mode(void) for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx) continue; if (is_pet(m_ptr) && i != p_ptr->riding) have_pet = TRUE; diff --git a/src/wizard2.c b/src/wizard2.c index a2b9f61c8..39b4e4dc5 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1474,7 +1474,7 @@ static void do_cmd_wiz_zap(void) /* Genocide everyone nearby */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -1511,7 +1511,7 @@ static void do_cmd_wiz_zap_all(void) /* Genocide everyone */ for (i = 1; i < m_max; i++) { - monster_type *m_ptr = &m_list[i]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; diff --git a/src/xtra2.c b/src/xtra2.c index d62b99eae..01037d8fd 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -490,7 +490,7 @@ concptr look_mon_desc(monster_type *m_ptr, BIT_FLAGS mode) */ bool target_able(MONSTER_IDX m_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Monster must be alive */ if (!m_ptr->r_idx) return (FALSE); @@ -532,7 +532,7 @@ bool target_okay(void) /* Accept reasonable targets */ if (target_able(target_who)) { - monster_type *m_ptr = &m_list[target_who]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[target_who]; /* Acquire monster location */ target_row = m_ptr->fy; @@ -592,8 +592,8 @@ static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) POSITION *y = (POSITION*)(v); grid_type *ca_ptr = ¤t_floor_ptr->grid_array[y[a]][x[a]]; grid_type *cb_ptr = ¤t_floor_ptr->grid_array[y[b]][x[b]]; - monster_type *ma_ptr = &m_list[ca_ptr->m_idx]; - monster_type *mb_ptr = &m_list[cb_ptr->m_idx]; + monster_type *ma_ptr = ¤t_floor_ptr->m_list[ca_ptr->m_idx]; + monster_type *mb_ptr = ¤t_floor_ptr->m_list[cb_ptr->m_idx]; monster_race *ap_ra_ptr, *ap_rb_ptr; /* The player grid */ @@ -746,7 +746,7 @@ static bool target_set_accept(POSITION y, POSITION x) /* Visible monsters */ if (g_ptr->m_idx) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monsters */ if (m_ptr->ml) return (TRUE); @@ -824,7 +824,7 @@ static void target_set_prepare(BIT_FLAGS mode) /* Require target_able monsters for "TARGET_KILL" */ if ((mode & (TARGET_KILL)) && !target_able(g_ptr->m_idx)) continue; - if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[g_ptr->m_idx])) continue; + if ((mode & (TARGET_KILL)) && !target_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx])) continue; /* Save the location */ temp_x[temp_n] = x; @@ -1012,9 +1012,9 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) /* Actual monsters */ - if (g_ptr->m_idx && m_list[g_ptr->m_idx].ml) + if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml) { - monster_type *m_ptr = &m_list[g_ptr->m_idx]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; GAME_TEXT m_name[MAX_NLEN]; bool recall = FALSE; @@ -2155,7 +2155,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed) } else if (p_ptr->riding && with_steed) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CONFUSED(m_ptr)) @@ -2190,7 +2190,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed) else { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_desc(m_name, m_ptr, 0); if (MON_CONFUSED(m_ptr)) @@ -2300,7 +2300,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) } else if (p_ptr->riding) { - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CONFUSED(m_ptr)) @@ -2335,7 +2335,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) else { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = &m_list[p_ptr->riding]; + monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; monster_desc(m_name, m_ptr, 0); if (MON_CONFUSED(m_ptr)) -- 2.11.0