OSDN Git Service

[Refactor] #38993 m_list と max_m_idx を floor_type に取り込む。 / Move m_list and max_m_idx...
[hengband/hengband.git] / src / cmd2.c
index bfb6664..cc71a85 100644 (file)
@@ -63,7 +63,7 @@ static bool confirm_leave_level(bool down_stair)
  */
 bool cmd_limit_cast(player_type *creature_ptr)
 {
-       if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
+       if (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
        {
                msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
                msg_print(NULL);
@@ -140,7 +140,7 @@ void do_cmd_go_up(void)
        bool go_up = FALSE;
 
        /* Player grid */
-       grid_type *g_ptr = &current_floor->grid_array[p_ptr->y][p_ptr->x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        int up_num = 0;
@@ -188,7 +188,7 @@ void do_cmd_go_up(void)
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
 
                /* Leaving */
@@ -203,7 +203,7 @@ void do_cmd_go_up(void)
                return;
        }
 
-       if (!dun_level)
+       if (!current_floor_ptr->dun_level)
        {
                go_up = TRUE;
        }
@@ -235,7 +235,7 @@ void do_cmd_go_up(void)
                leave_quest_check();
 
                p_ptr->inside_quest = g_ptr->special;
-               dun_level = 0;
+               current_floor_ptr->dun_level = 0;
                up_num = 0;
        }
 
@@ -259,15 +259,15 @@ void do_cmd_go_up(void)
                }
 
                /* Get out from current dungeon */
-               if (dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
-                       up_num = dun_level;
+               if (current_floor_ptr->dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
+                       up_num = current_floor_ptr->dun_level;
        }
        if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
 
        /* Success */
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
                msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
-       else if (up_num == dun_level)
+       else if (up_num == current_floor_ptr->dun_level)
                msg_print(_("地上に戻った。", "You go back to the surface."));
        else
                msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
@@ -284,7 +284,7 @@ void do_cmd_go_up(void)
 void do_cmd_go_down(void)
 {
        /* Player grid */
-       grid_type *g_ptr = &current_floor->grid_array[p_ptr->y][p_ptr->x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        bool fall_trap = FALSE;
@@ -340,7 +340,7 @@ void do_cmd_go_down(void)
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
 
                /* Leaving */
@@ -355,7 +355,7 @@ void do_cmd_go_down(void)
        {
                DUNGEON_IDX target_dungeon = 0;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
                        target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
 
@@ -391,7 +391,7 @@ void do_cmd_go_down(void)
                if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
                else down_num += 1;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
                        /* Enter the dungeon just now */
                        p_ptr->enter_dungeon = TRUE;
@@ -481,7 +481,7 @@ void do_cmd_search(void)
  */
 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        /* Scan all objects in the grid */
@@ -489,7 +489,7 @@ static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
        {
                object_type *o_ptr;
 
-               o_ptr = &o_list[this_o_idx];
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
@@ -521,7 +521,7 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
        int i, j;
        bool flag = TRUE;
        bool more = FALSE;
-       object_type *o_ptr = &o_list[o_idx];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
        take_turn(p_ptr, 100);
 
@@ -608,8 +608,8 @@ static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under
                yy = p_ptr->y + ddy_ddd[d];
                xx = p_ptr->x + ddx_ddd[d];
 
-               /* Get the current_floor->grid_array */
-               g_ptr = &current_floor->grid_array[yy][xx];
+               /* Get the current_floor_ptr->grid_array */
+               g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
                /* Must have knowledge */
                if (!(g_ptr->info & (CAVE_MARK))) continue;
@@ -664,7 +664,7 @@ static int count_chests(POSITION *y, POSITION *x, bool trapped)
                if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
 
                /* Grab the object */
-               o_ptr = &o_list[o_idx];
+               o_ptr = &current_floor_ptr->o_list[o_idx];
 
                /* Already open */
                if (o_ptr->pval == 0) continue;
@@ -703,7 +703,7 @@ static bool do_cmd_open_aux(POSITION y, POSITION x)
        int i, j;
 
        /* Get requested grid */
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        feature_type *f_ptr = &f_info[g_ptr->feat];
        bool more = FALSE;
 
@@ -839,7 +839,7 @@ void do_cmd_open(void)
                x = p_ptr->x + ddx[dir];
 
                /* Get requested grid */
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -895,7 +895,7 @@ void do_cmd_open(void)
  */
 static bool do_cmd_close_aux(POSITION y, POSITION x)
 {
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        FEAT_IDX old_feat = g_ptr->feat;
        bool more = FALSE;
 
@@ -984,7 +984,7 @@ void do_cmd_close(void)
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1028,7 +1028,7 @@ void do_cmd_close(void)
  */
 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
 {
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Must have knowledge */
        if (!(g_ptr->info & CAVE_MARK))
@@ -1074,7 +1074,7 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 
        take_turn(p_ptr, 100);
 
-       g_ptr = &current_floor->grid_array[y][x];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
        f_ptr = &f_info[g_ptr->feat];
        power = f_ptr->power;
 
@@ -1220,7 +1220,7 @@ void do_cmd_tunnel(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1278,7 +1278,7 @@ bool easy_open_door(POSITION y, POSITION x)
 {
        int i, j;
 
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Must be a closed door */
@@ -1368,7 +1368,7 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
        bool more = FALSE;
-       object_type *o_ptr = &o_list[o_idx];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
        take_turn(p_ptr, 100);
 
@@ -1449,7 +1449,7 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 
 bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       grid_type *g_ptr = &current_floor->grid_array[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Get feature */
        feature_type *f_ptr = &f_info[g_ptr->feat];
@@ -1574,7 +1574,7 @@ void do_cmd_disarm(void)
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1631,7 +1631,7 @@ void do_cmd_disarm(void)
  */
 static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       grid_type       *g_ptr = &current_floor->grid_array[y][x];
+       grid_type       *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Get feature */
        feature_type *f_ptr = &f_info[g_ptr->feat];
@@ -1755,7 +1755,7 @@ void do_cmd_bash(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1837,7 +1837,7 @@ void do_cmd_alter(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1959,7 +1959,7 @@ void do_cmd_spike(void)
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               g_ptr = &current_floor->grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -2541,7 +2541,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
                {
                        hit_wall = TRUE;
-                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
+                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
                }
 
                /* The player can see the (on screen) missile */
@@ -2577,10 +2577,10 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                cur_dis++;
 
                /* Monster here, Try to hit it */
-               if (current_floor->grid_array[y][x].m_idx)
+               if (current_floor_ptr->grid_array[y][x].m_idx)
                {
-                       grid_type *g_ptr = &current_floor->grid_array[y][x];
-                       monster_type *m_ptr = &m_list[g_ptr->m_idx];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+                       monster_type *m_ptr = &current_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->grid_array[y][x].m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
 
                                /* ToDo (Robert): fix the invulnerability */
-                               if (current_floor->grid_array[y][x].m_idx &&
-                                   is_friendly(&m_list[current_floor->grid_array[y][x].m_idx]) &&
+                               if (current_floor_ptr->grid_array[y][x].m_idx &&
+                                   is_friendly(&current_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->grid_array[y][x].m_idx], 0);
+                                       monster_desc(m_name, &current_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->grid_array[y][x].m_idx]);
+                                       set_hostile(&current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]);
                                }
                        }
                        do_drop = FALSE;