OSDN Git Service

[Refactor] #38993 cur_wid/hgt を floor_type に取り込み width/heightに改名。 / Move cur_wid...
[hengband/hengband.git] / src / floor-generate.c
index 2173b79..015cd7c 100644 (file)
@@ -221,9 +221,9 @@ static bool alloc_stairs(IDX feat, int num, int walls)
                        int candidates = 0;
                        int pick;
 
-                       for (y = 1; y < cur_hgt - 1; y++)
+                       for (y = 1; y < current_floor_ptr->height - 1; y++)
                        {
-                               for (x = 1; x < cur_wid - 1; x++)
+                               for (x = 1; x < current_floor_ptr->width - 1; x++)
                                {
                                        if (alloc_stairs_aux(y, x, walls))
                                        {
@@ -247,9 +247,9 @@ static bool alloc_stairs(IDX feat, int num, int walls)
                        /* Choose a random one */
                        pick = randint1(candidates);
 
-                       for (y = 1; y < cur_hgt - 1; y++)
+                       for (y = 1; y < current_floor_ptr->height - 1; y++)
                        {
-                               for (x = 1; x < cur_wid - 1; x++)
+                               for (x = 1; x < current_floor_ptr->width - 1; x++)
                                {
                                        if (alloc_stairs_aux(y, x, walls))
                                        {
@@ -295,7 +295,7 @@ static void alloc_object(int set, EFFECT_ID typ, int num)
        grid_type *g_ptr;
 
        /* A small level has few objects. */
-       num = num * cur_hgt * cur_wid / (MAX_HGT*MAX_WID) +1;
+       num = num * current_floor_ptr->height * current_floor_ptr->width / (MAX_HGT*MAX_WID) +1;
 
        /* Place some objects */
        for (k = 0; k < num; k++)
@@ -307,8 +307,8 @@ static void alloc_object(int set, EFFECT_ID typ, int num)
 
                        dummy++;
 
-                       y = randint0(cur_hgt);
-                       x = randint0(cur_wid);
+                       y = randint0(current_floor_ptr->height);
+                       x = randint0(current_floor_ptr->width);
 
                        g_ptr = &current_floor_ptr->grid_array[y][x];
 
@@ -425,8 +425,8 @@ bool place_quest_monsters(void)
                                        grid_type    *g_ptr;
                                        feature_type *f_ptr;
 
-                                       y = randint0(cur_hgt);
-                                       x = randint0(cur_wid);
+                                       y = randint0(current_floor_ptr->height);
+                                       x = randint0(current_floor_ptr->width);
 
                                        g_ptr = &current_floor_ptr->grid_array[y][x];
                                        f_ptr = &f_info[g_ptr->feat];
@@ -581,8 +581,8 @@ static bool cave_gen(void)
        dun_tun_jct = rand_range(DUN_TUN_JCT_MIN, DUN_TUN_JCT_MAX);
 
        /* Actual maximum number of rooms on this level */
-       dun->row_rooms = cur_hgt / BLOCK_HGT;
-       dun->col_rooms = cur_wid / BLOCK_WID;
+       dun->row_rooms = current_floor_ptr->height / BLOCK_HGT;
+       dun->col_rooms = current_floor_ptr->width / BLOCK_WID;
 
        /* Initialize the room table */
        for (y = 0; y < dun->row_rooms; y++)
@@ -606,34 +606,34 @@ static bool cave_gen(void)
        if (dun->empty_level)
        {
                /* Start with floors */
-               for (y = 0; y < cur_hgt; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       for (x = 0; x < cur_wid; x++)
+                       for (x = 0; x < current_floor_ptr->width; x++)
                        {
                                place_floor_bold(y, x);
                        }
                }
 
                /* Special boundary walls -- Top and bottom */
-               for (x = 0; x < cur_wid; x++)
+               for (x = 0; x < current_floor_ptr->width; x++)
                {
                        place_extra_bold(0, x);
-                       place_extra_bold(cur_hgt - 1, x);
+                       place_extra_bold(current_floor_ptr->height - 1, x);
                }
 
                /* Special boundary walls -- Left and right */
-               for (y = 1; y < (cur_hgt - 1); y++)
+               for (y = 1; y < (current_floor_ptr->height - 1); y++)
                {
                        place_extra_bold(y, 0);
-                       place_extra_bold(y, cur_wid - 1);
+                       place_extra_bold(y, current_floor_ptr->width - 1);
                }
        }
        else
        {
                /* Start with walls */
-               for (y = 0; y < cur_hgt; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       for (x = 0; x < cur_wid; x++)
+                       for (x = 0; x < current_floor_ptr->width; x++)
                        {
                                place_extra_bold(y, x);
                        }
@@ -646,7 +646,7 @@ static bool cave_gen(void)
        /* Build maze */
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
        {
-               build_maze_vault(cur_wid/2-1, cur_hgt/2-1, cur_wid-4, cur_hgt-4, FALSE);
+               build_maze_vault(current_floor_ptr->width/2-1, current_floor_ptr->height/2-1, current_floor_ptr->width-4, current_floor_ptr->height-4, FALSE);
 
                /* Place 3 or 4 down stairs near some walls */
                if (!alloc_stairs(feat_down_stair, rand_range(2, 3), 3)) return FALSE;
@@ -671,7 +671,7 @@ static bool cave_gen(void)
                {
                        while (one_in_(DUN_MOS_DEN))
                        {
-                               place_trees(randint1(cur_wid - 2), randint1(cur_hgt - 2));
+                               place_trees(randint1(current_floor_ptr->width - 2), randint1(current_floor_ptr->height - 2));
                        }
                }
 
@@ -867,17 +867,17 @@ static bool cave_gen(void)
        }
 
        /* Special boundary walls -- Top and bottom */
-       for (x = 0; x < cur_wid; x++)
+       for (x = 0; x < current_floor_ptr->width; x++)
        {
                place_bound_perm_wall(&current_floor_ptr->grid_array[0][x]);
-               place_bound_perm_wall(&current_floor_ptr->grid_array[cur_hgt - 1][x]);
+               place_bound_perm_wall(&current_floor_ptr->grid_array[current_floor_ptr->height - 1][x]);
        }
 
        /* Special boundary walls -- Left and right */
-       for (y = 1; y < (cur_hgt - 1); y++)
+       for (y = 1; y < (current_floor_ptr->height - 1); y++)
        {
                place_bound_perm_wall(&current_floor_ptr->grid_array[y][0]);
-               place_bound_perm_wall(&current_floor_ptr->grid_array[y][cur_wid - 1]);
+               place_bound_perm_wall(&current_floor_ptr->grid_array[y][current_floor_ptr->width - 1]);
        }
 
        /* Determine the character location */
@@ -894,12 +894,12 @@ static bool cave_gen(void)
        i = d_info[p_ptr->dungeon_idx].min_m_alloc_level;
 
        /* To make small levels a bit more playable */
-       if (cur_hgt < MAX_HGT || cur_wid < MAX_WID)
+       if (current_floor_ptr->height < MAX_HGT || current_floor_ptr->width < MAX_WID)
        {
                int small_tester = i;
 
-               i = (i * cur_hgt) / MAX_HGT;
-               i = (i * cur_wid) / MAX_WID;
+               i = (i * current_floor_ptr->height) / MAX_HGT;
+               i = (i * current_floor_ptr->width) / MAX_WID;
                i += 1;
 
                if (i > small_tester) i = small_tester;
@@ -945,9 +945,9 @@ static bool cave_gen(void)
        if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > current_floor_ptr->dun_level)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
        {
                /* Lite the current_floor_ptr->grid_array */
-               for (y = 0; y < cur_hgt; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       for (x = 0; x < cur_wid; x++)
+                       for (x = 0; x < current_floor_ptr->width; x++)
                        {
                                current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW);
                        }
@@ -1025,8 +1025,8 @@ static void generate_challenge_arena(void)
        POSITION qx = 0;
 
        /* Smallest area */
-       cur_hgt = SCREEN_HGT;
-       cur_wid = SCREEN_WID;
+       current_floor_ptr->height = SCREEN_HGT;
+       current_floor_ptr->width = SCREEN_WID;
 
        /* Start with solid walls */
        for (y = 0; y < MAX_HGT; y++)
@@ -1186,9 +1186,9 @@ static void generate_fixed_floor(void)
        POSITION x, y;
 
        /* Start with perm walls */
-       for (y = 0; y < cur_hgt; y++)
+       for (y = 0; y < current_floor_ptr->height; y++)
        {
-               for (x = 0; x < cur_wid; x++)
+               for (x = 0; x < current_floor_ptr->width; x++)
                {
                        place_solid_perm_bold(y, x);
                }
@@ -1242,26 +1242,26 @@ static bool level_gen(concptr *why)
                        while ((level_height == MAX_HGT/SCREEN_HGT) && (level_width == MAX_WID/SCREEN_WID));
                }
 
-               cur_hgt = level_height * SCREEN_HGT;
-               cur_wid = level_width * SCREEN_WID;
+               current_floor_ptr->height = level_height * SCREEN_HGT;
+               current_floor_ptr->width = level_width * SCREEN_WID;
 
                /* Assume illegal panel */
-               panel_row_min = cur_hgt;
-               panel_col_min = cur_wid;
+               panel_row_min = current_floor_ptr->height;
+               panel_col_min = current_floor_ptr->width;
 
                msg_format_wizard(CHEAT_DUNGEON,
                        _("小さなフロア: X:%d, Y:%d", "A 'small' dungeon level: X:%d, Y:%d."),
-                       cur_wid, cur_hgt);
+                       current_floor_ptr->width, current_floor_ptr->height);
        }
        else
        {
                /* Big dungeon */
-               cur_hgt = MAX_HGT;
-               cur_wid = MAX_WID;
+               current_floor_ptr->height = MAX_HGT;
+               current_floor_ptr->width = MAX_WID;
 
                /* Assume illegal panel */
-               panel_row_min = cur_hgt;
-               panel_col_min = cur_wid;
+               panel_row_min = current_floor_ptr->height;
+               panel_col_min = current_floor_ptr->width;
        }
 
        /* Make a dungeon */
@@ -1281,9 +1281,9 @@ void wipe_generate_random_floor_flags(void)
 {
        POSITION x, y;
 
-       for (y = 0; y < cur_hgt; y++)
+       for (y = 0; y < current_floor_ptr->height; y++)
        {
-               for (x = 0; x < cur_wid; x++)
+               for (x = 0; x < current_floor_ptr->width; x++)
                {
                        /* Wipe unused flags */
                        current_floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK);
@@ -1292,9 +1292,9 @@ void wipe_generate_random_floor_flags(void)
 
        if (current_floor_ptr->dun_level)
        {
-               for (y = 1; y < cur_hgt - 1; y++)
+               for (y = 1; y < current_floor_ptr->height - 1; y++)
                {
-                       for (x = 1; x < cur_wid - 1; x++)
+                       for (x = 1; x < current_floor_ptr->width - 1; x++)
                        {
                                /* There might be trap */
                                current_floor_ptr->grid_array[y][x].info |= CAVE_UNSAFE;