From ad951098494c9de50a330832bbd93a3e508989a8 Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 27 Feb 2019 02:02:19 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38993=20cur=5Fwid/hgt=20=E3=82=92?= =?utf8?q?=20floor=5Ftype=20=E3=81=AB=E5=8F=96=E3=82=8A=E8=BE=BC=E3=81=BF?= =?utf8?q?=20width/height=E3=81=AB=E6=94=B9=E5=90=8D=E3=80=82=20/=20Move?= =?utf8?q?=20cur=5Fwid/hgt=20to=20floor=5Ftype=20structure=20and=20rename?= =?utf8?q?=20width=20and=20height.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd4.c | 4 +-- src/defines.h | 6 ++-- src/dungeon.c | 8 ++--- src/externs.h | 2 -- src/floor-events.c | 12 +++---- src/floor-generate.c | 94 +++++++++++++++++++++++++-------------------------- src/floor-save.c | 16 ++++----- src/floor-streams.c | 24 ++++++------- src/grid.c | 78 +++++++++++++++++++++--------------------- src/init1.c | 8 ++--- src/load.c | 16 ++++----- src/main-win.c | 4 +-- src/mind.c | 8 ++--- src/monster2.c | 12 +++---- src/object2.c | 8 ++--- src/player-move.c | 16 ++++----- src/rooms-city.c | 4 +-- src/rooms-vault.c | 6 ++-- src/rooms.c | 10 +++--- src/save.c | 12 +++---- src/spells-floor.c | 16 ++++----- src/spells1.c | 12 +++---- src/spells2.c | 8 ++--- src/spells3.c | 16 ++++----- src/types.h | 2 ++ src/variable.c | 2 -- src/view-mainwindow.c | 8 ++--- src/wild.c | 36 ++++++++++---------- src/wizard2.c | 4 +-- src/xtra2.c | 24 ++++++------- 30 files changed, 237 insertions(+), 239 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index 069c2fd57..e2fe86fbc 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5270,9 +5270,9 @@ static void do_cmd_knowledge_artifacts(void) } /* Check the dungeon */ - 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/defines.h b/src/defines.h index c2661ad8f..47756f2f3 100644 --- a/src/defines.h +++ b/src/defines.h @@ -3407,20 +3407,20 @@ * Determines if a map location is fully inside the outer walls */ #define in_bounds(Y,X) \ - (((Y) > 0) && ((X) > 0) && ((Y) < cur_hgt-1) && ((X) < cur_wid-1)) + (((Y) > 0) && ((X) > 0) && ((Y) < current_floor_ptr->height-1) && ((X) < current_floor_ptr->width-1)) /* * Determines if a map location is on or inside the outer walls */ #define in_bounds2(Y,X) \ - (((Y) >= 0) && ((X) >= 0) && ((Y) < cur_hgt) && ((X) < cur_wid)) + (((Y) >= 0) && ((X) >= 0) && ((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width)) /* * Determines if a map location is on or inside the outer walls * (unsigned version) */ #define in_bounds2u(Y,X) \ - (((Y) < cur_hgt) && ((X) < cur_wid)) + (((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width)) /* * Determines if a map location is currently "on screen" -RAK- diff --git a/src/dungeon.c b/src/dungeon.c index 8da607473..6031c018c 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -3406,8 +3406,8 @@ static void process_world(void) int number_mon = 0; /* Count all hostile monsters */ - for (i2 = 0; i2 < cur_wid; ++i2) - for (j2 = 0; j2 < cur_hgt; j2++) + for (i2 = 0; i2 < current_floor_ptr->width; ++i2) + for (j2 = 0; j2 < current_floor_ptr->height; j2++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2]; @@ -5962,8 +5962,8 @@ void play_game(bool new_game) record_o_name[0] = '\0'; /* Reset map 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; /* Sexy gal gets bonus to maximum weapon skill of whip */ if (p_ptr->pseikaku == SEIKAKU_SEXY) diff --git a/src/externs.h b/src/externs.h index 6bd16ea0c..968f39a73 100644 --- a/src/externs.h +++ b/src/externs.h @@ -159,8 +159,6 @@ extern s16b command_new; extern bool msg_flag; extern s16b running; extern GAME_TURN resting; -extern POSITION cur_hgt; -extern POSITION cur_wid; extern MONSTER_NUMBER num_repro; extern DEPTH object_level; extern DEPTH monster_level; diff --git a/src/floor-events.c b/src/floor-events.c index b7e1833cd..104362fd8 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -9,9 +9,9 @@ void day_break() if (!p_ptr->wild_mode) { /* Hack -- Scan the town */ - 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -46,9 +46,9 @@ void night_falls(void) if (!p_ptr->wild_mode) { /* Hack -- Scan the town */ - 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -97,9 +97,9 @@ MONSTER_NUMBER count_all_hostile_monsters(void) POSITION x, y; MONSTER_NUMBER number_mon = 0; - for (x = 0; x < cur_wid; ++x) + for (x = 0; x < current_floor_ptr->width; ++x) { - for (y = 0; y < cur_hgt; ++y) + for (y = 0; y < current_floor_ptr->height; ++y) { MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; diff --git a/src/floor-generate.c b/src/floor-generate.c index 2173b79d8..015cd7cfd 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -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 = ¤t_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 = ¤t_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(¤t_floor_ptr->grid_array[0][x]); - place_bound_perm_wall(¤t_floor_ptr->grid_array[cur_hgt - 1][x]); + place_bound_perm_wall(¤t_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(¤t_floor_ptr->grid_array[y][0]); - place_bound_perm_wall(¤t_floor_ptr->grid_array[y][cur_wid - 1]); + place_bound_perm_wall(¤t_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; diff --git a/src/floor-save.c b/src/floor-save.c index 071a10ec6..c2a51eb2c 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -323,8 +323,8 @@ static void build_dead_end(void) set_floor_and_wall(0); /* Smallest area */ - cur_hgt = SCREEN_HGT; - cur_wid = SCREEN_WID; + current_floor_ptr->height = SCREEN_HGT; + current_floor_ptr->width = SCREEN_WID; /* Filled with permanent walls */ for (y = 0; y < MAX_HGT; y++) @@ -337,8 +337,8 @@ static void build_dead_end(void) } /* Place at center of the floor */ - p_ptr->y = cur_hgt / 2; - p_ptr->x = cur_wid / 2; + p_ptr->y = current_floor_ptr->height / 2; + p_ptr->x = current_floor_ptr->width / 2; /* Give one square */ place_floor_bold(p_ptr->y, p_ptr->x); @@ -756,9 +756,9 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) int i; /* Search usable stairs */ - 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; @@ -1473,9 +1473,9 @@ void stair_creation(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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/floor-streams.c b/src/floor-streams.c index 93c4d948a..ba49bb8be 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -164,8 +164,8 @@ void add_river(IDX feat1, IDX feat2) /* Hack -- Choose starting point */ - y2 = randint1(cur_hgt / 2 - 2) + cur_hgt / 2; - x2 = randint1(cur_wid / 2 - 2) + cur_wid / 2; + y2 = randint1(current_floor_ptr->height / 2 - 2) + current_floor_ptr->height / 2; + x2 = randint1(current_floor_ptr->width / 2 - 2) + current_floor_ptr->width / 2; /* Hack -- Choose ending point somewhere on boundary */ switch(randint1(4)) @@ -173,7 +173,7 @@ void add_river(IDX feat1, IDX feat2) case 1: { /* top boundary */ - x1 = randint1(cur_wid-2)+1; + x1 = randint1(current_floor_ptr->width-2)+1; y1 = 1; break; } @@ -181,21 +181,21 @@ void add_river(IDX feat1, IDX feat2) { /* left boundary */ x1 = 1; - y1 = randint1(cur_hgt-2)+1; + y1 = randint1(current_floor_ptr->height-2)+1; break; } case 3: { /* right boundary */ - x1 = cur_wid-1; - y1 = randint1(cur_hgt-2)+1; + x1 = current_floor_ptr->width-1; + y1 = randint1(current_floor_ptr->height-2)+1; break; } case 4: { /* bottom boundary */ - x1 = randint1(cur_wid-2)+1; - y1 = cur_hgt-1; + x1 = randint1(current_floor_ptr->width-2)+1; + y1 = current_floor_ptr->height-1; break; } } @@ -241,8 +241,8 @@ void build_streamer(IDX feat, int chance) bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD); /* Hack -- Choose starting point */ - y = rand_spread(cur_hgt / 2, cur_hgt / 6); - x = rand_spread(cur_wid / 2, cur_wid / 6); + y = rand_spread(current_floor_ptr->height / 2, current_floor_ptr->height / 6); + x = rand_spread(current_floor_ptr->width / 2, current_floor_ptr->width / 6); /* Choose a random compass direction */ dir = randint0(8); @@ -448,8 +448,8 @@ void destroy_level(void) for (n = 0; n < randint1(5); n++) { /* Pick an epi-center */ - x1 = rand_range(5, cur_wid - 1 - 5); - y1 = rand_range(5, cur_hgt - 1 - 5); + x1 = rand_range(5, current_floor_ptr->width - 1 - 5); + y1 = rand_range(5, current_floor_ptr->height - 1 - 5); (void)destroy_area(y1, x1, 15, TRUE); } diff --git a/src/grid.c b/src/grid.c index f31b7afb2..f54a1ba7d 100644 --- a/src/grid.c +++ b/src/grid.c @@ -51,8 +51,8 @@ bool new_player_spot(void) while (max_attempts--) { /* Pick a legal spot */ - y = (POSITION)rand_range(1, cur_hgt - 2); - x = (POSITION)rand_range(1, cur_wid - 2); + y = (POSITION)rand_range(1, current_floor_ptr->height - 2); + x = (POSITION)rand_range(1, current_floor_ptr->width - 2); g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -2411,9 +2411,9 @@ void prt_map(void) /* Get bounds */ xmin = (0 < panel_col_min) ? panel_col_min : 0; - xmax = (cur_wid - 1 > panel_col_max) ? panel_col_max : cur_wid - 1; + xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1; ymin = (0 < panel_row_min) ? panel_row_min : 0; - ymax = (cur_hgt - 1 > panel_row_max) ? panel_row_max : cur_hgt - 1; + ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1; /* Bottom section of screen */ for (y = 1; y <= ymin - panel_row_prt; y++) @@ -2664,8 +2664,8 @@ void display_map(int *cy, int *cx) wid -= 14; if (use_bigtile) wid /= 2; - yrat = (cur_hgt + hgt - 1) / hgt; - xrat = (cur_wid + wid - 1) / wid; + yrat = (current_floor_ptr->height + hgt - 1) / hgt; + xrat = (current_floor_ptr->width + wid - 1) / wid; /* Disable lighting effects */ view_special_lite = FALSE; @@ -2703,19 +2703,19 @@ void display_map(int *cy, int *cx) } /* Allocate the maps */ - C_MAKE(bigma, (cur_hgt + 2), TERM_COLOR *); - C_MAKE(bigmc, (cur_hgt + 2), char_ptr); - C_MAKE(bigmp, (cur_hgt + 2), byte_ptr); + C_MAKE(bigma, (current_floor_ptr->height + 2), TERM_COLOR *); + C_MAKE(bigmc, (current_floor_ptr->height + 2), char_ptr); + C_MAKE(bigmp, (current_floor_ptr->height + 2), byte_ptr); /* Allocate and wipe each line map */ - for (y = 0; y < (cur_hgt + 2); y++) + for (y = 0; y < (current_floor_ptr->height + 2); y++) { /* Allocate one row each array */ - C_MAKE(bigma[y], (cur_wid + 2), TERM_COLOR); - C_MAKE(bigmc[y], (cur_wid + 2), char); - C_MAKE(bigmp[y], (cur_wid + 2), byte); + C_MAKE(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR); + C_MAKE(bigmc[y], (current_floor_ptr->width + 2), char); + C_MAKE(bigmp[y], (current_floor_ptr->width + 2), byte); - for (x = 0; x < cur_wid + 2; ++x) + for (x = 0; x < current_floor_ptr->width + 2; ++x) { /* Nothing here */ bigma[y][x] = TERM_WHITE; @@ -2727,9 +2727,9 @@ void display_map(int *cy, int *cx) } /* Fill in the map */ - for (i = 0; i < cur_wid; ++i) + for (i = 0; i < current_floor_ptr->width; ++i) { - for (j = 0; j < cur_hgt; ++j) + for (j = 0; j < current_floor_ptr->height; ++j) { x = i / xrat + 1; y = j / yrat + 1; @@ -2760,9 +2760,9 @@ void display_map(int *cy, int *cx) } } - for (j = 0; j < cur_hgt; ++j) + for (j = 0; j < current_floor_ptr->height; ++j) { - for (i = 0; i < cur_wid; ++i) + for (i = 0; i < current_floor_ptr->width; ++i) { x = i / xrat + 1; y = j / yrat + 1; @@ -2898,18 +2898,18 @@ void display_map(int *cy, int *cx) C_KILL(object_autopick_yx, (hgt + 2), object_type **); /* Free each line map */ - for (y = 0; y < (cur_hgt + 2); y++) + for (y = 0; y < (current_floor_ptr->height + 2); y++) { /* Free one row each array */ - C_KILL(bigma[y], (cur_wid + 2), TERM_COLOR); - C_KILL(bigmc[y], (cur_wid + 2), SYMBOL_CODE); - C_KILL(bigmp[y], (cur_wid + 2), byte); + C_KILL(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR); + C_KILL(bigmc[y], (current_floor_ptr->width + 2), SYMBOL_CODE); + C_KILL(bigmp[y], (current_floor_ptr->width + 2), byte); } /* Free each line map */ - C_KILL(bigma, (cur_hgt + 2), TERM_COLOR *); - C_KILL(bigmc, (cur_hgt + 2), char_ptr); - C_KILL(bigmp, (cur_hgt + 2), byte_ptr); + C_KILL(bigma, (current_floor_ptr->height + 2), TERM_COLOR *); + C_KILL(bigmc, (current_floor_ptr->height + 2), char_ptr); + C_KILL(bigmp, (current_floor_ptr->height + 2), byte_ptr); } @@ -3441,7 +3441,7 @@ void update_lite(void) /* Maximal south */ max_y = p_ptr->y + p; - if (max_y > cur_hgt - 1) max_y = cur_hgt - 1; + if (max_y > current_floor_ptr->height - 1) max_y = current_floor_ptr->height - 1; /* Maximal west */ min_x = p_ptr->x - p; @@ -3449,7 +3449,7 @@ void update_lite(void) /* Maximal east */ max_x = p_ptr->x + p; - if (max_x > cur_wid - 1) max_x = cur_wid - 1; + if (max_x > current_floor_ptr->width - 1) max_x = current_floor_ptr->width - 1; /* Scan the maximal box */ for (y = min_y; y <= max_y; y++) @@ -4297,8 +4297,8 @@ void update_view(void) int full, over; - POSITION y_max = cur_hgt - 1; - POSITION x_max = cur_wid - 1; + POSITION y_max = current_floor_ptr->height - 1; + POSITION x_max = current_floor_ptr->width - 1; grid_type *g_ptr; @@ -4781,9 +4781,9 @@ void forget_flow(void) POSITION x, y; /* Check the entire dungeon */ - 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++) { /* Forget the old data */ current_floor_ptr->grid_array[y][x].dist = 0; @@ -4835,9 +4835,9 @@ void update_flow(void) } /* Erase all of the current flow information */ - 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].cost = 0; current_floor_ptr->grid_array[y][x].dist = 0; @@ -4947,9 +4947,9 @@ void update_smell(void) if (++scent_when == 254) { /* Scan the entire dungeon */ - 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++) { int w = current_floor_ptr->grid_array[y][x].when; current_floor_ptr->grid_array[y][x].when = (w > 128) ? (w - 128) : 0; @@ -5007,9 +5007,9 @@ void map_area(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan that area */ - 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 (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; @@ -5599,9 +5599,9 @@ void glow_deep_lava_and_bldg(void) /* Not in the darkness dungeon */ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) return; - 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++) { g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/init1.c b/src/init1.c index cbfd5f573..e4d33c2ea 100644 --- a/src/init1.c +++ b/src/init1.c @@ -4273,15 +4273,15 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Hack - Set the dungeon size */ panels_y = (*y / SCREEN_HGT); if (*y % SCREEN_HGT) panels_y++; - cur_hgt = panels_y * SCREEN_HGT; + current_floor_ptr->height = panels_y * SCREEN_HGT; panels_x = (*x / SCREEN_WID); if (*x % SCREEN_WID) panels_x++; - cur_wid = panels_x * SCREEN_WID; + current_floor_ptr->width = panels_x * 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; /* Place player in a quest level */ if (p_ptr->inside_quest) diff --git a/src/load.c b/src/load.c index 7e2dfd17e..70a83ea4f 100644 --- a/src/load.c +++ b/src/load.c @@ -2579,9 +2579,9 @@ static errr rd_dungeon_old(void) p_ptr->x = (POSITION)tmp16s; if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;} rd_s16b(&tmp16s); - cur_hgt = (POSITION)tmp16s; + current_floor_ptr->height = (POSITION)tmp16s; rd_s16b(&tmp16s); - cur_wid = (POSITION)tmp16s; + current_floor_ptr->width = (POSITION)tmp16s; rd_s16b(&tmp16s); /* max_panel_rows */ rd_s16b(&tmp16s); /* max_panel_cols */ @@ -2590,8 +2590,8 @@ static errr rd_dungeon_old(void) #endif /* Maximal size */ - ymax = cur_hgt; - xmax = cur_wid; + ymax = current_floor_ptr->height; + xmax = current_floor_ptr->width; /*** Run length decoding ***/ @@ -3040,9 +3040,9 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) p_ptr->x = (POSITION)tmp16u; rd_s16b(&tmp16s); - cur_hgt = (POSITION)tmp16s; + current_floor_ptr->height = (POSITION)tmp16s; rd_s16b(&tmp16s); - cur_wid = (POSITION)tmp16s; + current_floor_ptr->width = (POSITION)tmp16s; rd_byte(&p_ptr->feeling); @@ -3080,8 +3080,8 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) } /* Maximal size */ - ymax = cur_hgt; - xmax = cur_wid; + ymax = current_floor_ptr->height; + xmax = current_floor_ptr->width; /*** Run length decoding ***/ diff --git a/src/main-win.c b/src/main-win.c index a848e2a0a..5a62975e0 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -3176,8 +3176,8 @@ static void windows_map(void) { min_x = 0; min_y = 0; - max_x = cur_wid; - max_y = cur_hgt; + max_x = current_floor_ptr->width; + max_y = current_floor_ptr->height; } /* Draw the map */ diff --git a/src/mind.c b/src/mind.c index 45fe8785e..f27470b0a 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1287,8 +1287,8 @@ static int number_of_mirrors(void) { POSITION x, y; int val = 0; - for (x = 0; x < cur_wid; x++) { - for (y = 0; y < cur_hgt; y++) { + for (x = 0; x < current_floor_ptr->width; x++) { + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) val++; } } @@ -1370,8 +1370,8 @@ static bool cast_mirror_spell(int spell) break; /* mirror sleeping */ case 9: - for (x = 0; x < cur_wid; x++) { - for (y = 0; y < cur_hgt; y++) { + for (x = 0; x < current_floor_ptr->width; x++) { + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1); } diff --git a/src/monster2.c b/src/monster2.c index 11ec6de2e..2f4cf0370 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -3002,8 +3002,8 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I number_mon = 0; /* Count all quest monsters */ - for (i2 = 0; i2 < cur_wid; ++i2) - for (j2 = 0; j2 < cur_hgt; j2++) + 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) number_mon++; @@ -3743,8 +3743,8 @@ bool alloc_guardian(bool def_val) while (try_count) { /* Get a random spot */ - oy = randint1(cur_hgt - 4) + 2; - ox = randint1(cur_wid - 4) + 2; + oy = randint1(current_floor_ptr->height - 4) + 2; + ox = randint1(current_floor_ptr->width - 4) + 2; /* Is it a good spot ? */ if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(current_floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0)) @@ -3786,8 +3786,8 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode) while (attempts_left--) { /* Pick a location */ - y = randint0(cur_hgt); - x = randint0(cur_wid); + y = randint0(current_floor_ptr->height); + x = randint0(current_floor_ptr->width); /* Require empty floor grid (was "naked") */ if (current_floor_ptr->dun_level) diff --git a/src/object2.c b/src/object2.c index eacbdae57..3710ce6ef 100644 --- a/src/object2.c +++ b/src/object2.c @@ -5089,9 +5089,9 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION { int candidates = 0, pick; - for (ty = 1; ty < cur_hgt - 1; ty++) + for (ty = 1; ty < current_floor_ptr->height - 1; ty++) { - for (tx = 1; tx < cur_wid - 1; tx++) + for (tx = 1; tx < current_floor_ptr->width - 1; tx++) { /* A valid space found */ if (cave_drop_bold(ty, tx)) candidates++; @@ -5128,9 +5128,9 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION /* Choose a random one */ pick = randint1(candidates); - for (ty = 1; ty < cur_hgt - 1; ty++) + for (ty = 1; ty < current_floor_ptr->height - 1; ty++) { - for (tx = 1; tx < cur_wid - 1; tx++) + for (tx = 1; tx < current_floor_ptr->width - 1; tx++) { if (cave_drop_bold(ty, tx)) { diff --git a/src/player-move.c b/src/player-move.c index 768b7ac46..8509dcb91 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -1138,8 +1138,8 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) { p_ptr->wilderness_y--; p_ptr->wilderness_x--; - p_ptr->oldpy = cur_hgt - 2; - p_ptr->oldpx = cur_wid - 2; + p_ptr->oldpy = current_floor_ptr->height - 2; + p_ptr->oldpx = current_floor_ptr->width - 2; ambush_flag = FALSE; } @@ -1147,7 +1147,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) { p_ptr->wilderness_y--; p_ptr->wilderness_x++; - p_ptr->oldpy = cur_hgt - 2; + p_ptr->oldpy = current_floor_ptr->height - 2; p_ptr->oldpx = 1; ambush_flag = FALSE; } @@ -1157,7 +1157,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) p_ptr->wilderness_y++; p_ptr->wilderness_x--; p_ptr->oldpy = 1; - p_ptr->oldpx = cur_wid - 2; + p_ptr->oldpx = current_floor_ptr->width - 2; ambush_flag = FALSE; } @@ -1173,7 +1173,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) else if (y == 0) { p_ptr->wilderness_y--; - p_ptr->oldpy = cur_hgt - 2; + p_ptr->oldpy = current_floor_ptr->height - 2; p_ptr->oldpx = x; ambush_flag = FALSE; } @@ -1189,7 +1189,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) else if (x == 0) { p_ptr->wilderness_x--; - p_ptr->oldpx = cur_wid - 2; + p_ptr->oldpx = current_floor_ptr->width - 2; p_ptr->oldpy = y; ambush_flag = FALSE; } @@ -2278,9 +2278,9 @@ void forget_travel_flow(void) { POSITION x, y; /* Check the entire dungeon / Forget the old data */ - 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++) { travel.cost[y][x] = MAX_SHORT; diff --git a/src/rooms-city.c b/src/rooms-city.c index b3536ee10..091d795c1 100644 --- a/src/rooms-city.c +++ b/src/rooms-city.c @@ -201,9 +201,9 @@ bool build_type16(void) bool prevent_bm = FALSE; /* Hack -- If already exist black market, prevent building */ - for (y = 0; (y < cur_hgt) && !prevent_bm; y++) + for (y = 0; (y < current_floor_ptr->height) && !prevent_bm; y++) { - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { if (current_floor_ptr->grid_array[y][x].feat == FF_STORE) { diff --git a/src/rooms-vault.c b/src/rooms-vault.c index 18a1da19d..0eac51334 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -656,7 +656,7 @@ bool build_type7(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > cur_hgt - 2) + if (x + 2 > current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; @@ -736,7 +736,7 @@ bool build_type8(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > cur_hgt - 2) + if (x + 2 > current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; @@ -1258,7 +1258,7 @@ bool build_type17(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > cur_hgt - 2) + if (x + 2 > current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; diff --git a/src/rooms.c b/src/rooms.c index 91b8841d3..c30e79f92 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -1145,8 +1145,8 @@ void build_cavern(void) if ((current_floor_ptr->dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; /* Make a current_floor_ptr->grid_array the size of the dungeon */ - xsize = cur_wid - 1; - ysize = cur_hgt - 1; + xsize = current_floor_ptr->width - 1; + ysize = current_floor_ptr->height - 1; x0 = xsize / 2; y0 = ysize / 2; @@ -1335,8 +1335,8 @@ void build_lake(int type) } /* Make the size of the dungeon */ - xsize = cur_wid - 1; - ysize = cur_hgt - 1; + xsize = current_floor_ptr->width - 1; + ysize = current_floor_ptr->height - 1; x0 = xsize / 2; y0 = ysize / 2; @@ -2126,7 +2126,7 @@ bool generate_rooms(void) int total_prob; int prob_list[ROOM_T_MAX]; int rooms_built = 0; - int area_size = 100 * (cur_hgt*cur_wid) / (MAX_HGT*MAX_WID); + int area_size = 100 * (current_floor_ptr->height*current_floor_ptr->width) / (MAX_HGT*MAX_WID); int level_index = MIN(10, div_round(current_floor_ptr->dun_level, 10)); /* Number of each type of room on this level */ diff --git a/src/save.c b/src/save.c index 61e06fc86..7719d332b 100644 --- a/src/save.c +++ b/src/save.c @@ -943,8 +943,8 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) wr_u16b((s16b)num_repro); wr_u16b((u16b)p_ptr->y); wr_u16b((u16b)p_ptr->x); - wr_u16b((u16b)cur_hgt); - wr_u16b((u16b)cur_wid); + wr_u16b((u16b)current_floor_ptr->height); + wr_u16b((u16b)current_floor_ptr->width); wr_byte(p_ptr->feeling); @@ -969,9 +969,9 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) C_MAKE(templates, max_num_temp, cave_template_type); /* Extract template 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -1049,9 +1049,9 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) prev_u16b = 0; /* Dump 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; diff --git a/src/spells-floor.c b/src/spells-floor.c index 334403b40..9dc3abe66 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -40,10 +40,10 @@ void wiz_lite(bool ninja) } /* Scan all normal grids */ - for (y = 1; y < cur_hgt - 1; y++) + for (y = 1; y < current_floor_ptr->height - 1; y++) { /* Scan all normal grids */ - for (x = 1; x < cur_wid - 1; x++) + for (x = 1; x < current_floor_ptr->width - 1; x++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -115,9 +115,9 @@ void wiz_dark(void) POSITION y, x; /* Forget every grid */ - 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++) { grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -128,17 +128,17 @@ void wiz_dark(void) } /* Forget every grid on horizontal edge */ - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK); - current_floor_ptr->grid_array[cur_hgt - 1][x].info &= ~(CAVE_MARK); + current_floor_ptr->grid_array[current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK); } /* Forget every grid on vertical edge */ - for (y = 1; y < (cur_hgt - 1); y++) + for (y = 1; y < (current_floor_ptr->height - 1); y++) { current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK); - current_floor_ptr->grid_array[y][cur_wid - 1].info &= ~(CAVE_MARK); + current_floor_ptr->grid_array[y][current_floor_ptr->width - 1].info &= ~(CAVE_MARK); } /* Forget all objects */ diff --git a/src/spells1.c b/src/spells1.c index 283061841..f368d7e5c 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -60,9 +60,9 @@ static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSIT POSITION x, y; int num; - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < cur_hgt; y++) + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { mirror_y[mirror_num] = y; @@ -6486,9 +6486,9 @@ bool binding_field(HIT_POINT dam) monster_target_y = p_ptr->y; monster_target_x = p_ptr->x; - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < cur_hgt; y++) + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE && @@ -6620,9 +6620,9 @@ void seal_of_mirror(HIT_POINT dam) { POSITION x, y; - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < cur_hgt; y++) + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { diff --git a/src/spells2.c b/src/spells2.c index 152609812..e53f27519 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -45,9 +45,9 @@ static bool detect_feat_flag(POSITION range, int flag, bool known) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan the current panel */ - 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++) { int dist = distance(p_ptr->y, p_ptr->x, y, x); if (dist > range) continue; @@ -3864,9 +3864,9 @@ void remove_all_mirrors(bool explode) { POSITION x, y; - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < cur_hgt; y++) + for (y = 0; y < current_floor_ptr->height; y++) { if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { diff --git a/src/spells3.c b/src/spells3.c index b5c7eddfa..48505ba45 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -263,9 +263,9 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) int min, pick, i; int left = MAX(1, p_ptr->x - dis); - int right = MIN(cur_wid - 2, p_ptr->x + dis); + int right = MIN(current_floor_ptr->width - 2, p_ptr->x + dis); int top = MAX(1, p_ptr->y - dis); - int bottom = MIN(cur_hgt - 2, p_ptr->y + dis); + int bottom = MIN(current_floor_ptr->height - 2, p_ptr->y + dis); if (p_ptr->wild_mode) return FALSE; @@ -1390,9 +1390,9 @@ static bool vanish_dungeon(void) } /* Scan all normal grids */ - 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++) { g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -1424,7 +1424,7 @@ static bool vanish_dungeon(void) } /* Special boundary walls -- Top and bottom */ - for (x = 0; x < cur_wid; x++) + for (x = 0; x < current_floor_ptr->width; x++) { g_ptr = ¤t_floor_ptr->grid_array[0][x]; f_ptr = &f_info[g_ptr->mimic]; @@ -1441,7 +1441,7 @@ static bool vanish_dungeon(void) if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - g_ptr = ¤t_floor_ptr->grid_array[cur_hgt - 1][x]; + g_ptr = ¤t_floor_ptr->grid_array[current_floor_ptr->height - 1][x]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1458,7 +1458,7 @@ static bool vanish_dungeon(void) } /* Special boundary walls -- Left and right */ - for (y = 1; y < (cur_hgt - 1); y++) + for (y = 1; y < (current_floor_ptr->height - 1); y++) { g_ptr = ¤t_floor_ptr->grid_array[y][0]; f_ptr = &f_info[g_ptr->mimic]; @@ -1475,7 +1475,7 @@ static bool vanish_dungeon(void) if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - g_ptr = ¤t_floor_ptr->grid_array[y][cur_wid - 1]; + g_ptr = ¤t_floor_ptr->grid_array[y][current_floor_ptr->width - 1]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ diff --git a/src/types.h b/src/types.h index 64455e7e9..c92f06559 100644 --- a/src/types.h +++ b/src/types.h @@ -1878,4 +1878,6 @@ typedef struct { grid_type *grid_array[MAX_HGT]; DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */ DEPTH base_level; + POSITION width; /* Current dungeon width */ + POSITION height; /* Current dungeon height */ } floor_type; \ No newline at end of file diff --git a/src/variable.c b/src/variable.c index 2015e504a..8670d3248 100644 --- a/src/variable.c +++ b/src/variable.c @@ -111,8 +111,6 @@ bool msg_flag; /* Used in msg_print() for "buffering" */ s16b running; /* Current counter for running, if any */ GAME_TURN resting; /* Current counter for resting, if any */ -POSITION cur_hgt; /* Current dungeon height */ -POSITION cur_wid; /* Current dungeon width */ MONSTER_NUMBER num_repro; /*!< Current reproducer count */ DEPTH object_level; /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */ DEPTH monster_level; /*!< モンスターの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */ diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 2172aea9f..24d0f0fa4 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -2435,8 +2435,8 @@ void resize_map(void) panel_col_max = 0; /* Reset the panels */ - panel_row_min = cur_hgt; - panel_col_min = cur_wid; + panel_row_min = current_floor_ptr->height; + panel_col_min = current_floor_ptr->width; verify_panel(); @@ -2497,11 +2497,11 @@ bool change_panel(POSITION dy, POSITION dx) x = panel_col_min + dx * wid / 2; /* Verify the row */ - if (y > cur_hgt - hgt) y = cur_hgt - hgt; + if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt; if (y < 0) y = 0; /* Verify the col */ - if (x > cur_wid - wid) x = cur_wid - wid; + if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid; if (x < 0) x = 0; /* Handle "changes" */ diff --git a/src/wild.c b/src/wild.c index 9adb0ca04..d0af4decb 100644 --- a/src/wild.c +++ b/src/wild.c @@ -424,8 +424,8 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) /* Hack -- Induce consistant flavors */ Rand_state_set(wilderness[y][x].seed); - dy = rand_range(6, cur_hgt - 6); - dx = rand_range(6, cur_wid - 6); + dy = rand_range(6, current_floor_ptr->height - 6); + dx = rand_range(6, current_floor_ptr->width - 6); current_floor_ptr->grid_array[dy][dx].feat = feat_entrance; current_floor_ptr->grid_array[dy][dx].special = wilderness[y][x].entrance; @@ -455,12 +455,12 @@ void wilderness_gen(void) feature_type *f_ptr; /* Big town */ - 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; /* Init the wilderness */ @@ -564,9 +564,9 @@ void wilderness_gen(void) current_floor_ptr->grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east; /* Light up or darken the area */ - 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++) { g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -610,9 +610,9 @@ void wilderness_gen(void) if (p_ptr->teleport_town) { - 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++) { g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -635,9 +635,9 @@ void wilderness_gen(void) else if (p_ptr->leaving_dungeon) { - 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++) { g_ptr = ¤t_floor_ptr->grid_array[y][x]; @@ -725,15 +725,15 @@ void wilderness_gen_small(void) current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK); } - cur_hgt = (s16b) max_wild_y; - cur_wid = (s16b) max_wild_x; + current_floor_ptr->height = (s16b) max_wild_y; + current_floor_ptr->width = (s16b) max_wild_x; - if (cur_hgt > MAX_HGT) cur_hgt = MAX_HGT; - if (cur_wid > MAX_WID) cur_wid = MAX_WID; + if (current_floor_ptr->height > MAX_HGT) current_floor_ptr->height = MAX_HGT; + if (current_floor_ptr->width > MAX_WID) 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; /* Place the player */ p_ptr->x = p_ptr->wilderness_x; diff --git a/src/wizard2.c b/src/wizard2.c index 79d545936..a2b9f61c8 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1913,9 +1913,9 @@ void do_cmd_debug(void) /* Make every dungeon square "known" to test streamers -KMW- */ case 'u': - 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 | CAVE_MARK); } diff --git a/src/xtra2.c b/src/xtra2.c index d510ea17b..e68406f42 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -299,8 +299,8 @@ void verify_panel(void) get_screen_size(&wid, &hgt); - max_prow_min = cur_hgt - hgt; - max_pcol_min = cur_wid - wid; + max_prow_min = current_floor_ptr->height - hgt; + max_pcol_min = current_floor_ptr->width - wid; /* Bounds checking */ if (max_prow_min < 0) max_prow_min = 0; @@ -793,9 +793,9 @@ static void target_set_prepare(BIT_FLAGS mode) { /* Inner range */ min_hgt = MAX((p_ptr->y - MAX_RANGE), 0); - max_hgt = MIN((p_ptr->y + MAX_RANGE), cur_hgt - 1); + max_hgt = MIN((p_ptr->y + MAX_RANGE), current_floor_ptr->height - 1); min_wid = MAX((p_ptr->x - MAX_RANGE), 0); - max_wid = MIN((p_ptr->x + MAX_RANGE), cur_wid - 1); + max_wid = MIN((p_ptr->x + MAX_RANGE), current_floor_ptr->width - 1); } else /* not targetting */ { @@ -1746,11 +1746,11 @@ bool target_set(BIT_FLAGS mode) } /* Slide into legality */ - if (x >= cur_wid-1) x = cur_wid - 2; + if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= cur_hgt-1) y = cur_hgt- 2; + if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; else if (y <= 0) y = 1; } } @@ -1920,11 +1920,11 @@ bool target_set(BIT_FLAGS mode) } /* Slide into legality */ - if (x >= cur_wid-1) x = cur_wid - 2; + if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= cur_hgt-1) y = cur_hgt- 2; + if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; else if (y <= 0) y = 1; } } @@ -2410,9 +2410,9 @@ static void tgt_pt_prepare(void) if (!expand_list) return; /* Scan the current panel */ - for (y = 1; y < cur_hgt; y++) + for (y = 1; y < current_floor_ptr->height; y++) { - for (x = 1; x < cur_wid; x++) + for (x = 1; x < current_floor_ptr->width; x++) { /* Require "interesting" contents */ if (!tgt_pt_accept(y, x)) continue; @@ -2579,11 +2579,11 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr) } /* Slide into legality */ - if (x >= cur_wid-1) x = cur_wid - 2; + if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= cur_hgt-1) y = cur_hgt- 2; + if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; else if (y <= 0) y = 1; } -- 2.11.0