From cba1032df6f3965c9ea8ad2ae061562348f4dad2 Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 27 Feb 2019 00:34:11 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38993=20floor=5Ftype=20=E6=A7=8B?= =?utf8?q?=E9=80=A0=E4=BD=93=E4=BD=9C=E6=88=90=E3=80=82=20/=20Create=20flo?= =?utf8?q?or=5Ftype=20structure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 2 +- src/bldg.c | 6 +- src/cmd-pet.c | 12 +-- src/cmd2.c | 54 ++++++------- src/cmd4.c | 2 +- src/defines.h | 32 ++++---- src/dungeon.c | 40 +++++----- src/effects.c | 2 +- src/externs.h | 2 +- src/floor-events.c | 10 +-- src/floor-generate.c | 110 +++++++++++++------------- src/floor-save.c | 34 ++++----- src/floor-streams.c | 14 ++-- src/grid.c | 180 +++++++++++++++++++++---------------------- src/grid.h | 46 +++++------ src/init1.c | 6 +- src/init2.c | 6 +- src/load.c | 52 ++++++------- src/mane.c | 8 +- src/melee1.c | 8 +- src/mind.c | 30 ++++---- src/monster-process.c | 48 ++++++------ src/monster1.c | 4 +- src/monster2.c | 24 +++--- src/mspells1.c | 12 +-- src/mspells2.c | 6 +- src/mspells3.c | 8 +- src/mspells4.c | 2 +- src/mutation.c | 4 +- src/object1.c | 12 +-- src/object2.c | 20 ++--- src/player-move.c | 52 ++++++------- src/player-status.c | 10 +-- src/projection.c | 6 +- src/quest.c | 2 +- src/realm-hex.c | 4 +- src/realm-hissatsu.c | 58 +++++++------- src/rooms-city.c | 6 +- src/rooms-fractal.c | 2 +- src/rooms-normal.c | 162 +++++++++++++++++++-------------------- src/rooms-pitnest.c | 64 ++++++++-------- src/rooms-special.c | 44 +++++------ src/rooms-trap.c | 12 +-- src/rooms-vault.c | 36 ++++----- src/rooms.c | 208 +++++++++++++++++++++++++------------------------- src/rooms.h | 2 +- src/save.c | 16 ++-- src/shoot.c | 22 +++--- src/spells-floor.c | 16 ++-- src/spells-object.c | 2 +- src/spells-status.c | 4 +- src/spells1.c | 54 ++++++------- src/spells2.c | 84 ++++++++++---------- src/spells3.c | 70 ++++++++--------- src/store.c | 2 +- src/trap.c | 6 +- src/types.h | 10 ++- src/variable.c | 16 ++-- src/view-mainwindow.c | 2 +- src/wild.c | 130 +++++++++++++++---------------- src/wizard2.c | 4 +- src/xtra2.c | 22 +++--- 62 files changed, 965 insertions(+), 959 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index 86ce03cdd..56fee637a 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -1658,7 +1658,7 @@ void autopick_delayed_alter(void) autopick_delayed_alter_aux(item); /* Scan the pile of objects */ - item = grid_array[p_ptr->y][p_ptr->x].o_idx; + item = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; while (item) { OBJECT_IDX next = o_list[item].next_o_idx; diff --git a/src/bldg.c b/src/bldg.c index f37f953ee..db2f4be7b 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -2079,7 +2079,7 @@ static void castle_quest(void) clear_bldg(4, 18); /* Current quest of the building */ - q_index = grid_array[p_ptr->y][p_ptr->x].special; + q_index = current_floor->grid_array[p_ptr->y][p_ptr->x].special; /* Is there a quest available at the building? */ if (!q_index) @@ -4214,7 +4214,7 @@ void do_cmd_quest(void) leave_quest_check(); if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1; - p_ptr->inside_quest = grid_array[p_ptr->y][p_ptr->x].special; + p_ptr->inside_quest = current_floor->grid_array[p_ptr->y][p_ptr->x].special; p_ptr->leaving = TRUE; } @@ -4242,7 +4242,7 @@ void do_cmd_bldg(void) return; } - which = f_info[grid_array[p_ptr->y][p_ptr->x].feat].subtype; + which = f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat].subtype; bldg = &building[which]; diff --git a/src/cmd-pet.c b/src/cmd-pet.c index 982780f57..49f9f1183 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -315,7 +315,7 @@ bool do_riding(bool force) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (p_ptr->special_defense & KATA_MUSOU) set_action(ACTION_NONE); @@ -442,9 +442,9 @@ static void do_name_pet(void) } target_pet = old_target_pet; - if (grid_array[target_row][target_col].m_idx) + if (current_floor->grid_array[target_row][target_col].m_idx) { - m_ptr = &m_list[grid_array[target_row][target_col].m_idx]; + m_ptr = &m_list[current_floor->grid_array[target_row][target_col].m_idx]; if (!is_pet(m_ptr)) { @@ -877,10 +877,10 @@ void do_cmd_pet(void) if (!target_set(TARGET_KILL)) pet_t_m_idx = 0; else { - grid_type *g_ptr = &grid_array[target_row][target_col]; + grid_type *g_ptr = ¤t_floor->grid_array[target_row][target_col]; if (g_ptr->m_idx && (m_list[g_ptr->m_idx].ml)) { - pet_t_m_idx = grid_array[target_row][target_col].m_idx; + pet_t_m_idx = current_floor->grid_array[target_row][target_col].m_idx; p_ptr->pet_follow_distance = PET_DESTROY_DIST; } else pet_t_m_idx = 0; @@ -1093,7 +1093,7 @@ bool rakuba(HIT_POINT dam, bool force) y = p_ptr->y + ddy_ddd[i]; x = p_ptr->x + ddx_ddd[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (g_ptr->m_idx) continue; diff --git a/src/cmd2.c b/src/cmd2.c index 1200fe92f..bfb6664d5 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -140,7 +140,7 @@ void do_cmd_go_up(void) bool go_up = FALSE; /* Player grid */ - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int up_num = 0; @@ -284,7 +284,7 @@ void do_cmd_go_up(void) void do_cmd_go_down(void) { /* Player grid */ - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool fall_trap = FALSE; @@ -481,7 +481,7 @@ void do_cmd_search(void) */ static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Scan all objects in the grid */ @@ -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 grid_array */ - g_ptr = &grid_array[yy][xx]; + /* Get the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Must have knowledge */ if (!(g_ptr->info & (CAVE_MARK))) 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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Must be a closed door */ @@ -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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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 = &grid_array[y][x]; + g_ptr = ¤t_floor->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) || !grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break; + if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break; } /* The player can see the (on screen) missile */ @@ -2577,9 +2577,9 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) cur_dis++; /* Monster here, Try to hit it */ - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[g_ptr->m_idx]; /* Check the visibility */ @@ -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[grid_array[y][x].m_idx]; + monster_type *m_ptr = &m_list[current_floor->grid_array[y][x].m_idx]; /* ToDo (Robert): fix the invulnerability */ - if (grid_array[y][x].m_idx && - is_friendly(&m_list[grid_array[y][x].m_idx]) && + if (current_floor->grid_array[y][x].m_idx && + is_friendly(&m_list[current_floor->grid_array[y][x].m_idx]) && !MON_INVULNER(m_ptr)) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0); + monster_desc(m_name, &m_list[current_floor->grid_array[y][x].m_idx], 0); msg_format(_("%sは怒った!", "%^s gets angry!"), m_name); - set_hostile(&m_list[grid_array[y][x].m_idx]); + set_hostile(&m_list[current_floor->grid_array[y][x].m_idx]); } } do_drop = FALSE; diff --git a/src/cmd4.c b/src/cmd4.c index 477e804c1..763469ea1 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5274,7 +5274,7 @@ static void do_cmd_knowledge_artifacts(void) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; diff --git a/src/defines.h b/src/defines.h index 9ba22b4a1..e956f1c61 100644 --- a/src/defines.h +++ b/src/defines.h @@ -203,14 +203,14 @@ #define MAX_SAVED_FLOORS 20 /*!< 保存フロアの最大数 / Maximum number of saved floors. */ /*! - * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "grid_array.c") + * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "current_floor->grid_array.c") * @details Note that the "lite radius" will NEVER exceed 14, and we would * never require more than 581 entries in the array for circular "lite". */ #define LITE_MAX 600 /*! - * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see "grid_array.c") + * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see "current_floor->grid_array.c") * @details Note that the "view radius" will NEVER exceed 20, monster illumination * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal, * we would never require more than 1520 entries in the array. @@ -218,14 +218,14 @@ #define MON_LITE_MAX 1536 /*! - * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "grid_array.c") + * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "current_floor->grid_array.c") * @details Note that the "view radius" will NEVER exceed 20, and even if the "view" * was octagonal, we would never require more than 1520 entries in the array. */ #define VIEW_MAX 1536 /*! - * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "grid_array.c") + * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "current_floor->grid_array.c") * @details We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning * of "update_view()" and "update_lite()". We must also be as large as the * largest illuminatable room, but no room is larger than 800 grids. We @@ -235,7 +235,7 @@ #define TEMP_MAX 2298 /*! - * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "grid_array.c") + * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "current_floor->grid_array.c") * @details We must be large for proper functioning of delayed redrawing. * We must also be as large as two times of the largest view area. * Note that maximum view grids are 1149 entries. @@ -1889,7 +1889,7 @@ #define CAVE_MNLT 0x0100 /*!< モンスターの光源によって照らされている / Illuminated by monster */ #define CAVE_MNDK 0x8000 /*!< モンスターの暗源によって暗闇になっている / Darken by monster */ -/* Used only while grid_array generation */ +/* Used only while current_floor->grid_array generation */ #define CAVE_FLOOR 0x0200 /*!< フロア属性のあるマス */ #define CAVE_EXTRA 0x0400 #define CAVE_INNER 0x0800 @@ -1898,7 +1898,7 @@ #define CAVE_VAULT 0x4000 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT) -/* Used only after grid_array generation */ +/* Used only after current_floor->grid_array generation */ #define CAVE_KNOWN 0x0200 /* Directly viewed or map detected flag */ #define CAVE_NOTE 0x0400 /* Flag for delayed visual update (needs note_spot()) */ #define CAVE_REDRAW 0x0800 /* Flag for delayed visual update (needs lite_spot()) */ @@ -3442,11 +3442,11 @@ * Grid based version of "player_bold()" */ #define player_grid(C) \ - ((C) == &grid_array[p_ptr->y][p_ptr->x]) + ((C) == ¤t_floor->grid_array[p_ptr->y][p_ptr->x]) #define cave_have_flag_bold(Y,X,INDEX) \ - (have_flag(f_info[grid_array[(Y)][(X)].feat].flags, (INDEX))) + (have_flag(f_info[current_floor->grid_array[(Y)][(X)].feat].flags, (INDEX))) #define cave_have_flag_grid(C,INDEX) \ @@ -3464,7 +3464,7 @@ * Determine if a "legal" grid supports "los" */ #define cave_los_bold(Y,X) \ - (feat_supports_los(grid_array[(Y)][(X)].feat)) + (feat_supports_los(current_floor->grid_array[(Y)][(X)].feat)) #define cave_los_grid(C) \ (feat_supports_los((C)->feat)) @@ -3480,8 +3480,8 @@ */ #define cave_clean_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_FLOOR) && \ - !(grid_array[Y][X].info & CAVE_OBJECT) && \ - (grid_array[Y][X].o_idx == 0)) + !(current_floor->grid_array[Y][X].info & CAVE_OBJECT) && \ + (current_floor->grid_array[Y][X].o_idx == 0)) /* @@ -3492,7 +3492,7 @@ */ #define cave_drop_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_DROP) && \ - !(grid_array[Y][X].info & CAVE_OBJECT)) + !(current_floor->grid_array[Y][X].info & CAVE_OBJECT)) /* @@ -3505,7 +3505,7 @@ */ #define cave_empty_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_PLACE) && \ - !(grid_array[Y][X].m_idx) && \ + !(current_floor->grid_array[Y][X].m_idx) && \ !player_bold(Y,X)) @@ -3530,7 +3530,7 @@ */ #define cave_naked_bold(Y,X) \ (cave_clean_bold(Y,X) && \ - !(grid_array[Y][X].m_idx) && \ + !(current_floor->grid_array[Y][X].m_idx) && \ !player_bold(Y,X)) @@ -3585,7 +3585,7 @@ * Note the use of comparison to zero to force a "boolean" result */ #define player_has_los_bold(Y,X) \ - (((grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle) + (((current_floor->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle) /* diff --git a/src/dungeon.c b/src/dungeon.c index c88b4d2f5..e12161440 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -617,7 +617,7 @@ static void wreck_the_pattern(void) { int to_ruin = 0; POSITION r_y, r_x; - int pattern_type = f_info[grid_array[p_ptr->y][p_ptr->x].feat].subtype; + int pattern_type = f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat].subtype; if (pattern_type == PATTERN_TILE_WRECKED) { @@ -636,7 +636,7 @@ static void wreck_the_pattern(void) scatter(&r_y, &r_x, p_ptr->y, p_ptr->x, 4, 0); if (pattern_tile(r_y, r_x) && - (f_info[grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) + (f_info[current_floor->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) { cave_set_feat(r_y, r_x, feat_pattern_corrupted); } @@ -661,7 +661,7 @@ static bool pattern_effect(void) wreck_the_pattern(); } - pattern_type = f_info[grid_array[p_ptr->y][p_ptr->x].feat].subtype; + pattern_type = f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat].subtype; switch (pattern_type) { @@ -1372,7 +1372,7 @@ static void process_world_aux_digestion(void) */ static void process_world_aux_hp_and_sp(void) { - feature_type *f_ptr = &f_info[grid_array[p_ptr->y][p_ptr->x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat]; bool cave_no_regen = FALSE; int upkeep_factor = 0; @@ -1439,7 +1439,7 @@ static void process_world_aux_hp_and_sp(void) { if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime()) { - if ((grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((current_floor->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!")); take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1); @@ -1494,11 +1494,11 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("熱で火傷した!", "The heat burns you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sで火傷した!", "The %s burns you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); } @@ -1532,11 +1532,11 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("冷気に覆われた!", "The cold engulfs you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに凍えた!", "The %s frostbites you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); } @@ -1570,11 +1570,11 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("電撃を受けた!", "The electric shocks you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに感電した!", "The %s shocks you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); } @@ -1608,11 +1608,11 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("酸が飛び散った!", "The acid melt you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに溶かされた!", "The %s melts you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); } @@ -1646,12 +1646,12 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("毒気を吸い込んだ!", "The gas poisons you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name), -1); if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1); } else { - concptr name = f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name; msg_format(_("%sに毒された!", "The %s poisons you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3); @@ -2368,7 +2368,7 @@ static void process_world_aux_mutation(void) msg_print(NULL); /* Absorb light from the current possition */ - if ((grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((current_floor->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { hp_player(10); } @@ -3163,7 +3163,7 @@ static int get_monster_crowd_number(MONSTER_IDX m_idx) if (!in_bounds(ay, ax)) continue; /* Count number of monsters */ - if (grid_array[ay][ax].m_idx > 0) count++; + if (current_floor->grid_array[ay][ax].m_idx > 0) count++; } return count; @@ -3409,7 +3409,7 @@ static void process_world(void) for (i2 = 0; i2 < cur_wid; ++i2) for (j2 = 0; j2 < cur_hgt; j2++) { - grid_type *g_ptr = &grid_array[j2][i2]; + grid_type *g_ptr = ¤t_floor->grid_array[j2][i2]; if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding)) { @@ -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[grid_array[y][x].m_idx], 0); + monster_desc(m_name, &m_list[current_floor->grid_array[y][x].m_idx], 0); msg_format(_("%sが釣れた!", "You have a good catch!"), m_name); success = TRUE; } @@ -6143,7 +6143,7 @@ void play_game(bool new_game) /* Handle "quit and save" */ if (!p_ptr->playing && !p_ptr->is_dead) break; - /* Erase the old grid_array */ + /* Erase the old current_floor->grid_array */ wipe_o_list(); if (!p_ptr->is_dead) wipe_m_list(); diff --git a/src/effects.c b/src/effects.c index 83f851074..5061498b6 100644 --- a/src/effects.c +++ b/src/effects.c @@ -1624,7 +1624,7 @@ bool set_superstealth(bool set) { if (!(p_ptr->special_defense & NINJA_S_STEALTH)) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT) + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT) { msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes.")); p_ptr->monlite = p_ptr->old_monlite = TRUE; diff --git a/src/externs.h b/src/externs.h index 0a06fe224..d329140ef 100644 --- a/src/externs.h +++ b/src/externs.h @@ -264,7 +264,7 @@ extern const char angband_term_name[8][16]; extern byte angband_color_table[256][4]; extern const concptr angband_sound_name[SOUND_MAX]; extern const concptr angband_music_basic_name[MUSIC_BASIC_MAX]; -extern grid_type *grid_array[MAX_HGT]; +extern floor_type *current_floor; extern saved_floor_type saved_floors[MAX_SAVED_FLOORS]; extern FLOOR_IDX max_floor_id; extern u32b saved_floor_file_sign; diff --git a/src/floor-events.c b/src/floor-events.c index f1d26876b..8cd104fae 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -13,7 +13,7 @@ void day_break() { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Assume lit */ g_ptr->info |= (CAVE_GLOW); @@ -33,7 +33,7 @@ void day_break() if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -50,7 +50,7 @@ void night_falls(void) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feature_type *f_ptr = &f_info[get_feat_mimic(g_ptr)]; @@ -83,7 +83,7 @@ void night_falls(void) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -101,7 +101,7 @@ MONSTER_NUMBER count_all_hostile_monsters(void) { for (y = 0; y < cur_hgt; ++y) { - MONSTER_IDX m_idx = grid_array[y][x].m_idx; + MONSTER_IDX m_idx = current_floor->grid_array[y][x].m_idx; if (m_idx > 0 && is_hostile(&m_list[m_idx])) { diff --git a/src/floor-generate.c b/src/floor-generate.c index 4bc2f5d13..d943eba3c 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -149,7 +149,7 @@ static int next_to_walls(POSITION y, POSITION x) */ static bool alloc_stairs_aux(POSITION y, POSITION x, int walls) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Require "naked" floor grid */ if (!is_floor_grid(g_ptr)) return FALSE; @@ -262,7 +262,7 @@ static bool alloc_stairs(IDX feat, int num, int walls) if (!pick) break; } - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Clear possible garbage of hidden trap */ g_ptr->mimic = 0; @@ -310,7 +310,7 @@ static void alloc_object(int set, EFFECT_ID typ, int num) y = randint0(cur_hgt); x = randint0(cur_wid); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Require "naked" floor grid */ if (!is_floor_grid(g_ptr) || g_ptr->o_idx || g_ptr->m_idx) continue; @@ -319,7 +319,7 @@ static void alloc_object(int set, EFFECT_ID typ, int num) if (player_bold(y, x)) continue; /* Check for "room" */ - room = (grid_array[y][x].info & CAVE_ROOM) ? TRUE : FALSE; + room = (current_floor->grid_array[y][x].info & CAVE_ROOM) ? TRUE : FALSE; /* Require corridor? */ if ((set == ALLOC_SET_CORR) && room) continue; @@ -344,14 +344,14 @@ static void alloc_object(int set, EFFECT_ID typ, int num) case ALLOC_TYP_RUBBLE: { place_rubble(y, x); - grid_array[y][x].info &= ~(CAVE_FLOOR); + current_floor->grid_array[y][x].info &= ~(CAVE_FLOOR); break; } case ALLOC_TYP_TRAP: { place_trap(y, x); - grid_array[y][x].info &= ~(CAVE_FLOOR); + current_floor->grid_array[y][x].info &= ~(CAVE_FLOOR); break; } @@ -428,7 +428,7 @@ bool place_quest_monsters(void) y = randint0(cur_hgt); x = randint0(cur_wid); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue; @@ -538,7 +538,7 @@ static void gen_caverns_and_lakes(void) { dun->cavern = TRUE; - /* make a large fractal grid_array in the middle of the dungeon */ + /* make a large fractal current_floor->grid_array in the middle of the dungeon */ msg_print_wizard(CHEAT_DUNGEON, _("洞窟を生成。", "Cavern on level.")); build_cavern(); @@ -784,7 +784,7 @@ static bool cave_gen(void) feature_type *f_ptr; y = dun->tunn[j].y; x = dun->tunn[j].x; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; /* Clear previous contents (if not a lake), add a floor */ @@ -803,7 +803,7 @@ static bool cave_gen(void) grid_type *g_ptr; y = dun->wall[j].y; x = dun->wall[j].x; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Clear mimic type */ g_ptr->mimic = 0; @@ -869,15 +869,15 @@ static bool cave_gen(void) /* Special boundary walls -- Top and bottom */ for (x = 0; x < cur_wid; x++) { - place_bound_perm_wall(&grid_array[0][x]); - place_bound_perm_wall(&grid_array[cur_hgt - 1][x]); + place_bound_perm_wall(¤t_floor->grid_array[0][x]); + place_bound_perm_wall(¤t_floor->grid_array[cur_hgt - 1][x]); } /* Special boundary walls -- Left and right */ for (y = 1; y < (cur_hgt - 1); y++) { - place_bound_perm_wall(&grid_array[y][0]); - place_bound_perm_wall(&grid_array[y][cur_wid - 1]); + place_bound_perm_wall(¤t_floor->grid_array[y][0]); + place_bound_perm_wall(¤t_floor->grid_array[y][cur_wid - 1]); } /* Determine the character location */ @@ -944,12 +944,12 @@ static bool cave_gen(void) if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { - /* Lite the grid_array */ + /* Lite the current_floor->grid_array */ for (y = 0; y < cur_hgt; y++) { for (x = 0; x < cur_wid; x++) { - grid_array[y][x].info |= (CAVE_GLOW); + current_floor->grid_array[y][x].info |= (CAVE_GLOW); } } } @@ -977,40 +977,40 @@ static void build_arena(void) for (j = x_left; j <= x_right; j++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (i = y_depth; i >= y_depth - 5; i--) for (j = x_left; j <= x_right; j++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (j = x_left; j <= x_left + 17; j++) for (i = y_height; i <= y_depth; i++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (j = x_right; j >= x_right - 17; j--) for (i = y_height; i <= y_depth; i++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } place_extra_perm_bold(y_height+6, x_left+18); - grid_array[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_depth-6, x_left+18); - grid_array[y_depth-6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_depth-6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_height+6, x_right-18); - grid_array[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_depth-6, x_right-18); - grid_array[y_depth-6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_depth-6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); i = y_height + 5; j = xval; - grid_array[i][j].feat = f_tag_to_index("ARENA_GATE"); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].feat = f_tag_to_index("ARENA_GATE"); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); player_place(i, j); } @@ -1037,7 +1037,7 @@ static void generate_challenge_arena(void) place_solid_perm_bold(y, x); /* Illuminate and memorize the walls */ - grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); } } @@ -1047,7 +1047,7 @@ static void generate_challenge_arena(void) for (x = qx + 1; x < qx + SCREEN_WID - 1; x++) { /* Create empty floor */ - grid_array[y][x].feat = feat_floor; + current_floor->grid_array[y][x].feat = feat_floor; } } @@ -1082,46 +1082,46 @@ static void build_battle(void) for (j = x_left; j <= x_right; j++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (i = y_depth; i >= y_depth - 3; i--) for (j = x_left; j <= x_right; j++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (j = x_left; j <= x_left + 17; j++) for (i = y_height; i <= y_depth; i++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } for (j = x_right; j >= x_right - 17; j--) for (i = y_height; i <= y_depth; i++) { place_extra_perm_bold(i, j); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); } place_extra_perm_bold(y_height+6, x_left+18); - grid_array[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_depth-4, x_left+18); - grid_array[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_height+6, x_right-18); - grid_array[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); place_extra_perm_bold(y_depth-4, x_right-18); - grid_array[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK); for (i = y_height + 1; i <= y_height + 5; i++) for (j = x_left + 20 + 2 * (y_height + 5 - i); j <= x_right - 20 - 2 * (y_height + 5 - i); j++) { - grid_array[i][j].feat = feat_permanent_glass_wall; + current_floor->grid_array[i][j].feat = feat_permanent_glass_wall; } i = y_height + 1; j = xval; - grid_array[i][j].feat = f_tag_to_index("BUILDING_3"); - grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[i][j].feat = f_tag_to_index("BUILDING_3"); + current_floor->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK); player_place(i, j); } @@ -1145,7 +1145,7 @@ static void generate_gambling_arena(void) place_solid_perm_bold(y, x); /* Illuminate and memorize the walls */ - grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); } } @@ -1155,7 +1155,7 @@ static void generate_gambling_arena(void) for (x = qx + 1; x < qx + SCREEN_WID - 1; x++) { /* Create empty floor */ - grid_array[y][x].feat = feat_floor; + current_floor->grid_array[y][x].feat = feat_floor; } } @@ -1164,7 +1164,7 @@ 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[grid_array[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]); + set_friendly(&m_list[current_floor->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++) { @@ -1274,7 +1274,7 @@ static bool level_gen(concptr *why) } /*! - * @brief フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after grid_array generation + * @brief フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after current_floor->grid_array generation * @return なし */ void wipe_generate_random_floor_flags(void) @@ -1286,7 +1286,7 @@ void wipe_generate_random_floor_flags(void) for (x = 0; x < cur_wid; x++) { /* Wipe unused flags */ - grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); } } @@ -1297,14 +1297,14 @@ void wipe_generate_random_floor_flags(void) for (x = 1; x < cur_wid - 1; x++) { /* There might be trap */ - grid_array[y][x].info |= CAVE_UNSAFE; + current_floor->grid_array[y][x].info |= CAVE_UNSAFE; } } } } /*! - * @brief フロアの全情報を初期化する / Clear and empty the grid_array + * @brief フロアの全情報を初期化する / Clear and empty the current_floor->grid_array * @return なし */ void clear_cave(void) @@ -1329,12 +1329,12 @@ void clear_cave(void) precalc_cur_num_of_pet(); - /* Start with a blank grid_array */ + /* Start with a blank current_floor->grid_array */ for (y = 0; y < MAX_HGT; y++) { for (x = 0; x < MAX_WID; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; g_ptr->info = 0; g_ptr->feat = 0; g_ptr->o_idx = 0; @@ -1380,7 +1380,7 @@ void generate_random_floor(void) concptr why = NULL; - /* Clear and empty the grid_array */ + /* Clear and empty the current_floor->grid_array */ clear_cave(); /* Build the arena -KMW- */ @@ -1587,7 +1587,7 @@ bool build_tunnel(POSITION row1, POSITION col1, POSITION row2, POSITION col2) /* Access the location */ - g_ptr = &grid_array[tmp_row][tmp_col]; + g_ptr = ¤t_floor->grid_array[tmp_row][tmp_col]; /* Avoid "solid" walls */ if (is_solid_grid(g_ptr)) continue; @@ -1725,7 +1725,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) { int i, j, dx, dy; - grid_type *g_ptr = &grid_array[*y][*x]; + grid_type *g_ptr = ¤t_floor->grid_array[*y][*x]; if (!in_bounds(*y, *x)) return TRUE; @@ -1780,7 +1780,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) } /* Clear mimic type */ - grid_array[*y][*x].mimic = 0; + current_floor->grid_array[*y][*x].mimic = 0; place_floor_bold(*y, *x); @@ -2046,7 +2046,7 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, y3 = (y1 + y2) / 2; } /* cache g_ptr */ - g_ptr = &grid_array[y3][x3]; + g_ptr = ¤t_floor->grid_array[y3][x3]; if (is_solid_grid(g_ptr)) { /* move midpoint a bit to avoid problem. */ @@ -2076,14 +2076,14 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, } y3 += dy; x3 += dx; - g_ptr = &grid_array[y3][x3]; + g_ptr = ¤t_floor->grid_array[y3][x3]; } if (is_floor_grid(g_ptr)) { if (build_tunnel2(x1, y1, x3, y3, type, cutoff)) { - if ((grid_array[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95)) + if ((current_floor->grid_array[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95)) { /* do second half only if works + if have hit a room */ retval = build_tunnel2(x3, y3, x2, y2, type, cutoff); diff --git a/src/floor-save.c b/src/floor-save.c index 2871dbcb1..de80e8a15 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -316,7 +316,7 @@ static void build_dead_end(void) { POSITION x, y; - /* Clear and empty the grid_array */ + /* Clear and empty the current_floor->grid_array */ clear_cave(); /* Fill the arrays of floors and walls in the good proportions */ @@ -552,7 +552,7 @@ static void place_pet(void) monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr; - grid_array[cy][cx].m_idx = m_idx; + current_floor->grid_array[cy][cx].m_idx = m_idx; m_ptr->r_idx = party_mon[i].r_idx; @@ -677,7 +677,7 @@ static void get_out_monster(void) POSITION dis = 1; POSITION oy = p_ptr->y; POSITION ox = p_ptr->x; - MONSTER_IDX m_idx = grid_array[oy][ox].m_idx; + MONSTER_IDX m_idx = current_floor->grid_array[oy][ox].m_idx; /* Nothing to do if no monster */ if (!m_idx) return; @@ -709,8 +709,8 @@ static void get_out_monster(void) if (!cave_empty_bold(ny, nx)) continue; /* Hack -- no teleport onto glyph of warding */ - if (is_glyph_grid(&grid_array[ny][nx])) continue; - if (is_explosive_rune_grid(&grid_array[ny][nx])) continue; + if (is_glyph_grid(¤t_floor->grid_array[ny][nx])) continue; + if (is_explosive_rune_grid(¤t_floor->grid_array[ny][nx])) continue; /* ...nor onto the Pattern */ if (pattern_tile(ny, nx)) continue; @@ -720,10 +720,10 @@ static void get_out_monster(void) m_ptr = &m_list[m_idx]; /* Update the old location */ - grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - grid_array[ny][nx].m_idx = m_idx; + current_floor->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -760,7 +760,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool ok = FALSE; @@ -827,7 +827,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) prepare_change_floor_mode(CFM_RAND_PLACE | CFM_NO_RETURN); /* Mega Hack -- It's not the stairs you enter. Disable it. */ - if (!feat_uses_special(grid_array[p_ptr->y][p_ptr->x].feat)) grid_array[p_ptr->y][p_ptr->x].special = 0; + if (!feat_uses_special(current_floor->grid_array[p_ptr->y][p_ptr->x].feat)) current_floor->grid_array[p_ptr->y][p_ptr->x].special = 0; } else { @@ -938,7 +938,7 @@ void leave_floor(void) if (change_floor_mode & CFM_SAVE_FLOORS) { /* Extract stair position */ - g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; f_ptr = &f_info[g_ptr->feat]; /* Get back to old saved floor? */ @@ -1077,7 +1077,7 @@ void leave_floor(void) * @return なし * @details * If the floor is an old saved floor, it will be\n - * restored from the temporal file. If the floor is new one, new grid_array\n + * restored from the temporal file. If the floor is new one, new current_floor->grid_array\n * will be generated.\n */ void change_floor(void) @@ -1104,7 +1104,7 @@ void change_floor(void) if (!(change_floor_mode & CFM_SAVE_FLOORS) && !(change_floor_mode & CFM_FIRST_FLOOR)) { - /* Create grid_array */ + /* Create current_floor->grid_array */ generate_random_floor(); /* Paranoia -- No new saved floor */ @@ -1135,7 +1135,7 @@ void change_floor(void) /* Forbid return stairs */ if (change_floor_mode & CFM_NO_RETURN) { - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; if (!feat_uses_special(g_ptr->feat)) { @@ -1298,7 +1298,7 @@ void change_floor(void) } else { - /* Newly create grid_array */ + /* Newly create current_floor->grid_array */ generate_random_floor(); } @@ -1312,7 +1312,7 @@ void change_floor(void) if (!(change_floor_mode & CFM_NO_RETURN)) { /* Extract stair position */ - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; /*** Create connected stairs ***/ @@ -1477,7 +1477,7 @@ void stair_creation(void) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; if (!g_ptr->special) continue; if (feat_uses_special(g_ptr->feat)) continue; @@ -1522,5 +1522,5 @@ void stair_creation(void) /* Connect this stairs to the destination */ - grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id; + current_floor->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id; } diff --git a/src/floor-streams.c b/src/floor-streams.c index badf55780..c79107c9d 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -109,7 +109,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2, { if (!in_bounds2(ty, tx)) continue; - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; if (g_ptr->feat == feat1) continue; if (g_ptr->feat == feat2) continue; @@ -265,7 +265,7 @@ void build_streamer(IDX feat, int chance) if (!in_bounds2(ty, tx)) continue; break; } - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; f_ptr = &f_info[g_ptr->feat]; if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA))) @@ -391,7 +391,7 @@ void place_trees(POSITION x, POSITION y) for (j = y - 3; j < y + 4; j++) { if (!in_bounds(j, i)) continue; - g_ptr = &grid_array[j][i]; + g_ptr = ¤t_floor->grid_array[j][i]; if (g_ptr->info & CAVE_ICKY) continue; if (g_ptr->o_idx) continue; @@ -406,18 +406,18 @@ void place_trees(POSITION x, POSITION y) if ((distance(j, i, y, x) > 1) || (randint1(100) < 25)) { if (randint1(100) < 75) - grid_array[j][i].feat = feat_tree; + current_floor->grid_array[j][i].feat = feat_tree; } else { - grid_array[j][i].feat = feat_rubble; + current_floor->grid_array[j][i].feat = feat_rubble; } /* Clear garbage of hidden trap or door */ g_ptr->mimic = 0; /* Light area since is open above */ - if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) grid_array[j][i].info |= (CAVE_GLOW | CAVE_ROOM); + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) current_floor->grid_array[j][i].info |= (CAVE_GLOW | CAVE_ROOM); } } } @@ -426,7 +426,7 @@ void place_trees(POSITION x, POSITION y) if (!ironman_downward && one_in_(3)) { /* up stair */ - grid_array[y][x].feat = feat_up_stair; + current_floor->grid_array[y][x].feat = feat_up_stair; } } diff --git a/src/grid.c b/src/grid.c index d0fe5f023..11952526a 100644 --- a/src/grid.c +++ b/src/grid.c @@ -54,7 +54,7 @@ bool new_player_spot(void) y = (POSITION)rand_range(1, cur_hgt - 2); x = (POSITION)rand_range(1, cur_wid - 2); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Must be a "naked" floor grid */ if (g_ptr->m_idx) continue; @@ -109,7 +109,7 @@ void place_random_stairs(POSITION y, POSITION x) grid_type *g_ptr; /* Paranoia */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx) return; /* Town */ @@ -148,7 +148,7 @@ void place_random_door(POSITION y, POSITION x, bool room) { int tmp, type; FEAT_IDX feat = feat_none; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Initialize mimic info */ g_ptr->mimic = 0; @@ -268,7 +268,7 @@ void place_closed_door(POSITION y, POSITION x, int type) cave_set_feat(y, x, feat); /* Now it is not floor */ - grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); } else { @@ -291,7 +291,7 @@ void place_locked_door(POSITION y, POSITION x) else { set_cave_feat(y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR)); - grid_array[y][x].info &= ~(CAVE_FLOOR); + current_floor->grid_array[y][x].info &= ~(CAVE_FLOOR); delete_monster(y, x); } } @@ -312,7 +312,7 @@ void place_secret_door(POSITION y, POSITION x, int type) } else { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; if (type == DOOR_DEFAULT) { @@ -421,7 +421,7 @@ static int next_to_corr(POSITION y1, POSITION x1) /* Extract the location */ y = y1 + ddy_ddd[i]; x = x1 + ddx_ddd[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Skip non floors */ if (cave_have_flag_grid(g_ptr, FF_WALL)) continue; @@ -490,7 +490,7 @@ void try_door(POSITION y, POSITION x) if (cave_have_flag_bold(y, x, FF_WALL)) return; /* Ignore room grids */ - if (grid_array[y][x].info & (CAVE_ROOM)) return; + if (current_floor->grid_array[y][x].info & (CAVE_ROOM)) return; /* Occasional door (if allowed) */ if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)) @@ -595,7 +595,7 @@ void vault_objects(POSITION y, POSITION x, int num) } /* Require "clean" floor space */ - g_ptr = &grid_array[j][k]; + g_ptr = ¤t_floor->grid_array[j][k]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx) continue; if (randint0(100) < 75) @@ -649,7 +649,7 @@ void vault_trap_aux(POSITION y, POSITION x, POSITION yd, POSITION xd) } /* Require "naked" floor grids */ - g_ptr = &grid_array[y1][x1]; + g_ptr = ¤t_floor->grid_array[y1][x1]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx || g_ptr->m_idx) continue; /* Place the trap */ @@ -707,7 +707,7 @@ void vault_monsters(POSITION y1, POSITION x1, int num) scatter(&y, &x, y1, x1, d, 0); /* Require "empty" floor grids */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (!cave_empty_grid(g_ptr)) continue; /* Place the monster (allow groups) */ @@ -752,7 +752,7 @@ void set_floor(POSITION x, POSITION y) return; } - if (grid_array[y][x].info & CAVE_ROOM) + if (current_floor->grid_array[y][x].info & CAVE_ROOM) { /* A room border don't touch. */ return; @@ -1147,12 +1147,12 @@ static bool check_local_illumination(POSITION y, POSITION x) #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */ /* Check for "complex" illumination */ - if ((feat_supports_los(get_feat_mimic(&grid_array[yy][xx])) && - (grid_array[yy][xx].info & CAVE_GLOW)) || - (feat_supports_los(get_feat_mimic(&grid_array[y][xx])) && - (grid_array[y][xx].info & CAVE_GLOW)) || - (feat_supports_los(get_feat_mimic(&grid_array[yy][x])) && - (grid_array[yy][x].info & CAVE_GLOW))) + if ((feat_supports_los(get_feat_mimic(¤t_floor->grid_array[yy][xx])) && + (current_floor->grid_array[yy][xx].info & CAVE_GLOW)) || + (feat_supports_los(get_feat_mimic(¤t_floor->grid_array[y][xx])) && + (current_floor->grid_array[y][xx].info & CAVE_GLOW)) || + (feat_supports_los(get_feat_mimic(¤t_floor->grid_array[yy][x])) && + (current_floor->grid_array[yy][x].info & CAVE_GLOW))) { return TRUE; } @@ -1161,7 +1161,7 @@ static bool check_local_illumination(POSITION y, POSITION x) #else /* COMPLEX_WALL_ILLUMINATION */ /* Check for "simple" illumination */ - return (grid_array[yy][xx].info & CAVE_GLOW) ? TRUE : FALSE; + return (current_floor->grid_array[yy][xx].info & CAVE_GLOW) ? TRUE : FALSE; #endif /* COMPLEX_WALL_ILLUMINATION */ } @@ -1173,7 +1173,7 @@ static bool check_local_illumination(POSITION y, POSITION x) if (player_has_los_bold((Y), (X))) \ { \ /* Update the monster */ \ - if (grid_array[(Y)][(X)].m_idx) update_monster(grid_array[(Y)][(X)].m_idx, FALSE); \ + if (current_floor->grid_array[(Y)][(X)].m_idx) update_monster(current_floor->grid_array[(Y)][(X)].m_idx, FALSE); \ \ /* Notice and redraw */ \ note_spot((Y), (X)); \ @@ -1322,7 +1322,7 @@ bool player_can_see_bold(POSITION y, POSITION x) /* Blind players see nothing */ if (p_ptr->blind) return FALSE; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Note that "torch-lite" yields "illumination" */ if (g_ptr->info & (CAVE_LITE | CAVE_MNLT)) return TRUE; @@ -1365,7 +1365,7 @@ bool no_lite(void) */ bool cave_valid_bold(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Forbid perma-grids */ @@ -1602,7 +1602,7 @@ void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_cha * not any. If there were, they would have to set "shimmer_objects"\n * when they were created, and then new "shimmer" code in "dungeon.c"\n * would have to be created handle the "shimmer" effect, and the code\n - * in "grid_array.c" would have to be updated to create the shimmer effect.\n + * in "current_floor->grid_array.c" would have to be updated to create the shimmer effect.\n *\n * Note the effects of hallucination. Objects always appear as random\n * "objects", monsters as random "monsters", and normal grids occasionally\n @@ -1691,8 +1691,8 @@ void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_cha */ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp) { - /* Get the grid_array */ - grid_type *g_ptr = &grid_array[y][x]; + /* Get the current_floor->grid_array */ + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -2206,7 +2206,7 @@ void print_rel(SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x) */ void note_spot(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Blind players see nothing */ @@ -2491,7 +2491,7 @@ void prt_path(POSITION y, POSITION x) { POSITION ny = GRID_Y(path_g[i]); POSITION nx = GRID_X(path_g[i]); - grid_type *g_ptr = &grid_array[ny][nx]; + grid_type *g_ptr = ¤t_floor->grid_array[ny][nx]; if (panel_contains(ny, nx)) { @@ -3226,7 +3226,7 @@ void forget_lite(void) x = lite_x[i]; /* Forget "LITE" flag */ - grid_array[y][x].info &= ~(CAVE_LITE); + current_floor->grid_array[y][x].info &= ~(CAVE_LITE); /* lite_spot(y, x); Perhaps don't need? */ } @@ -3268,9 +3268,9 @@ void forget_lite(void) */ #define cave_lite_hack(Y,X) \ {\ - if (!(grid_array[Y][X].info & (CAVE_LITE))) \ + if (!(current_floor->grid_array[Y][X].info & (CAVE_LITE))) \ { \ - grid_array[Y][X].info |= (CAVE_LITE); \ + current_floor->grid_array[Y][X].info |= (CAVE_LITE); \ lite_y[lite_n] = (Y); \ lite_x[lite_n++] = (X); \ } \ @@ -3318,7 +3318,7 @@ void update_lite(void) /* forget_lite(); Perhaps don't need? */ /* Add it to later visual update */ - cave_redraw_later(&grid_array[p_ptr->y][p_ptr->x], p_ptr->y, p_ptr->x); + cave_redraw_later(¤t_floor->grid_array[p_ptr->y][p_ptr->x], p_ptr->y, p_ptr->x); } #endif @@ -3331,10 +3331,10 @@ void update_lite(void) x = lite_x[i]; /* Mark the grid as not "lite" */ - grid_array[y][x].info &= ~(CAVE_LITE); + current_floor->grid_array[y][x].info &= ~(CAVE_LITE); /* Mark the grid as "seen" */ - grid_array[y][x].info |= (CAVE_TEMP); + current_floor->grid_array[y][x].info |= (CAVE_TEMP); /* Add it to the "seen" set */ temp_y[temp_n] = y; @@ -3469,7 +3469,7 @@ void update_lite(void) if (d > p) continue; /* Viewable, nearby, grids get "torch lit" */ - if (grid_array[y][x].info & CAVE_VIEW) + if (current_floor->grid_array[y][x].info & CAVE_VIEW) { /* This grid is "torch lit" */ cave_lite_hack(y, x); @@ -3487,7 +3487,7 @@ void update_lite(void) y = lite_y[i]; x = lite_x[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Update fresh grids */ if (g_ptr->info & (CAVE_TEMP)) continue; @@ -3502,7 +3502,7 @@ void update_lite(void) y = temp_y[i]; x = temp_x[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* No longer in the array */ g_ptr->info &= ~(CAVE_TEMP); @@ -3537,7 +3537,7 @@ static void mon_lite_hack(POSITION y, POSITION x) /* We trust this grid is in bounds */ /* if (!in_bounds2(y, x)) return; */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Want a unlit square in view of the player */ if ((g_ptr->info & (CAVE_MNLT | CAVE_VIEW)) != CAVE_VIEW) return; @@ -3623,7 +3623,7 @@ static void mon_dark_hack(POSITION y, POSITION x) /* We trust this grid is in bounds */ /* if (!in_bounds2(y, x)) return; */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Want a unlit and undarkened square in view of the player */ if ((g_ptr->info & (CAVE_LITE | CAVE_MNLT | CAVE_MNDK | CAVE_VIEW)) != CAVE_VIEW) return; @@ -3716,7 +3716,7 @@ void update_mon_lite(void) for (i = 0; i < mon_lite_n; i++) { /* Point to grid */ - g_ptr = &grid_array[mon_lite_y[i]][mon_lite_x[i]]; + g_ptr = ¤t_floor->grid_array[mon_lite_y[i]][mon_lite_x[i]]; /* Set temp or xtra flag */ g_ptr->info |= (g_ptr->info & CAVE_MNLT) ? CAVE_TEMP : CAVE_XTRA; @@ -3777,7 +3777,7 @@ void update_mon_lite(void) mon_fy = m_ptr->fy; /* Is the monster visible? */ - mon_invis = !(grid_array[mon_fy][mon_fx].info & CAVE_VIEW); + mon_invis = !(current_floor->grid_array[mon_fy][mon_fx].info & CAVE_VIEW); /* The square it is on */ add_mon_lite(mon_fy, mon_fx); @@ -3802,7 +3802,7 @@ void update_mon_lite(void) add_mon_lite(mon_fy + 2, mon_fx); add_mon_lite(mon_fy + 2, mon_fx - 1); - g_ptr = &grid_array[mon_fy + 2][mon_fx]; + g_ptr = ¤t_floor->grid_array[mon_fy + 2][mon_fx]; /* Radius 3 */ if ((rad == 3) && cave_have_flag_grid(g_ptr, f_flag)) @@ -3820,7 +3820,7 @@ void update_mon_lite(void) add_mon_lite(mon_fy - 2, mon_fx); add_mon_lite(mon_fy - 2, mon_fx - 1); - g_ptr = &grid_array[mon_fy - 2][mon_fx]; + g_ptr = ¤t_floor->grid_array[mon_fy - 2][mon_fx]; /* Radius 3 */ if ((rad == 3) && cave_have_flag_grid(g_ptr, f_flag)) @@ -3838,7 +3838,7 @@ void update_mon_lite(void) add_mon_lite(mon_fy, mon_fx + 2); add_mon_lite(mon_fy - 1, mon_fx + 2); - g_ptr = &grid_array[mon_fy][mon_fx + 2]; + g_ptr = ¤t_floor->grid_array[mon_fy][mon_fx + 2]; /* Radius 3 */ if ((rad == 3) && cave_have_flag_grid(g_ptr, f_flag)) @@ -3856,7 +3856,7 @@ void update_mon_lite(void) add_mon_lite(mon_fy, mon_fx - 2); add_mon_lite(mon_fy - 1, mon_fx - 2); - g_ptr = &grid_array[mon_fy][mon_fx - 2]; + g_ptr = ¤t_floor->grid_array[mon_fy][mon_fx - 2]; /* Radius 3 */ if ((rad == 3) && cave_have_flag_grid(g_ptr, f_flag)) @@ -3912,7 +3912,7 @@ void update_mon_lite(void) /* We trust this grid is in bounds */ /* Point to grid */ - g_ptr = &grid_array[fy][fx]; + g_ptr = ¤t_floor->grid_array[fy][fx]; if (g_ptr->info & CAVE_TEMP) /* Pervious lit */ { @@ -3953,7 +3953,7 @@ void update_mon_lite(void) /* We trust this grid is in bounds */ /* Point to grid */ - g_ptr = &grid_array[fy][fx]; + g_ptr = ¤t_floor->grid_array[fy][fx]; if (g_ptr->info & CAVE_MNLT) /* Lit */ { @@ -3987,7 +3987,7 @@ void update_mon_lite(void) { /* We trust this grid is in bounds */ - grid_array[temp_y[i]][temp_x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA); + current_floor->grid_array[temp_y[i]][temp_x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA); } /* Finished with temp_n */ @@ -3996,7 +3996,7 @@ void update_mon_lite(void) /* Mega-Hack -- Visual update later */ p_ptr->update |= (PU_DELAY_VIS); - p_ptr->monlite = (grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT) ? TRUE : FALSE; + p_ptr->monlite = (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_MNLT) ? TRUE : FALSE; if (p_ptr->special_defense & NINJA_S_STEALTH) { @@ -4024,7 +4024,7 @@ void clear_mon_lite(void) for (i = 0; i < mon_lite_n; i++) { /* Point to grid */ - g_ptr = &grid_array[mon_lite_y[i]][mon_lite_x[i]]; + g_ptr = ¤t_floor->grid_array[mon_lite_y[i]][mon_lite_x[i]]; /* Clear monster illumination flag */ g_ptr->info &= ~(CAVE_MNLT | CAVE_MNDK); @@ -4053,7 +4053,7 @@ void forget_view(void) { POSITION y = view_y[i]; POSITION x = view_x[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Forget that the grid is viewable */ g_ptr->info &= ~(CAVE_VIEW); @@ -4114,8 +4114,8 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO grid_type *g2_c_ptr; /* Access the grids */ - g1_c_ptr = &grid_array[y1][x1]; - g2_c_ptr = &grid_array[y2][x2]; + g1_c_ptr = ¤t_floor->grid_array[y1][x1]; + g2_c_ptr = ¤t_floor->grid_array[y2][x2]; /* Check for walls */ @@ -4133,7 +4133,7 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO /* Totally blocked by "unviewable neighbors" */ if (!v1 && !v2) return (TRUE); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Check for walls */ @@ -4332,7 +4332,7 @@ void update_view(void) { y = view_y[n]; x = view_x[n]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Mark the grid as not in "view" */ g_ptr->info &= ~(CAVE_VIEW); @@ -4354,7 +4354,7 @@ void update_view(void) /* Now start on the player */ y = p_ptr->y; x = p_ptr->x; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Assume the player grid is easily viewable */ g_ptr->info |= (CAVE_XTRA); @@ -4371,7 +4371,7 @@ void update_view(void) /* Scan south-east */ for (d = 1; d <= z; d++) { - g_ptr = &grid_array[y + d][x + d]; + g_ptr = ¤t_floor->grid_array[y + d][x + d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y + d, x + d); if (!cave_los_grid(g_ptr)) break; @@ -4380,7 +4380,7 @@ void update_view(void) /* Scan south-west */ for (d = 1; d <= z; d++) { - g_ptr = &grid_array[y + d][x - d]; + g_ptr = ¤t_floor->grid_array[y + d][x - d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y + d, x - d); if (!cave_los_grid(g_ptr)) break; @@ -4389,7 +4389,7 @@ void update_view(void) /* Scan north-east */ for (d = 1; d <= z; d++) { - g_ptr = &grid_array[y - d][x + d]; + g_ptr = ¤t_floor->grid_array[y - d][x + d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y - d, x + d); if (!cave_los_grid(g_ptr)) break; @@ -4398,7 +4398,7 @@ void update_view(void) /* Scan north-west */ for (d = 1; d <= z; d++) { - g_ptr = &grid_array[y - d][x - d]; + g_ptr = ¤t_floor->grid_array[y - d][x - d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y - d, x - d); if (!cave_los_grid(g_ptr)) break; @@ -4409,7 +4409,7 @@ void update_view(void) /* Scan south */ for (d = 1; d <= full; d++) { - g_ptr = &grid_array[y + d][x]; + g_ptr = ¤t_floor->grid_array[y + d][x]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y + d, x); if (!cave_los_grid(g_ptr)) break; @@ -4421,7 +4421,7 @@ void update_view(void) /* Scan north */ for (d = 1; d <= full; d++) { - g_ptr = &grid_array[y - d][x]; + g_ptr = ¤t_floor->grid_array[y - d][x]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y - d, x); if (!cave_los_grid(g_ptr)) break; @@ -4433,7 +4433,7 @@ void update_view(void) /* Scan east */ for (d = 1; d <= full; d++) { - g_ptr = &grid_array[y][x + d]; + g_ptr = ¤t_floor->grid_array[y][x + d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y, x + d); if (!cave_los_grid(g_ptr)) break; @@ -4445,7 +4445,7 @@ void update_view(void) /* Scan west */ for (d = 1; d <= full; d++) { - g_ptr = &grid_array[y][x - d]; + g_ptr = ¤t_floor->grid_array[y][x - d]; g_ptr->info |= (CAVE_XTRA); cave_view_hack(g_ptr, y, x - d); if (!cave_los_grid(g_ptr)) break; @@ -4699,7 +4699,7 @@ void update_view(void) { y = view_y[n]; x = view_x[n]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Clear the "CAVE_XTRA" flag */ g_ptr->info &= ~(CAVE_XTRA); @@ -4716,7 +4716,7 @@ void update_view(void) { y = temp_y[n]; x = temp_x[n]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* No longer in the array */ g_ptr->info &= ~(CAVE_TEMP); @@ -4751,7 +4751,7 @@ void delayed_visual_update(void) { y = redraw_y[i]; x = redraw_x[i]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Update only needed grids (prevent multiple updating) */ if (!(g_ptr->info & CAVE_REDRAW)) continue; @@ -4786,9 +4786,9 @@ void forget_flow(void) for (x = 0; x < cur_wid; x++) { /* Forget the old data */ - grid_array[y][x].dist = 0; - grid_array[y][x].cost = 0; - grid_array[y][x].when = 0; + current_floor->grid_array[y][x].dist = 0; + current_floor->grid_array[y][x].cost = 0; + current_floor->grid_array[y][x].when = 0; } } } @@ -4831,7 +4831,7 @@ void update_flow(void) if (running && in_bounds(flow_y, flow_x)) { /* The way point is in sight - do not update. (Speedup) */ - if (grid_array[flow_y][flow_x].info & CAVE_VIEW) return; + if (current_floor->grid_array[flow_y][flow_x].info & CAVE_VIEW) return; } /* Erase all of the current flow information */ @@ -4839,8 +4839,8 @@ void update_flow(void) { for (x = 0; x < cur_wid; x++) { - grid_array[y][x].cost = 0; - grid_array[y][x].dist = 0; + current_floor->grid_array[y][x].cost = 0; + current_floor->grid_array[y][x].dist = 0; } } @@ -4868,8 +4868,8 @@ void update_flow(void) for (d = 0; d < 8; d++) { int old_head = flow_head; - byte_hack m = grid_array[ty][tx].cost + 1; - byte_hack n = grid_array[ty][tx].dist + 1; + byte_hack m = current_floor->grid_array[ty][tx].cost + 1; + byte_hack n = current_floor->grid_array[ty][tx].dist + 1; grid_type *g_ptr; /* Child location */ @@ -4879,7 +4879,7 @@ void update_flow(void) /* Ignore player's grid */ if (player_bold(y, x)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (is_closed_door(g_ptr->feat)) m += 3; @@ -4951,8 +4951,8 @@ void update_smell(void) { for (x = 0; x < cur_wid; x++) { - int w = grid_array[y][x].when; - grid_array[y][x].when = (w > 128) ? (w - 128) : 0; + int w = current_floor->grid_array[y][x].when; + current_floor->grid_array[y][x].when = (w > 128) ? (w - 128) : 0; } } @@ -4975,7 +4975,7 @@ void update_smell(void) /* Check Bounds */ if (!in_bounds(y, x)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Walls, water, and lava cannot hold scent. */ if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(g_ptr->feat)) continue; @@ -5013,7 +5013,7 @@ void map_area(POSITION range) { if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Memorize terrain of the grid */ g_ptr->info |= (CAVE_KNOWN); @@ -5035,7 +5035,7 @@ void map_area(POSITION range) /* Memorize known walls */ for (i = 0; i < 8; i++) { - g_ptr = &grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]]; + g_ptr = ¤t_floor->grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -5063,7 +5063,7 @@ void map_area(POSITION range) */ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[feat]; bool old_los, old_mirror; @@ -5086,7 +5086,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - grid_array[yy][xx].info |= CAVE_GLOW; + current_floor->grid_array[yy][xx].info |= CAVE_GLOW; } } @@ -5147,7 +5147,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - cc_ptr = &grid_array[yy][xx]; + cc_ptr = ¤t_floor->grid_array[yy][xx]; cc_ptr->info |= CAVE_GLOW; if (player_has_los_grid(cc_ptr)) @@ -5164,7 +5164,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } } @@ -5227,7 +5227,7 @@ FEAT_IDX feat_state(FEAT_IDX feat, int action) void cave_alter_feat(POSITION y, POSITION x, int action) { /* Set old feature */ - FEAT_IDX oldfeat = grid_array[y][x].feat; + FEAT_IDX oldfeat = current_floor->grid_array[y][x].feat; /* Get the new feat */ FEAT_IDX newfeat = feat_state(oldfeat, action); @@ -5282,7 +5282,7 @@ void cave_alter_feat(POSITION y, POSITION x, int action) /* Remove a mirror */ void remove_mirror(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Remove the mirror */ g_ptr->info &= ~(CAVE_OBJECT); @@ -5603,7 +5603,7 @@ void glow_deep_lava_and_bldg(void) { for (x = 0; x < cur_wid; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Feature code (applying "mimic" field) */ @@ -5614,7 +5614,7 @@ void glow_deep_lava_and_bldg(void) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - grid_array[yy][xx].info |= CAVE_GLOW; + current_floor->grid_array[yy][xx].info |= CAVE_GLOW; } } } @@ -5637,7 +5637,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]; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Require "teleportable" space */ @@ -5667,7 +5667,7 @@ bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, POSITION y, POSITION x, B */ bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Require "teleportable" space */ diff --git a/src/grid.h b/src/grid.h index 468c1130d..6018d83e2 100644 --- a/src/grid.h +++ b/src/grid.h @@ -14,11 +14,11 @@ /* Macros */ -#define set_cave_feat(Y,X,F) (grid_array[(Y)][(X)].feat = (F)) -#define add_cave_info(Y,X,I) (grid_array[(Y)][(X)].info |= (I)) +#define set_cave_feat(Y,X,F) (current_floor->grid_array[(Y)][(X)].feat = (F)) +#define add_cave_info(Y,X,I) (current_floor->grid_array[(Y)][(X)].info |= (I)) /* This should not be used */ -/*#define set_cave_info(Y,X,I) (grid_array[(Y)][(X)].info = (I)) */ +/*#define set_cave_info(Y,X,I) (current_floor->grid_array[(Y)][(X)].info = (I)) */ /*! * @brief 指定座標が瓦礫かどうかを返す @@ -50,12 +50,12 @@ * @param X 指定X座標 * @return FLOOR属性を持っているならばTRUE */ -#define is_floor_bold(Y,X) (grid_array[Y][X].info & CAVE_FLOOR) -#define is_extra_bold(Y,X) (grid_array[Y][X].info & CAVE_EXTRA) +#define is_floor_bold(Y,X) (current_floor->grid_array[Y][X].info & CAVE_FLOOR) +#define is_extra_bold(Y,X) (current_floor->grid_array[Y][X].info & CAVE_EXTRA) -#define is_inner_bold(Y,X) (grid_array[Y][X].info & CAVE_INNER) -#define is_outer_bold(Y,X) (grid_array[Y][X].info & CAVE_OUTER) -#define is_solid_bold(Y,X) (grid_array[Y][X].info & CAVE_SOLID) +#define is_inner_bold(Y,X) (current_floor->grid_array[Y][X].info & CAVE_INNER) +#define is_outer_bold(Y,X) (current_floor->grid_array[Y][X].info & CAVE_OUTER) +#define is_solid_bold(Y,X) (current_floor->grid_array[Y][X].info & CAVE_SOLID) #define is_floor_grid(C) ((C)->info & CAVE_FLOOR) #define is_extra_grid(C) ((C)->info & CAVE_EXTRA) @@ -66,7 +66,7 @@ #define place_floor_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_ground_type[randint0(100)]); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_FLOOR); \ delete_monster(Y, X); \ } @@ -82,7 +82,7 @@ #define place_extra_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_wall_type[randint0(100)]); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } @@ -98,7 +98,7 @@ #define place_extra_perm_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_permanent); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } @@ -115,9 +115,9 @@ { \ feature_type *_f_ptr; \ set_cave_feat(Y,X,feat_wall_type[randint0(100)]); \ - _f_ptr = &f_info[grid_array[Y][X].feat]; \ - if (permanent_wall(_f_ptr)) grid_array[Y][X].feat = feat_state(grid_array[Y][X].feat, FF_UNPERM); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + _f_ptr = &f_info[current_floor->grid_array[Y][X].feat]; \ + if (permanent_wall(_f_ptr)) current_floor->grid_array[Y][X].feat = feat_state(current_floor->grid_array[Y][X].feat, FF_UNPERM); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } @@ -125,7 +125,7 @@ #define place_inner_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_wall_inner); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_INNER); \ delete_monster(Y, X); \ } @@ -141,7 +141,7 @@ #define place_inner_perm_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_permanent); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_INNER); \ delete_monster(Y, X); \ } @@ -157,7 +157,7 @@ #define place_outer_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_wall_outer); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_OUTER); \ delete_monster(Y, X); \ } @@ -173,7 +173,7 @@ #define place_outer_perm_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_permanent); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_OUTER); \ delete_monster(Y, X); \ } @@ -191,7 +191,7 @@ feature_type *_f_ptr = &f_info[feat_wall_outer]; \ if (permanent_wall(_f_ptr)) set_cave_feat(Y, X, (s16b)feat_state(feat_wall_outer, FF_UNPERM)); \ else set_cave_feat(Y,X,feat_wall_outer); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \ delete_monster(Y, X); \ } @@ -209,7 +209,7 @@ #define place_solid_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_wall_solid); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } @@ -225,7 +225,7 @@ #define place_solid_perm_bold(Y, X) \ { \ set_cave_feat(Y,X,feat_permanent); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } @@ -241,10 +241,10 @@ #define place_solid_noperm_bold(Y, X) \ { \ feature_type *_f_ptr = &f_info[feat_wall_solid]; \ - if ((grid_array[Y][X].info & CAVE_VAULT) && permanent_wall(_f_ptr)) \ + if ((current_floor->grid_array[Y][X].info & CAVE_VAULT) && permanent_wall(_f_ptr)) \ set_cave_feat(Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \ else set_cave_feat(Y,X,feat_wall_solid); \ - grid_array[Y][X].info &= ~(CAVE_MASK); \ + current_floor->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } diff --git a/src/init1.c b/src/init1.c index f4e5c1588..4f502bb60 100644 --- a/src/init1.c +++ b/src/init1.c @@ -3901,7 +3901,7 @@ static errr parse_line_building(char *buf) */ static void drop_here(object_type *j_ptr, POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; object_type *o_ptr; OBJECT_IDX o_idx = o_pop(); @@ -3970,7 +3970,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in return parse_line_feature(buf); } - /* Process "D:" -- info for the grid_array grids */ + /* Process "D:" -- info for the current_floor->grid_array grids */ else if (buf[0] == 'D') { object_type object_type_body; @@ -3985,7 +3985,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in for (*x = xmin, i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++) { - grid_type *g_ptr = &grid_array[*y][*x]; + grid_type *g_ptr = ¤t_floor->grid_array[*y][*x]; int idx = s[0]; diff --git a/src/init2.c b/src/init2.c index 02e9a0a7d..c0ac60206 100644 --- a/src/init2.c +++ b/src/init2.c @@ -1235,11 +1235,11 @@ static errr init_other(void) /* Allocate and Wipe the max dungeon level */ C_MAKE(max_dlv, max_d_idx, DEPTH); - /* Allocate and wipe each line of the grid_array */ + /* Allocate and wipe each line of the current_floor->grid_array */ for (i = 0; i < MAX_HGT; i++) { - /* Allocate one row of the grid_array */ - C_MAKE(grid_array[i], MAX_WID, grid_type); + /* Allocate one row of the current_floor->grid_array */ + C_MAKE(current_floor->grid_array[i], MAX_WID, grid_type); } diff --git a/src/load.c b/src/load.c index d4aae1e61..b24fbd871 100644 --- a/src/load.c +++ b/src/load.c @@ -2619,8 +2619,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Extract "info" */ g_ptr->info = info; @@ -2650,8 +2650,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Extract "feat" */ g_ptr->feat = (s16b)tmp8u; @@ -2680,8 +2680,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Extract "mimic" */ g_ptr->mimic = (s16b)tmp8u; @@ -2710,8 +2710,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Extract "feat" */ g_ptr->special = tmp16s; @@ -2728,13 +2728,13 @@ static errr rd_dungeon_old(void) } } - /* Convert grid_array data */ + /* Convert current_floor->grid_array data */ if (z_older_than(11, 0, 99)) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { /* Wipe old unused flags */ - grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); } } @@ -2742,8 +2742,8 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Very old */ if (g_ptr->feat == OLD_FEAT_INVIS) @@ -2765,8 +2765,8 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; /* Old CAVE_IN_MIRROR flag */ if (g_ptr->info & CAVE_OBJECT) @@ -2805,8 +2805,8 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the grid_array */ - g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + g_ptr = ¤t_floor->grid_array[y][x]; if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !dun_level) { @@ -2887,7 +2887,7 @@ static errr rd_dungeon_old(void) else { /* Access the item location */ - g_ptr = &grid_array[o_ptr->iy][o_ptr->ix]; + g_ptr = ¤t_floor->grid_array[o_ptr->iy][o_ptr->ix]; /* Build a stack */ o_ptr->next_o_idx = g_ptr->o_idx; @@ -2934,7 +2934,7 @@ static errr rd_dungeon_old(void) /* Access grid */ - g_ptr = &grid_array[m_ptr->fy][m_ptr->fx]; + g_ptr = ¤t_floor->grid_array[m_ptr->fy][m_ptr->fx]; /* Mark the location */ g_ptr->m_idx = m_idx; @@ -2985,7 +2985,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) cave_template_type *templates; - /*** Wipe all grid_array ***/ + /*** Wipe all current_floor->grid_array ***/ clear_cave(); @@ -3104,10 +3104,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the grid_array */ - grid_type *g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; - /* Extract grid_array data */ + /* Extract current_floor->grid_array data */ g_ptr->info = templates[id].info; g_ptr->feat = templates[id].feat; g_ptr->mimic = templates[id].mimic; @@ -3130,8 +3130,8 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the grid_array */ - grid_type *g_ptr = &grid_array[y][x]; + /* Access the current_floor->grid_array */ + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !dun_level) { @@ -3205,7 +3205,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) else { /* Access the item location */ - grid_type *g_ptr = &grid_array[o_ptr->iy][o_ptr->ix]; + grid_type *g_ptr = ¤t_floor->grid_array[o_ptr->iy][o_ptr->ix]; /* Build a stack */ o_ptr->next_o_idx = g_ptr->o_idx; @@ -3245,7 +3245,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) /* Access grid */ - g_ptr = &grid_array[m_ptr->fy][m_ptr->fx]; + g_ptr = ¤t_floor->grid_array[m_ptr->fy][m_ptr->fx]; /* Mark the location */ g_ptr->m_idx = m_idx; diff --git a/src/mane.c b/src/mane.c index f0f8ec530..e7a615d1a 100644 --- a/src/mane.c +++ b/src/mane.c @@ -285,7 +285,7 @@ static bool use_mane(int spell) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = grid_array[target_row][target_col].m_idx; + m_idx = current_floor->grid_array[target_row][target_col].m_idx; if (!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; @@ -674,10 +674,10 @@ static bool use_mane(int spell) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - if (!grid_array[target_row][target_col].m_idx) break; + if (!current_floor->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[grid_array[target_row][target_col].m_idx]; + m_ptr = &m_list[current_floor->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) @@ -699,7 +699,7 @@ static bool use_mane(int spell) } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); + teleport_monster_to(current_floor->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: diff --git a/src/melee1.c b/src/melee1.c index 17bd36cfc..45d271a7d 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -436,7 +436,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b int num = 0, bonus, chance, vir; HIT_POINT k; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1307,7 +1307,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b if (do_quake) { earthquake(p_ptr->y, p_ptr->x, 10); - if (!grid_array[y][x].m_idx) *mdeath = TRUE; + if (!current_floor->grid_array[y][x].m_idx) *mdeath = TRUE; } } @@ -1326,7 +1326,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode) bool mdeath = FALSE; bool stormbringer = FALSE; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -3004,7 +3004,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK); } - if (is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) + if (is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x])) { teleport_player(10, 0L); } diff --git a/src/mind.c b/src/mind.c index a8f43d0ae..1405d6aa7 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1233,7 +1233,7 @@ static bool cast_force_spell(int spell) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = grid_array[target_row][target_col].m_idx; + m_idx = current_floor->grid_array[target_row][target_col].m_idx; if (!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; @@ -1289,7 +1289,7 @@ static int number_of_mirrors(void) int val = 0; for (x = 0; x < cur_wid; x++) { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x])) val++; + if (is_mirror_grid(¤t_floor->grid_array[y][x])) val++; } } return val; @@ -1314,7 +1314,7 @@ static bool cast_mirror_spell(int spell) { /* mirror of seeing */ case 0: - tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0; + tmp = is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0; if (plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT); if (plev + tmp > 18)detect_monsters_invis(DETECT_RAD_DEFAULT); if (plev + tmp > 28)set_tim_esp((TIME_EFFECT)plev, FALSE); @@ -1334,7 +1334,7 @@ static bool cast_mirror_spell(int spell) break; case 2: if (!get_aim_dir(&dir)) return FALSE; - if (plev > 9 && is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) { + if (plev > 9 && is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x])) { fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4)); } else { @@ -1372,7 +1372,7 @@ static bool cast_mirror_spell(int spell) case 9: for (x = 0; x < cur_wid; x++) { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x])) { + if (is_mirror_grid(¤t_floor->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); } } @@ -1401,7 +1401,7 @@ static bool cast_mirror_spell(int spell) break; /* illusion light */ case 14: - tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3; + tmp = is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3; slow_monsters(plev); stun_monsters(plev*tmp); confuse_monsters(plev*tmp); @@ -1411,7 +1411,7 @@ static bool cast_mirror_spell(int spell) break; /* mirror shift */ case 15: - if (!is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) { + if (!is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x])) { msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!")); break; } @@ -1477,7 +1477,7 @@ static bool cast_berserk_spell(int spell) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (!grid_array[y][x].m_idx) + if (!current_floor->grid_array[y][x].m_idx) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return FALSE; @@ -1485,13 +1485,13 @@ static bool cast_berserk_spell(int spell) py_attack(y, x, 0); - if (!player_can_enter(grid_array[y][x].feat, 0) || is_trap(grid_array[y][x].feat)) + if (!player_can_enter(current_floor->grid_array[y][x].feat, 0) || is_trap(current_floor->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(grid_array[y][x].feat, 0) && !is_trap(grid_array[y][x].feat) && !grid_array[y][x].m_idx) + if (player_can_enter(current_floor->grid_array[y][x].feat, 0) && !is_trap(current_floor->grid_array[y][x].feat) && !current_floor->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); @@ -1633,7 +1633,7 @@ static bool cast_ninja_spell(int spell) POSITION ty, tx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = grid_array[target_row][target_col].m_idx; + m_idx = current_floor->grid_array[target_row][target_col].m_idx; if (!m_idx) break; if (m_idx == p_ptr->riding) break; if (!player_has_los_bold(target_row, target_col)) break; @@ -1647,7 +1647,7 @@ static bool cast_ninja_spell(int spell) { POSITION ny = GRID_Y(path_g[i]); POSITION nx = GRID_X(path_g[i]); - grid_type *g_ptr = &grid_array[ny][nx]; + grid_type *g_ptr = ¤t_floor->grid_array[ny][nx]; if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) && !(g_ptr->info & CAVE_OBJECT) && @@ -1658,10 +1658,10 @@ static bool cast_ninja_spell(int spell) } } /* Update the old location */ - grid_array[target_row][target_col].m_idx = 0; + current_floor->grid_array[target_row][target_col].m_idx = 0; /* Update the new location */ - grid_array[ty][tx].m_idx = m_idx; + current_floor->grid_array[ty][tx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ty; @@ -1969,7 +1969,7 @@ void do_cmd_mind(void) break; case MIND_MIRROR_MASTER: /* Cast the spell */ - if( is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE; + if( is_mirror_grid(¤t_floor->grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE; cast = cast_mirror_spell(n); break; case MIND_NINJUTSU: diff --git a/src/monster-process.c b/src/monster-process.c index 1c76598f1..bb6ad9292 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -490,7 +490,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (projectable(y1, x1, p_ptr->y, p_ptr->x)) return (FALSE); /* Set current grid cost */ - now_cost = grid_array[y1][x1].cost; + now_cost = current_floor->grid_array[y1][x1].cost; if (now_cost == 0) now_cost = 999; /* Can monster bash or open doors? */ @@ -513,7 +513,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) /* Simply move to player */ if (player_bold(y, x)) return (FALSE); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; cost = g_ptr->cost; @@ -610,7 +610,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no if (player_has_los_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE); /* Monster grid */ - g_ptr = &grid_array[y1][x1]; + g_ptr = ¤t_floor->grid_array[y1][x1]; /* If we can hear noises, advance towards them */ if (g_ptr->cost) @@ -622,7 +622,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no else if (g_ptr->when) { /* Too old smell */ - if (grid_array[p_ptr->y][p_ptr->x].when - g_ptr->when > 127) return (FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].when - g_ptr->when > 127) return (FALSE); use_scent = TRUE; best = 0; @@ -643,7 +643,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no /* Ignore locations off of edge */ if (!in_bounds2(y, x)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* We're following a scent trail */ if (use_scent) @@ -722,13 +722,13 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (!in_bounds2(y, x)) continue; /* Don't move toward player */ - /* if (grid_array[y][x].dist < 3) continue; */ /* Hmm.. Need it? */ + /* if (current_floor->grid_array[y][x].dist < 3) continue; */ /* Hmm.. Need it? */ /* Calculate distance of this grid from our destination */ dis = distance(y, x, y1, x1); /* Score this grid */ - s = 5000 / (dis + 3) - 500 / (grid_array[y][x].dist + 1); + s = 5000 / (dis + 3) - 500 / (current_floor->grid_array[y][x].dist + 1); /* No negative scores */ if (s < 0) s = 0; @@ -918,7 +918,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) /* Skip illegal locations */ if (!in_bounds(y, x)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Skip locations in a wall */ if (!monster_can_cross_terrain(g_ptr->feat, &r_info[m_ptr->r_idx], (m_idx == p_ptr->riding) ? CEM_RIDING : 0)) continue; @@ -930,7 +930,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (g_ptr->dist == 0) continue; /* Ignore too-distant grids */ - if (g_ptr->dist > grid_array[fy][fx].dist + 2 * d) continue; + if (g_ptr->dist > current_floor->grid_array[fy][fx].dist + 2 * d) continue; } /* Check for absence of shot (more or less) */ @@ -1064,13 +1064,13 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) bool done = FALSE; bool will_run = mon_will_run(m_idx); grid_type *g_ptr; - bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (grid_array[m_ptr->fy][m_ptr->fx].cost > 2)); + bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (current_floor->grid_array[m_ptr->fy][m_ptr->fx].cost > 2)); bool can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)); /* Counter attack to an enemy monster */ if (!will_run && m_ptr->target_y) { - int t_m_idx = grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + int t_m_idx = current_floor->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; /* The monster must be an enemy, and in LOS */ if (t_m_idx && @@ -1088,7 +1088,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) if (!done && !will_run && is_hostile(m_ptr) && (r_ptr->flags1 & RF1_FRIENDS) && ((los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) || - (grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2))) + (current_floor->grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2))) { /* * Animal packs try to get the player out of corridors @@ -1107,7 +1107,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) if (!in_bounds2(yy, xx)) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Check grid */ if (monster_can_cross_terrain(g_ptr->feat, r_ptr, 0)) @@ -1116,7 +1116,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) room++; } } - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2; + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2; if (!r_ptr->flags4 && !r_ptr->a_ability_flags1 && !r_ptr->a_ability_flags2) room -= 2; /* Not in a room and strong player */ @@ -1129,7 +1129,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) } /* Monster groups try to surround the player */ - if (!done && (grid_array[m_ptr->fy][m_ptr->fx].dist < 3)) + if (!done && (current_floor->grid_array[m_ptr->fy][m_ptr->fx].dist < 3)) { int i; @@ -2344,7 +2344,7 @@ void process_monster(MONSTER_IDX m_idx) { /* Ignore locations off of edge */ if (!in_bounds2(y, x)) continue; - if (grid_array[y][x].m_idx) k++; + if (current_floor->grid_array[y][x].m_idx) k++; } } @@ -2449,7 +2449,7 @@ void process_monster(MONSTER_IDX m_idx) /* Give priority to counter attack? */ if (m_ptr->target_y) { - MONSTER_IDX t_m_idx = grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + MONSTER_IDX t_m_idx = current_floor->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]) && @@ -2623,7 +2623,7 @@ void process_monster(MONSTER_IDX m_idx) if (!in_bounds2(ny, nx)) continue; /* Access that grid */ - g_ptr = &grid_array[ny][nx]; + g_ptr = ¤t_floor->grid_array[ny][nx]; f_ptr = &f_info[g_ptr->feat]; can_cross = monster_can_cross_terrain(g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0); @@ -2925,7 +2925,7 @@ void process_monster(MONSTER_IDX m_idx) else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) && (r_ptr->mexp > z_ptr->mexp) && can_cross && (g_ptr->m_idx != p_ptr->riding) && - monster_can_cross_terrain(grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) + monster_can_cross_terrain(current_floor->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) { /* Allow movement */ do_move = TRUE; @@ -3021,7 +3021,7 @@ void process_monster(MONSTER_IDX m_idx) if (!is_riding_mon) { /* Hack -- Update the old location */ - grid_array[oy][ox].m_idx = g_ptr->m_idx; + current_floor->grid_array[oy][ox].m_idx = g_ptr->m_idx; /* Mega-Hack -- move the old monster, if any */ if (g_ptr->m_idx) @@ -3424,14 +3424,14 @@ void process_monsters(void) test = TRUE; } -#if 0 /* (grid_array[p_ptr->y][p_ptr->x].when == grid_array[fy][fx].when) is always FALSE... */ +#if 0 /* (current_floor->grid_array[p_ptr->y][p_ptr->x].when == current_floor->grid_array[fy][fx].when) is always FALSE... */ /* Hack -- Monsters can "smell" the player from far away */ /* Note that most monsters have "aaf" of "20" or so */ else if (!(m_ptr->mflag2 & MFLAG2_NOFLOW) && cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_MOVE) && - (grid_array[p_ptr->y][p_ptr->x].when == grid_array[fy][fx].when) && - (grid_array[fy][fx].dist < MONSTER_FLOW_DEPTH) && - (grid_array[fy][fx].dist < r_ptr->aaf)) + (current_floor->grid_array[p_ptr->y][p_ptr->x].when == current_floor->grid_array[fy][fx].when) && + (current_floor->grid_array[fy][fx].dist < MONSTER_FLOW_DEPTH) && + (current_floor->grid_array[fy][fx].dist < r_ptr->aaf)) { /* We can "smell" the player */ test = TRUE; diff --git a/src/monster1.c b/src/monster1.c index 82d9aa346..0342dbd0a 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -2173,7 +2173,7 @@ monsterrace_hook_type get_monster_hook(void) */ monsterrace_hook_type get_monster_hook2(POSITION y, POSITION x) { - feature_type *f_ptr = &f_info[grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[y][x].feat]; /* Set the monster list */ @@ -2370,7 +2370,7 @@ bool monster_can_cross_terrain(FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 m */ bool monster_can_enter(POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Player or other monster */ if (player_bold(y, x)) return FALSE; diff --git a/src/monster2.c b/src/monster2.c index 69e4071dd..5d4403fc3 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -267,7 +267,7 @@ void delete_monster_idx(MONSTER_IDX i) if (p_ptr->riding == i) p_ptr->riding = 0; /* Monster is gone */ - grid_array[y][x].m_idx = 0; + current_floor->grid_array[y][x].m_idx = 0; for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { @@ -318,7 +318,7 @@ void delete_monster(POSITION y, POSITION x) if (!in_bounds(y, x)) return; /* Check the grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Delete the monster (if any) */ if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); @@ -349,9 +349,9 @@ static void compact_monsters_aux(IDX i1, IDX i2) x = m_ptr->fx; /* Cave grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; - /* Update the grid_array */ + /* Update the current_floor->grid_array */ g_ptr->m_idx = i2; /* Repair objects being carried by monster */ @@ -541,7 +541,7 @@ void wipe_m_list(void) if (!m_ptr->r_idx) continue; /* Monster is gone */ - grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0; + current_floor->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0; /* Wipe the Monster */ (void)WIPE(m_ptr, monster_type); @@ -2658,7 +2658,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; + if (!monster_can_cross_terrain(current_floor->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) @@ -2693,7 +2693,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; + if (!monster_can_cross_terrain(current_floor->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) @@ -2931,7 +2931,7 @@ byte get_mspeed(monster_race *r_ptr) static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode) { /* Access the location */ - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr; monster_race *r_ptr = &r_info[r_idx]; concptr name = (r_name + r_ptr->name); @@ -3004,8 +3004,8 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* Count all quest monsters */ for (i2 = 0; i2 < cur_wid; ++i2) for (j2 = 0; j2 < cur_hgt; j2++) - if (grid_array[j2][i2].m_idx > 0) - if (m_list[grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx) + if (current_floor->grid_array[j2][i2].m_idx > 0) + if (m_list[current_floor->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; @@ -3706,7 +3706,7 @@ bool alloc_horde(POSITION y, POSITION x) if (attempts < 1) return FALSE; - m_idx = grid_array[y][x].m_idx; + m_idx = current_floor->grid_array[y][x].m_idx; if (m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx]; @@ -3747,7 +3747,7 @@ bool alloc_guardian(bool def_val) ox = randint1(cur_wid - 4) + 2; /* Is it a good spot ? */ - if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(grid_array[oy][ox].feat, &r_info[guardian], 0)) + if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(current_floor->grid_array[oy][ox].feat, &r_info[guardian], 0)) { /* Place the guardian */ if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE; diff --git a/src/mspells1.c b/src/mspells1.c index 558be8781..292d6af14 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -414,7 +414,7 @@ bool raise_possible(monster_type *m_ptr) if (!los(y, x, yy, xx)) continue; if (!projectable(y, x, yy, xx)) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Scan the pile of objects */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { @@ -483,9 +483,9 @@ bool clean_shot(POSITION y1, POSITION x1, POSITION y2, POSITION x2, bool is_frie y = GRID_Y(grid_g[i]); x = GRID_X(grid_g[i]); - if ((grid_array[y][x].m_idx > 0) && !((y == y2) && (x == x2))) + if ((current_floor->grid_array[y][x].m_idx > 0) && !((y == y2) && (x == x2))) { - monster_type *m_ptr = &m_list[grid_array[y][x].m_idx]; + monster_type *m_ptr = &m_list[current_floor->grid_array[y][x].m_idx]; if (is_friend == is_pet(m_ptr)) { return (FALSE); @@ -1260,7 +1260,7 @@ static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp, grid_type *g_ptr; /* Access the next grid */ - g_ptr = &grid_array[next_y][next_x]; + g_ptr = ¤t_floor->grid_array[next_y][next_x]; /* Skip this feature */ if (!cave_have_flag_grid(g_ptr, f_flag)) continue; @@ -1414,7 +1414,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) if (los(m_ptr->fy, m_ptr->fx, y_br_lite, x_br_lite)) { - feature_type *f_ptr = &f_info[grid_array[y_br_lite][x_br_lite].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[y_br_lite][x_br_lite].feat]; if (!have_flag(f_ptr->flags, FF_LOS)) { @@ -1436,7 +1436,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) /* Check path */ if (projectable(m_ptr->fy, m_ptr->fx, y, x)) { - feature_type *f_ptr = &f_info[grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[y][x].feat]; if (!have_flag(f_ptr->flags, FF_PROJECT)) { diff --git a/src/mspells2.c b/src/mspells2.c index fc4f09e10..7606d81ff 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -50,8 +50,8 @@ static bool direct_beam(POSITION y1, POSITION x1, POSITION y2, POSITION x2, mons if (y == y2 && x == x2) hit2 = TRUE; - else if (is_friend && grid_array[y][x].m_idx > 0 && - !are_enemies(m_ptr, &m_list[grid_array[y][x].m_idx])) + else if (is_friend && current_floor->grid_array[y][x].m_idx > 0 && + !are_enemies(m_ptr, &m_list[current_floor->grid_array[y][x].m_idx])) { /* Friends don't shoot friends */ return FALSE; @@ -317,7 +317,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) /* Is there counter attack target? */ if (!target_idx && m_ptr->target_y) { - target_idx = grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + target_idx = current_floor->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; if (target_idx) { diff --git a/src/mspells3.c b/src/mspells3.c index fa7b72733..70a9e7b0c 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -609,7 +609,7 @@ static bool cast_learned_spell(int spell, bool success) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = grid_array[target_row][target_col].m_idx; + m_idx = current_floor->grid_array[target_row][target_col].m_idx; if (!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; @@ -1051,10 +1051,10 @@ static bool cast_learned_spell(int spell, bool success) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - if (!grid_array[target_row][target_col].m_idx) break; + if (!current_floor->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[grid_array[target_row][target_col].m_idx]; + m_ptr = &m_list[current_floor->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) @@ -1073,7 +1073,7 @@ static bool cast_learned_spell(int spell, bool success) } } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); + teleport_monster_to(current_floor->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: diff --git a/src/mspells4.c b/src/mspells4.c index 05ae76c13..8b612c7e5 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -1980,7 +1980,7 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) if (p_ptr->inside_arena || p_ptr->inside_battle || !summon_possible(m_ptr->fy, m_ptr->fx)) return -1; - delete_monster_idx(grid_array[m_ptr->fy][m_ptr->fx].m_idx); + delete_monster_idx(current_floor->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; diff --git a/src/mutation.c b/src/mutation.c index 9e1725219..51b72e88f 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2287,7 +2287,7 @@ bool mutation_power_aux(int power) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (!g_ptr->m_idx) { @@ -2332,7 +2332,7 @@ bool mutation_power_aux(int power) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (!g_ptr->m_idx) { msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air.")); diff --git a/src/object1.c b/src/object1.c index d824d4c04..6af080f99 100644 --- a/src/object1.c +++ b/src/object1.c @@ -2839,7 +2839,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) if (floor) { /* Scan all objects in the grid */ - for (this_o_idx = grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; o_ptr = &o_list[this_o_idx]; @@ -3189,7 +3189,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode) if (allow_floor) { /* Scan all objects in the grid */ - for (this_o_idx = grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; o_ptr = &o_list[this_o_idx]; @@ -3466,7 +3466,7 @@ object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS opti * @param mode オプションフラグ * @return 対象のマスに落ちているアイテム数 * @details - * Return a list of o_list[] indexes of items at the given grid_array + * Return a list of o_list[] indexes of items at the given current_floor->grid_array * location. Valid flags are: * * mode & 0x01 -- Item tester @@ -3483,7 +3483,7 @@ ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode if (!in_bounds(y, x)) return 0; /* Scan all objects in the grid */ - for (this_o_idx = grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = current_floor->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; o_ptr = &o_list[this_o_idx]; @@ -4369,7 +4369,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode) { int i; OBJECT_IDX o_idx; - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; if (command_wrk != (USE_FLOOR)) break; @@ -4843,7 +4843,7 @@ void py_pickup_floor(bool pickup) int can_pickup = 0; /* Scan the pile of objects */ - for (this_o_idx = grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { /* Access the object */ o_ptr = &o_list[this_o_idx]; diff --git a/src/object2.c b/src/object2.c index 0725124ed..cacc9dd6d 100644 --- a/src/object2.c +++ b/src/object2.c @@ -129,7 +129,7 @@ void excise_object_idx(OBJECT_IDX o_idx) POSITION y = j_ptr->iy; POSITION x = j_ptr->ix; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -224,7 +224,7 @@ void delete_object(POSITION y, POSITION x) /* Refuse "illegal" locations */ if (!in_bounds(y, x)) return; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -307,7 +307,7 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) x = o_ptr->ix; /* Acquire grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Repair grid */ if (g_ptr->o_idx == i1) @@ -495,7 +495,7 @@ void wipe_o_list(void) POSITION x = o_ptr->ix; /* Access grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Hack -- see above */ g_ptr->o_idx = 0; @@ -4728,7 +4728,7 @@ void place_object(POSITION y, POSITION x, BIT_FLAGS mode) OBJECT_IDX o_idx; /* Acquire grid */ - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; object_type forge; object_type *q_ptr; @@ -4842,7 +4842,7 @@ void place_gold(POSITION y, POSITION x) OBJECT_IDX o_idx; /* Acquire grid */ - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; object_type forge; object_type *q_ptr; @@ -4992,7 +4992,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION if (!projectable(y, x, ty, tx)) continue; /* Obtain grid */ - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; /* Require floor space */ if (!cave_drop_bold(ty, tx)) continue; @@ -5149,7 +5149,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION } - g_ptr = &grid_array[by][bx]; + g_ptr = ¤t_floor->grid_array[by][bx]; /* Scan objects in that grid for combination */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -6573,7 +6573,7 @@ bool process_warning(POSITION xx, POSITION yy) if (!in_bounds(my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue; - g_ptr = &grid_array[my][mx]; + g_ptr = ¤t_floor->grid_array[my][mx]; if (!g_ptr->m_idx) continue; @@ -6671,7 +6671,7 @@ bool process_warning(POSITION xx, POSITION yy) } else old_damage = old_damage / 2; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; if (((!easy_disarm && is_trap(g_ptr->feat)) || (g_ptr->mimic && is_trap(g_ptr->feat))) && !one_in_(13)) { diff --git a/src/player-move.c b/src/player-move.c index 0a63b3ddc..162716ce9 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -364,7 +364,7 @@ static void discover_hidden_things(POSITION y, POSITION x) { OBJECT_IDX this_o_idx, next_o_idx = 0; grid_type *g_ptr; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Invisible trap */ if (g_ptr->mimic && is_trap(g_ptr->feat)) @@ -548,7 +548,7 @@ void py_pickup_aux(OBJECT_IDX o_idx) */ void carry(bool pickup) { - grid_type *g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -672,8 +672,8 @@ void carry(bool pickup) */ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x) { - feature_type *cur_f_ptr = &f_info[grid_array[c_y][c_x].feat]; - feature_type *new_f_ptr = &f_info[grid_array[n_y][n_x].feat]; + feature_type *cur_f_ptr = &f_info[current_floor->grid_array[c_y][c_x].feat]; + feature_type *new_f_ptr = &f_info[current_floor->grid_array[n_y][n_x].feat]; bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN); bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN); int pattern_type_cur, pattern_type_new; @@ -828,8 +828,8 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) { POSITION oy = p_ptr->y; POSITION ox = p_ptr->x; - grid_type *g_ptr = &grid_array[ny][nx]; - grid_type *oc_ptr = &grid_array[oy][ox]; + grid_type *g_ptr = ¤t_floor->grid_array[ny][nx]; + grid_type *oc_ptr = ¤t_floor->grid_array[oy][ox]; feature_type *f_ptr = &f_info[g_ptr->feat]; feature_type *of_ptr = &f_info[oc_ptr->feat]; @@ -1107,7 +1107,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) POSITION x = p_ptr->x + ddx[dir]; /* Examine the destination */ - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; @@ -1256,7 +1256,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) py_attack(y, x, 0); oktomove = FALSE; } - else if (monster_can_cross_terrain(grid_array[p_ptr->y][p_ptr->x].feat, r_ptr, 0)) + else if (monster_can_cross_terrain(current_floor->grid_array[p_ptr->y][p_ptr->x].feat, r_ptr, 0)) { do_past = TRUE; } @@ -1317,7 +1317,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap) } else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC)) { - msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&grid_array[p_ptr->y][p_ptr->x])].name); + msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(¤t_floor->grid_array[p_ptr->y][p_ptr->x])].name); free_turn(p_ptr); oktomove = FALSE; disturb(FALSE, TRUE); @@ -1531,7 +1531,7 @@ static bool see_wall(DIRECTION dir, POSITION y, POSITION x) if (!in_bounds2(y, x)) return (FALSE); /* Access grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Must be known to the player */ if (g_ptr->info & (CAVE_MARK)) @@ -1574,7 +1574,7 @@ static bool see_nothing(DIRECTION dir, POSITION y, POSITION x) if (!in_bounds2(y, x)) return (TRUE); /* Memorized grids are always known */ - if (grid_array[y][x].info & (CAVE_MARK)) return (FALSE); + if (current_floor->grid_array[y][x].info & (CAVE_MARK)) return (FALSE); /* Viewable door/wall grids are known */ if (player_can_see_bold(y, x)) return (FALSE); @@ -1749,13 +1749,13 @@ static bool run_test(void) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) + if (!(current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -1783,7 +1783,7 @@ static bool run_test(void) col = p_ptr->x + ddx[new_dir]; /* Access grid */ - g_ptr = &grid_array[row][col]; + g_ptr = ¤t_floor->grid_array[row][col]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -2142,13 +2142,13 @@ static DIRECTION travel_test(DIRECTION prev_dir) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) + if (!(current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -2177,7 +2177,7 @@ static DIRECTION travel_test(DIRECTION prev_dir) POSITION col = p_ptr->x + ddx[dir]; /* Access grid */ - g_ptr = &grid_array[row][col]; + g_ptr = ¤t_floor->grid_array[row][col]; /* Visible monsters abort running */ if (g_ptr->m_idx) @@ -2207,7 +2207,7 @@ static DIRECTION travel_test(DIRECTION prev_dir) if (!new_dir) return (0); /* Access newly move grid */ - g_ptr = &grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; + g_ptr = ¤t_floor->grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; /* Close door abort traveling */ if (!easy_open && is_closed_door(g_ptr->feat)) return (0); @@ -2297,7 +2297,7 @@ void forget_travel_flow(void) */ static int travel_flow_cost(POSITION y, POSITION x) { - feature_type *f_ptr = &f_info[grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[y][x].feat]; int cost = 1; /* Avoid obstacles (ex. trees) */ @@ -2321,7 +2321,7 @@ static int travel_flow_cost(POSITION y, POSITION x) } /* Detected traps and doors */ - if (grid_array[y][x].info & (CAVE_MARK)) + if (current_floor->grid_array[y][x].info & (CAVE_MARK)) { if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1; if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10; @@ -2340,7 +2340,7 @@ static int travel_flow_cost(POSITION y, POSITION x) */ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int old_head = flow_head; int add_cost = 1; @@ -2357,7 +2357,7 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) /* Ignore "walls" and "rubble" (include "secret doors") */ if (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || - (have_flag(f_ptr->flags, FF_DOOR) && grid_array[y][x].mimic) || + (have_flag(f_ptr->flags, FF_DOOR) && current_floor->grid_array[y][x].mimic) || (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)) { if (!wall || !from_wall) return; @@ -2400,7 +2400,7 @@ static void travel_flow(POSITION ty, POSITION tx) POSITION x, y; DIRECTION d; bool wall = FALSE; - feature_type *f_ptr = &f_info[grid_array[p_ptr->y][p_ptr->x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat]; /* Reset the "queue" */ flow_head = flow_tail = 0; @@ -2461,12 +2461,12 @@ void do_cmd_travel(void) return; } - f_ptr = &f_info[grid_array[y][x].feat]; + f_ptr = &f_info[current_floor->grid_array[y][x].feat]; - if ((grid_array[y][x].info & CAVE_MARK) && + if ((current_floor->grid_array[y][x].info & CAVE_MARK) && (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || - (have_flag(f_ptr->flags, FF_DOOR) && grid_array[y][x].mimic))) + (have_flag(f_ptr->flags, FF_DOOR) && current_floor->grid_array[y][x].mimic))) { msg_print(_("そこには行くことができません!", "You cannot travel there!")); return; diff --git a/src/player-status.c b/src/player-status.c index ae97127d0..0be57205d 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -126,7 +126,7 @@ void calc_bonuses(void) bool old_mighty_throw = p_ptr->mighty_throw; /* Current feature under player. */ - feature_type *f_ptr = &f_info[grid_array[p_ptr->y][p_ptr->x].feat]; + feature_type *f_ptr = &f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat]; /* Save the old armor class */ ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac; @@ -2644,7 +2644,7 @@ void calc_bonuses(void) if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE; } - for (this_o_idx = grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { o_ptr = &o_list[this_o_idx]; @@ -2817,7 +2817,7 @@ static void calc_torch(void) } /* max radius is 14 (was 5) without rewriting other code -- */ - /* see grid_array.c:update_lite() and defines.h:LITE_MAX */ + /* see current_floor->grid_array.c:update_lite() and defines.h:LITE_MAX */ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1) p_ptr->cur_lite = 1; @@ -3807,7 +3807,7 @@ bool player_has_no_spellbooks(void) if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE; } - for (i = grid_array[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx) + for (i = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx) { o_ptr = &o_list[i]; if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE; @@ -3835,7 +3835,7 @@ void free_turn(player_type *creature_ptr) bool player_place(POSITION y, POSITION x) { /* Paranoia XXX XXX */ - if (grid_array[y][x].m_idx != 0) return FALSE; + if (current_floor->grid_array[y][x].m_idx != 0) return FALSE; /* Save player location */ p_ptr->y = y; diff --git a/src/projection.c b/src/projection.c index 6744cbf5a..a3de38861 100644 --- a/src/projection.c +++ b/src/projection.c @@ -166,7 +166,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || current_floor->grid_array[y][x].m_idx != 0)) break; } @@ -255,7 +255,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || current_floor->grid_array[y][x].m_idx != 0)) break; } @@ -326,7 +326,7 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || current_floor->grid_array[y][x].m_idx != 0)) break; } diff --git a/src/quest.c b/src/quest.c index 88de5afcc..7151d9bbb 100644 --- a/src/quest.c +++ b/src/quest.c @@ -263,7 +263,7 @@ void check_quest_completion(monster_type *m_ptr) POSITION ny, nx; /* Stagger around */ - while (cave_perma_bold(y, x) || grid_array[y][x].o_idx || (grid_array[y][x].info & CAVE_OBJECT)) + while (cave_perma_bold(y, x) || current_floor->grid_array[y][x].o_idx || (current_floor->grid_array[y][x].info & CAVE_OBJECT)) { /* Pick a location */ scatter(&ny, &nx, y, x, 1, 0); diff --git a/src/realm-hex.c b/src/realm-hex.c index 2f9ca822c..d074110d9 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -1008,10 +1008,10 @@ concptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode) int dy = y + ddy_ddd[dir]; int dx = x + ddx_ddd[dir]; if (dir == 5) continue; - if (grid_array[dy][dx].m_idx) flag = TRUE; + if (current_floor->grid_array[dy][dx].m_idx) flag = TRUE; } - if (!cave_empty_bold(y, x) || (grid_array[y][x].info & CAVE_ICKY) || + if (!cave_empty_bold(y, x) || (current_floor->grid_array[y][x].info & CAVE_ICKY) || (distance(y, x, p_ptr->y, p_ptr->x) > plev + 2)) { msg_print(_("そこには移動できない。", "Can not teleport to there.")); diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index dd314e263..00ecac692 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -58,21 +58,21 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy_cdd[cdir]; x = p_ptr->x + ddx_cdd[cdir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = p_ptr->y + ddy_cdd[(cdir + 7) % 8]; x = p_ptr->x + ddx_cdd[(cdir + 7) % 8]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = p_ptr->y + ddy_cdd[(cdir + 1) % 8]; x = p_ptr->x + ddx_cdd[(cdir + 1) % 8]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -104,7 +104,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_FIRE); else { @@ -138,7 +138,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_MINEUCHI); else { @@ -186,7 +186,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (!grid_array[y][x].m_idx) + if (!current_floor->grid_array[y][x].m_idx) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; @@ -194,13 +194,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) py_attack(y, x, 0); - if (!player_can_enter(grid_array[y][x].feat, 0) || is_trap(grid_array[y][x].feat)) + if (!player_can_enter(current_floor->grid_array[y][x].feat, 0) || is_trap(current_floor->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(grid_array[y][x].feat, 0) && !is_trap(grid_array[y][x].feat) && !grid_array[y][x].m_idx) + if (player_can_enter(current_floor->grid_array[y][x].feat, 0) && !is_trap(current_floor->grid_array[y][x].feat) && !current_floor->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); @@ -222,7 +222,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_POISON); else { @@ -247,7 +247,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_ZANMA); else { @@ -271,7 +271,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, 0); else { @@ -282,12 +282,12 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { return ""; } - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; - MONSTER_IDX m_idx = grid_array[y][x].m_idx; + MONSTER_IDX m_idx = current_floor->grid_array[y][x].m_idx; monster_type *m_ptr = &m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -307,8 +307,8 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) if ((ty != oy) || (tx != ox)) { msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); - grid_array[oy][ox].m_idx = 0; - grid_array[ty][tx].m_idx = m_idx; + current_floor->grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[ty][tx].m_idx = m_idx; m_ptr->fy = ty; m_ptr->fx = tx; @@ -355,7 +355,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_HAGAN); if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break; @@ -383,7 +383,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_COLD); else { @@ -408,7 +408,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_KYUSHO); else { @@ -433,7 +433,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_MAJIN); else { @@ -458,7 +458,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_SUTEMI); else { @@ -484,7 +484,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_ELEC); else { @@ -525,7 +525,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 = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; m_ptr = &m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ @@ -558,7 +558,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_QUAKE); else earthquake(p_ptr->y, p_ptr->x, 10); @@ -640,7 +640,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (g_ptr->m_idx) py_attack(y, x, HISSATSU_3DAN); @@ -672,7 +672,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) } g_ptr->m_idx = 0; - grid_array[ny][nx].m_idx = m_idx; + current_floor->grid_array[ny][nx].m_idx = m_idx; m_ptr->fy = ny; m_ptr->fx = nx; @@ -715,7 +715,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_DRAIN); else { @@ -816,10 +816,10 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { py_attack(y, x, 0); - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { handle_stuff(); py_attack(y, x, 0); @@ -900,7 +900,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_UNDEAD); else { diff --git a/src/rooms-city.c b/src/rooms-city.c index 953c2a16d..f1dbc42c3 100644 --- a/src/rooms-city.c +++ b/src/rooms-city.c @@ -180,7 +180,7 @@ static void build_stores(POSITION ltcy, POSITION ltcx, int stores[], int n) * Town logic flow for generation of new town\n * Originally from Vanilla 3.0.3\n *\n -* We start with a fully wiped grid_array of normal floors.\n +* We start with a fully wiped current_floor->grid_array of normal floors.\n *\n * Note that town_gen_hack() plays games with the R.N.G.\n *\n @@ -205,9 +205,9 @@ bool build_type16(void) { for (x = 0; x < cur_wid; x++) { - if (grid_array[y][x].feat == FF_STORE) + if (current_floor->grid_array[y][x].feat == FF_STORE) { - prevent_bm = (f_info[grid_array[y][x].feat].subtype == STORE_BLACK); + prevent_bm = (f_info[current_floor->grid_array[y][x].feat].subtype == STORE_BLACK); break; } } diff --git a/src/rooms-fractal.c b/src/rooms-fractal.c index ecb8f18a9..aae68744b 100644 --- a/src/rooms-fractal.c +++ b/src/rooms-fractal.c @@ -5,7 +5,7 @@ #include "rooms-normal.h" /*! -* @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal grid_array system +* @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal current_floor->grid_array system * @return なし */ bool build_type9(void) diff --git a/src/rooms-normal.c b/src/rooms-normal.c index 4377097d2..ffcf57d9a 100644 --- a/src/rooms-normal.c +++ b/src/rooms-normal.c @@ -62,7 +62,7 @@ bool build_type1(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -72,16 +72,16 @@ bool build_type1(void) /* Walls around the room */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -91,19 +91,19 @@ bool build_type1(void) { for (y = y1; y <= y2; y++) { - g_ptr = &grid_array[y][x1]; + g_ptr = ¤t_floor->grid_array[y][x1]; g_ptr->feat = feat_door[DOOR_CURTAIN].closed; g_ptr->info &= ~(CAVE_MASK); - g_ptr = &grid_array[y][x2]; + g_ptr = ¤t_floor->grid_array[y][x2]; g_ptr->feat = feat_door[DOOR_CURTAIN].closed; g_ptr->info &= ~(CAVE_MASK); } for (x = x1; x <= x2; x++) { - g_ptr = &grid_array[y1][x]; + g_ptr = ¤t_floor->grid_array[y1][x]; g_ptr->feat = feat_door[DOOR_CURTAIN].closed; g_ptr->info &= ~(CAVE_MASK); - g_ptr = &grid_array[y2][x]; + g_ptr = ¤t_floor->grid_array[y2][x]; g_ptr->feat = feat_door[DOOR_CURTAIN].closed; g_ptr->info &= ~(CAVE_MASK); } @@ -117,7 +117,7 @@ bool build_type1(void) { for (x = x1; x <= x2; x += 2) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -128,16 +128,16 @@ bool build_type1(void) { if ((y1 + 4 < y2) && (x1 + 4 < x2)) { - g_ptr = &grid_array[y1 + 1][x1 + 1]; + g_ptr = ¤t_floor->grid_array[y1 + 1][x1 + 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y1 + 1][x2 - 1]; + g_ptr = ¤t_floor->grid_array[y1 + 1][x2 - 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2 - 1][x1 + 1]; + g_ptr = ¤t_floor->grid_array[y2 - 1][x1 + 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2 - 1][x2 - 1]; + g_ptr = ¤t_floor->grid_array[y2 - 1][x2 - 1]; place_inner_grid(g_ptr); } } @@ -147,16 +147,16 @@ bool build_type1(void) { for (y = y1 + 2; y <= y2 - 2; y += 2) { - g_ptr = &grid_array[y][x1]; + g_ptr = ¤t_floor->grid_array[y][x1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2]; + g_ptr = ¤t_floor->grid_array[y][x2]; place_inner_grid(g_ptr); } for (x = x1 + 2; x <= x2 - 2; x += 2) { - g_ptr = &grid_array[y1][x]; + g_ptr = ¤t_floor->grid_array[y1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2][x]; + g_ptr = ¤t_floor->grid_array[y2][x]; place_inner_grid(g_ptr); } } @@ -172,7 +172,7 @@ bool build_type1(void) for (x = x1; x <= x2; x++) { place_inner_bold(yval, x); - if (curtain2) grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed; + if (curtain2) current_floor->grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed; } /* Prevent edge of wall from being tunneled */ @@ -185,7 +185,7 @@ bool build_type1(void) for (y = y1; y <= y2; y++) { place_inner_bold(y, xval); - if (curtain2) grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed; + if (curtain2) current_floor->grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed; } /* Prevent edge of wall from being tunneled */ @@ -194,7 +194,7 @@ bool build_type1(void) } place_random_door(yval, xval, TRUE); - if (curtain2) grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed; + if (curtain2) current_floor->grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed; } return TRUE; @@ -236,7 +236,7 @@ bool build_type2(void) { for (x = x1a - 1; x <= x2a + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -248,7 +248,7 @@ bool build_type2(void) { for (x = x1b - 1; x <= x2b + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -259,32 +259,32 @@ bool build_type2(void) /* Place the walls around room "a" */ for (y = y1a - 1; y <= y2a + 1; y++) { - g_ptr = &grid_array[y][x1a - 1]; + g_ptr = ¤t_floor->grid_array[y][x1a - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2a + 1]; + g_ptr = ¤t_floor->grid_array[y][x2a + 1]; place_outer_grid(g_ptr); } for (x = x1a - 1; x <= x2a + 1; x++) { - g_ptr = &grid_array[y1a - 1][x]; + g_ptr = ¤t_floor->grid_array[y1a - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2a + 1][x]; + g_ptr = ¤t_floor->grid_array[y2a + 1][x]; place_outer_grid(g_ptr); } /* Place the walls around room "b" */ for (y = y1b - 1; y <= y2b + 1; y++) { - g_ptr = &grid_array[y][x1b - 1]; + g_ptr = ¤t_floor->grid_array[y][x1b - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2b + 1]; + g_ptr = ¤t_floor->grid_array[y][x2b + 1]; place_outer_grid(g_ptr); } for (x = x1b - 1; x <= x2b + 1; x++) { - g_ptr = &grid_array[y1b - 1][x]; + g_ptr = ¤t_floor->grid_array[y1b - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2b + 1][x]; + g_ptr = ¤t_floor->grid_array[y2b + 1][x]; place_outer_grid(g_ptr); } @@ -295,7 +295,7 @@ bool build_type2(void) { for (x = x1a; x <= x2a; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); } } @@ -305,7 +305,7 @@ bool build_type2(void) { for (x = x1b; x <= x2b; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); } } @@ -371,7 +371,7 @@ bool build_type3(void) { for (x = x1a - 1; x <= x2a + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -383,7 +383,7 @@ bool build_type3(void) { for (x = x1b - 1; x <= x2b + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -394,32 +394,32 @@ bool build_type3(void) /* Place the walls around room "a" */ for (y = y1a - 1; y <= y2a + 1; y++) { - g_ptr = &grid_array[y][x1a - 1]; + g_ptr = ¤t_floor->grid_array[y][x1a - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2a + 1]; + g_ptr = ¤t_floor->grid_array[y][x2a + 1]; place_outer_grid(g_ptr); } for (x = x1a - 1; x <= x2a + 1; x++) { - g_ptr = &grid_array[y1a - 1][x]; + g_ptr = ¤t_floor->grid_array[y1a - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2a + 1][x]; + g_ptr = ¤t_floor->grid_array[y2a + 1][x]; place_outer_grid(g_ptr); } /* Place the walls around room "b" */ for (y = y1b - 1; y <= y2b + 1; y++) { - g_ptr = &grid_array[y][x1b - 1]; + g_ptr = ¤t_floor->grid_array[y][x1b - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2b + 1]; + g_ptr = ¤t_floor->grid_array[y][x2b + 1]; place_outer_grid(g_ptr); } for (x = x1b - 1; x <= x2b + 1; x++) { - g_ptr = &grid_array[y1b - 1][x]; + g_ptr = ¤t_floor->grid_array[y1b - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2b + 1][x]; + g_ptr = ¤t_floor->grid_array[y2b + 1][x]; place_outer_grid(g_ptr); } @@ -429,7 +429,7 @@ bool build_type3(void) { for (x = x1a; x <= x2a; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); } } @@ -439,7 +439,7 @@ bool build_type3(void) { for (x = x1b; x <= x2b; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); } } @@ -456,7 +456,7 @@ bool build_type3(void) { for (x = x1a; x <= x2a; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -469,16 +469,16 @@ bool build_type3(void) /* Build the vault */ for (y = y1b; y <= y2b; y++) { - g_ptr = &grid_array[y][x1a]; + g_ptr = ¤t_floor->grid_array[y][x1a]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2a]; + g_ptr = ¤t_floor->grid_array[y][x2a]; place_inner_grid(g_ptr); } for (x = x1a; x <= x2a; x++) { - g_ptr = &grid_array[y1b][x]; + g_ptr = ¤t_floor->grid_array[y1b][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2b][x]; + g_ptr = ¤t_floor->grid_array[y2b][x]; place_inner_grid(g_ptr); } @@ -513,9 +513,9 @@ bool build_type3(void) for (y = y1b; y <= y2b; y++) { if (y == yval) continue; - g_ptr = &grid_array[y][x1a - 1]; + g_ptr = ¤t_floor->grid_array[y][x1a - 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2a + 1]; + g_ptr = ¤t_floor->grid_array[y][x2a + 1]; place_inner_grid(g_ptr); } @@ -523,9 +523,9 @@ bool build_type3(void) for (x = x1a; x <= x2a; x++) { if (x == xval) continue; - g_ptr = &grid_array[y1b - 1][x]; + g_ptr = ¤t_floor->grid_array[y1b - 1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2b + 1][x]; + g_ptr = ¤t_floor->grid_array[y2b + 1][x]; place_inner_grid(g_ptr); } @@ -546,22 +546,22 @@ bool build_type3(void) /* Occasionally put a "plus" in the center */ else if (one_in_(3)) { - g_ptr = &grid_array[yval][xval]; + g_ptr = ¤t_floor->grid_array[yval][xval]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y1b][xval]; + g_ptr = ¤t_floor->grid_array[y1b][xval]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2b][xval]; + g_ptr = ¤t_floor->grid_array[y2b][xval]; place_inner_grid(g_ptr); - g_ptr = &grid_array[yval][x1a]; + g_ptr = ¤t_floor->grid_array[yval][x1a]; place_inner_grid(g_ptr); - g_ptr = &grid_array[yval][x2a]; + g_ptr = ¤t_floor->grid_array[yval][x2a]; place_inner_grid(g_ptr); } /* Occasionally put a pillar in the center */ else if (one_in_(3)) { - g_ptr = &grid_array[yval][xval]; + g_ptr = ¤t_floor->grid_array[yval][xval]; place_inner_grid(g_ptr); } @@ -608,7 +608,7 @@ bool build_type4(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -618,16 +618,16 @@ bool build_type4(void) /* Outer Walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -641,16 +641,16 @@ bool build_type4(void) /* The inner walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_inner_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_inner_grid(g_ptr); } @@ -694,7 +694,7 @@ bool build_type4(void) for (x = xval - 1; x <= xval + 1; x++) { if ((x == xval) && (y == yval)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -746,7 +746,7 @@ bool build_type4(void) { for (x = xval - 1; x <= xval + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -759,12 +759,12 @@ bool build_type4(void) { for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } for (x = xval + 3 + tmp; x <= xval + 5 + tmp; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -780,16 +780,16 @@ bool build_type4(void) /* Long horizontal walls */ for (x = xval - 5; x <= xval + 5; x++) { - g_ptr = &grid_array[yval - 1][x]; + g_ptr = ¤t_floor->grid_array[yval - 1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[yval + 1][x]; + g_ptr = ¤t_floor->grid_array[yval + 1][x]; place_inner_grid(g_ptr); } /* Close off the left/right edges */ - g_ptr = &grid_array[yval][xval - 5]; + g_ptr = ¤t_floor->grid_array[yval][xval - 5]; place_inner_grid(g_ptr); - g_ptr = &grid_array[yval][xval + 5]; + g_ptr = ¤t_floor->grid_array[yval][xval + 5]; place_inner_grid(g_ptr); /* Secret doors (random top/bottom) */ @@ -827,7 +827,7 @@ bool build_type4(void) { if (0x1 & (x + y)) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); } } @@ -857,12 +857,12 @@ bool build_type4(void) /* Inner "cross" */ for (y = y1; y <= y2; y++) { - g_ptr = &grid_array[y][xval]; + g_ptr = ¤t_floor->grid_array[y][xval]; place_inner_grid(g_ptr); } for (x = x1; x <= x2; x++) { - g_ptr = &grid_array[yval][x]; + g_ptr = ¤t_floor->grid_array[yval][x]; place_inner_grid(g_ptr); } @@ -984,7 +984,7 @@ bool build_type12(void) for (y = y0 - rad; y <= y0 + rad; y++) { /* clear room flag */ - grid_array[y][x].info &= ~(CAVE_ROOM); + current_floor->grid_array[y][x].info &= ~(CAVE_ROOM); if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) { diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index f68d190ad..80c1c4bb5 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -345,7 +345,7 @@ bool build_type5(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -354,16 +354,16 @@ bool build_type5(void) /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -377,17 +377,17 @@ bool build_type5(void) /* The inner walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_inner_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_inner_grid(g_ptr); } for (y = y1; y <= y2; y++) @@ -555,7 +555,7 @@ bool build_type6(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -564,16 +564,16 @@ bool build_type6(void) /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -586,16 +586,16 @@ bool build_type6(void) /* The inner walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_inner_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_inner_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_inner_grid(g_ptr); } for (y = y1; y <= y2; y++) @@ -863,7 +863,7 @@ bool build_type13(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); } @@ -872,11 +872,11 @@ bool build_type13(void) /* Place the floor area 1 */ for (x = x1 + 3; x <= x2 - 3; x++) { - g_ptr = &grid_array[yval - 2][x]; + g_ptr = ¤t_floor->grid_array[yval - 2][x]; place_floor_grid(g_ptr); add_cave_info(yval - 2, x, CAVE_ICKY); - g_ptr = &grid_array[yval + 2][x]; + g_ptr = ¤t_floor->grid_array[yval + 2][x]; place_floor_grid(g_ptr); add_cave_info(yval + 2, x, CAVE_ICKY); } @@ -884,11 +884,11 @@ bool build_type13(void) /* Place the floor area 2 */ for (x = x1 + 5; x <= x2 - 5; x++) { - g_ptr = &grid_array[yval - 3][x]; + g_ptr = ¤t_floor->grid_array[yval - 3][x]; place_floor_grid(g_ptr); add_cave_info(yval - 3, x, CAVE_ICKY); - g_ptr = &grid_array[yval + 3][x]; + g_ptr = ¤t_floor->grid_array[yval + 3][x]; place_floor_grid(g_ptr); add_cave_info(yval + 3, x, CAVE_ICKY); } @@ -896,27 +896,27 @@ bool build_type13(void) /* Corridor */ for (x = x1; x <= x2; x++) { - g_ptr = &grid_array[yval][x]; + g_ptr = ¤t_floor->grid_array[yval][x]; place_floor_grid(g_ptr); - g_ptr = &grid_array[y1][x]; + g_ptr = ¤t_floor->grid_array[y1][x]; place_floor_grid(g_ptr); - g_ptr = &grid_array[y2][x]; + g_ptr = ¤t_floor->grid_array[y2][x]; place_floor_grid(g_ptr); } /* Place the outer walls */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -949,8 +949,8 @@ bool build_type13(void) } /* Place the wall open trap */ - grid_array[yval][xval].mimic = grid_array[yval][xval].feat; - grid_array[yval][xval].feat = feat_trap_open; + current_floor->grid_array[yval][xval].mimic = current_floor->grid_array[yval][xval].feat; + current_floor->grid_array[yval][xval].feat = feat_trap_open; /* Sort the entries */ for (i = 0; i < 16 - 1; i++) diff --git a/src/rooms-special.c b/src/rooms-special.c index e16626bc7..b028849c6 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -41,7 +41,7 @@ bool build_type15(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->feat = feat_glass_floor; g_ptr->info |= (CAVE_ROOM); @@ -52,19 +52,19 @@ bool build_type15(void) /* Walls around the room */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -88,7 +88,7 @@ bool build_type15(void) /* Walls around the breather */ for (dir2 = 0; dir2 < 8; dir2++) { - g_ptr = &grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]]; + g_ptr = ¤t_floor->grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -99,10 +99,10 @@ bool build_type15(void) { y = yval + 2 * ddy_ddd[dir1]; x = xval + 2 * ddx_ddd[dir1]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_inner_perm_grid(g_ptr); g_ptr->feat = feat_permanent_glass_wall; - grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY); + current_floor->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY); } /* Glass door */ @@ -110,13 +110,13 @@ bool build_type15(void) y = yval + 2 * ddy_ddd[dir1]; x = xval + 2 * ddx_ddd[dir1]; place_secret_door(y, x, DOOR_GLASS_DOOR); - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall; /* Place a potion */ get_obj_num_hook = kind_is_potion; place_object(yval, xval, AM_NO_FIXED_ART); - grid_array[yval][xval].info |= (CAVE_ICKY); + current_floor->grid_array[yval][xval].info |= (CAVE_ICKY); } break; @@ -126,19 +126,19 @@ bool build_type15(void) DIRECTION dir1; /* Pillars */ - g_ptr = &grid_array[y1 + 1][x1 + 1]; + g_ptr = ¤t_floor->grid_array[y1 + 1][x1 + 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y1 + 1][x2 - 1]; + g_ptr = ¤t_floor->grid_array[y1 + 1][x2 - 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y2 - 1][x1 + 1]; + g_ptr = ¤t_floor->grid_array[y2 - 1][x1 + 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y2 - 1][x2 - 1]; + g_ptr = ¤t_floor->grid_array[y2 - 1][x2 - 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; get_mon_num_prep(vault_aux_lite, NULL); @@ -149,7 +149,7 @@ bool build_type15(void) /* Walls around the breather */ for (dir1 = 0; dir1 < 8; dir1++) { - g_ptr = &grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]]; + g_ptr = ¤t_floor->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -168,7 +168,7 @@ bool build_type15(void) /* Place an object */ place_object(yval, xval, AM_NO_FIXED_ART); - grid_array[yval][xval].info |= (CAVE_ICKY); + current_floor->grid_array[yval][xval].info |= (CAVE_ICKY); } break; @@ -179,25 +179,25 @@ bool build_type15(void) /* Walls around the potion */ for (y = yval - 2; y <= yval + 2; y++) { - g_ptr = &grid_array[y][xval - 3]; + g_ptr = ¤t_floor->grid_array[y][xval - 3]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[y][xval + 3]; + g_ptr = ¤t_floor->grid_array[y][xval + 3]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (x = xval - 2; x <= xval + 2; x++) { - g_ptr = &grid_array[yval - 3][x]; + g_ptr = ¤t_floor->grid_array[yval - 3][x]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = &grid_array[yval + 3][x]; + g_ptr = ¤t_floor->grid_array[yval + 3][x]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (dir1 = 4; dir1 < 8; dir1++) { - g_ptr = &grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]]; + g_ptr = ¤t_floor->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -231,7 +231,7 @@ bool build_type15(void) for (y = yval - 2; y <= yval + 2; y++) for (x = xval - 2; x <= xval + 2; x++) - grid_array[y][x].info |= (CAVE_ICKY); + current_floor->grid_array[y][x].info |= (CAVE_ICKY); } break; diff --git a/src/rooms-trap.c b/src/rooms-trap.c index 15e711706..6498d5570 100644 --- a/src/rooms-trap.c +++ b/src/rooms-trap.c @@ -48,7 +48,7 @@ bool build_type14(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -58,16 +58,16 @@ bool build_type14(void) /* Walls around the room */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = &grid_array[y][x1 - 1]; + g_ptr = ¤t_floor->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y][x2 + 1]; + g_ptr = ¤t_floor->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y1 - 1][x]; + g_ptr = ¤t_floor->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = &grid_array[y2 + 1][x]; + g_ptr = ¤t_floor->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } @@ -77,7 +77,7 @@ bool build_type14(void) trap = feat_trap_armageddon; /* Place a special trap */ - g_ptr = &grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; + g_ptr = ¤t_floor->grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; g_ptr->mimic = g_ptr->feat; g_ptr->feat = trap; diff --git a/src/rooms-vault.c b/src/rooms-vault.c index b38da2226..e50ad3676 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -70,9 +70,9 @@ static void build_bubble_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO int side_x = x0 - xhsize + i; place_outer_noperm_bold(y0 - yhsize + 0, side_x); - grid_array[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y0 - yhsize + ysize - 1, side_x); - grid_array[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY); } /* Left and right boundaries */ @@ -81,9 +81,9 @@ static void build_bubble_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO int side_y = y0 - yhsize + i; place_outer_noperm_bold(side_y, x0 - xhsize + 0); - grid_array[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(side_y, x0 - xhsize + xsize - 1); - grid_array[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY); } /* Fill in middle with bubbles */ @@ -133,7 +133,7 @@ static void build_bubble_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO } /* clean up rest of flags */ - grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= (CAVE_ROOM | CAVE_ICKY); } } @@ -171,7 +171,7 @@ static void build_room_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION POSITION y = y0 - yhsize + y1; place_extra_bold(y, x); - grid_array[y][x].info &= (~CAVE_ICKY); + current_floor->grid_array[y][x].info &= (~CAVE_ICKY); } } @@ -198,7 +198,7 @@ static void build_room_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION } -/* Create a random vault out of a fractal grid_array */ +/* Create a random vault out of a fractal current_floor->grid_array */ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz) { int grd, roug, cutoff; @@ -240,7 +240,7 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y { for (y = 0; y <= ysize; y++) { - grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; + current_floor->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; } } @@ -340,7 +340,7 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm /* Hack -- skip "non-grids" */ if (*t == ' ') continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Lay down a floor */ place_floor_grid(g_ptr); @@ -819,10 +819,10 @@ static void build_target_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO for (y = y0 - rad; y <= y0 + rad; y++) { /* clear room flag */ - grid_array[y][x].info &= ~(CAVE_ROOM); + current_floor->grid_array[y][x].info &= ~(CAVE_ROOM); /* Vault - so is "icky" */ - grid_array[y][x].info |= CAVE_ICKY; + current_floor->grid_array[y][x].info |= CAVE_ICKY; if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) { @@ -982,7 +982,7 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT { for (y = 0; y <= ysize; y++) { - grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; + current_floor->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; } } @@ -1031,7 +1031,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { if (!in_bounds(y1 - 2, x)) break; - grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y1 - 2, x); } @@ -1040,7 +1040,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { if (!in_bounds(y2 + 2, x)) break; - grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y2 + 2, x); } @@ -1049,7 +1049,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { if (!in_bounds(y, x1 - 2)) break; - grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y, x1 - 2); } @@ -1058,7 +1058,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { if (!in_bounds(y, x2 + 2)) break; - grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y, x2 + 2); } @@ -1067,7 +1067,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { for (x = x1 - 1; x <= x2 + 1; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; g_ptr->info |= (CAVE_ROOM | CAVE_ICKY); @@ -1152,7 +1152,7 @@ static void build_castle_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { for (x = x1 - 1; x <= x2 + 1; x++) { - grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY); /* Make everything a floor */ place_floor_bold(y, x); } diff --git a/src/rooms.c b/src/rooms.c index c1173d7ba..54bcc7579 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -183,7 +183,7 @@ void build_small_room(POSITION x0, POSITION y0) } /* Clear mimic type */ - grid_array[y0][x0].mimic = 0; + current_floor->grid_array[y0][x0].mimic = 0; /* Add inner open space */ place_floor_bold(y0, x0); @@ -192,7 +192,7 @@ void build_small_room(POSITION x0, POSITION y0) /*! * @brief * 指定範囲に通路が通っていることを確認した上で床で埋める - * This function tunnels around a room if it will cut off part of a grid_array system. + * This function tunnels around a room if it will cut off part of a current_floor->grid_array system. * @param x1 範囲の左端 * @param y1 範囲の上端 * @param x2 範囲の右端 @@ -521,7 +521,7 @@ struct fill_data_type static fill_data_type fill_data; -/* Store routine for the fractal grid_array generator */ +/* Store routine for the fractal current_floor->grid_array generator */ /* this routine probably should be an inline function or a macro. */ static void store_height(POSITION x, POSITION y, FEAT_IDX val) { @@ -531,7 +531,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) (val <= fill_data.c1)) val = fill_data.c1 + 1; /* store the value in height-map format */ - grid_array[y][x].feat = val; + current_floor->grid_array[y][x].feat = val; return; } @@ -564,7 +564,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * * How fractal caves are made: * -* When the map is complete, a cut-off value is used to create a grid_array. +* When the map is complete, a cut-off value is used to create a current_floor->grid_array. * Heights below this value are "floor", and heights above are "wall". * This also can be used to create lakes, by adding more height levels * representing shallow and deep water/ lava etc. @@ -572,7 +572,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * The grd variable affects the width of passages. * The roug variable affects the roughness of those passages * -* The tricky part is making sure the created grid_array is connected. This +* The tricky part is making sure the created current_floor->grid_array is connected. This * is done by 'filling' from the inside and only keeping the 'filled' * floor. Walls bounding the 'filled' floor are also kept. Everything * else is converted to the normal _extra_. @@ -580,7 +580,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) /* - * Note that this uses the grid_array.feat array in a very hackish way + * Note that this uses the current_floor->grid_array.feat array in a very hackish way * the values are first set to zero, and then each array location * is used as a "heightmap" * The heightmap then needs to be converted back into the "feat" format. @@ -588,7 +588,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * grd=level at which fractal turns on. smaller gives more mazelike caves * roug=roughness level. 16=normal. higher values make things more convoluted * small values are good for smooth walls. - * size=length of the side of the square grid_array system. + * size=length of the side of the square current_floor->grid_array system. */ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff) { @@ -649,20 +649,20 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g for (j = 0; j <= ysize; j++) { /* -1 is a flag for "not done yet" */ - grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1; - /* Clear icky flag because may be redoing the grid_array */ - grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY); + current_floor->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1; + /* Clear icky flag because may be redoing the current_floor->grid_array */ + current_floor->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY); } } /* Boundaries are walls */ - grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize; - grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize; - grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize; - grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize; + current_floor->grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize; + current_floor->grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize; + current_floor->grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize; + current_floor->grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize; /* Set the middle square to be an open area. */ - grid_array[y0][x0].feat = 0; + current_floor->grid_array[y0][x0].feat = 0; /* Initialize the step sizes */ xstep = xhstep = xsize * 256; @@ -699,7 +699,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (grid_array[jj][ii].feat == -1) + if (current_floor->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -710,8 +710,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g { /* Average of left and right points +random bit */ store_height(ii, jj, - (grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat - + grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2 + (current_floor->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat + + current_floor->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2 + (randint1(xstep2) - xhstep2) * roug / 16); } } @@ -729,7 +729,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (grid_array[jj][ii].feat == -1) + if (current_floor->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -740,8 +740,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g { /* Average of up and down points +random bit */ store_height(ii, jj, - (grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat - + grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2 + (current_floor->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat + + current_floor->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2 + (randint1(ystep2) - yhstep2) * roug / 16); } } @@ -758,7 +758,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (grid_array[jj][ii].feat == -1) + if (current_floor->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -778,8 +778,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g * reduce the effect of the square grid on the shape of the fractal */ store_height(ii, jj, - (grid_array[ym][xm].feat + grid_array[yp][xm].feat - + grid_array[ym][xp].feat + grid_array[yp][xp].feat) / 4 + (current_floor->grid_array[ym][xm].feat + current_floor->grid_array[yp][xm].feat + + current_floor->grid_array[ym][xp].feat + current_floor->grid_array[yp][xp].feat) / 4 + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug); } } @@ -793,9 +793,9 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, FEAT_ { /* * function used to convert from height-map back to the - * normal angband grid_array format + * normal angband current_floor->grid_array format */ - if (grid_array[y][x].info & CAVE_ICKY) + if (current_floor->grid_array[y][x].info & CAVE_ICKY) { /* already done */ return FALSE; @@ -803,50 +803,50 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, FEAT_ else { /* Show that have looked at this square */ - grid_array[y][x].info|= (CAVE_ICKY); + current_floor->grid_array[y][x].info|= (CAVE_ICKY); /* Use cutoffs c1-c3 to allocate regions of floor /water/ lava etc. */ - if (grid_array[y][x].feat <= c1) + if (current_floor->grid_array[y][x].feat <= c1) { /* 25% of the time use the other tile : it looks better this way */ if (randint1(100) < 75) { - grid_array[y][x].feat = feat1; - grid_array[y][x].info &= ~(CAVE_MASK); - grid_array[y][x].info |= info1; + current_floor->grid_array[y][x].feat = feat1; + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info |= info1; return TRUE; } else { - grid_array[y][x].feat = feat2; - grid_array[y][x].info &= ~(CAVE_MASK); - grid_array[y][x].info |= info2; + current_floor->grid_array[y][x].feat = feat2; + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info |= info2; return TRUE; } } - else if (grid_array[y][x].feat <= c2) + else if (current_floor->grid_array[y][x].feat <= c2) { /* 25% of the time use the other tile : it looks better this way */ if (randint1(100) < 75) { - grid_array[y][x].feat = feat2; - grid_array[y][x].info &= ~(CAVE_MASK); - grid_array[y][x].info |= info2; + current_floor->grid_array[y][x].feat = feat2; + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info |= info2; return TRUE; } else { - grid_array[y][x].feat = feat1; - grid_array[y][x].info &= ~(CAVE_MASK); - grid_array[y][x].info |= info1; + current_floor->grid_array[y][x].feat = feat1; + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info |= info1; return TRUE; } } - else if (grid_array[y][x].feat <= c3) + else if (current_floor->grid_array[y][x].feat <= c3) { - grid_array[y][x].feat = feat3; - grid_array[y][x].info &= ~(CAVE_MASK); - grid_array[y][x].info |= info3; + current_floor->grid_array[y][x].feat = feat3; + current_floor->grid_array[y][x].info &= ~(CAVE_MASK); + current_floor->grid_array[y][x].info |= info3; return TRUE; } /* if greater than cutoff then is a wall */ @@ -863,7 +863,7 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, FEAT_ /* * Quick and nasty fill routine used to find the connected region - * of floor in the middle of the grid_array + * of floor in the middle of the current_floor->grid_array */ static void cave_fill(POSITION y, POSITION x) { @@ -899,11 +899,11 @@ static void cave_fill(POSITION y, POSITION x) j = ty + ddy_ddd[d]; i = tx + ddx_ddd[d]; - /* Paranoia Don't leave the grid_array */ + /* Paranoia Don't leave the current_floor->grid_array */ if (!in_bounds(j, i)) { /* affect boundary */ - grid_array[j][i].info |= CAVE_ICKY; + current_floor->grid_array[j][i].info |= CAVE_ICKY; /* return; */ } @@ -931,7 +931,7 @@ static void cave_fill(POSITION y, POSITION x) } else { - /* keep tally of size of grid_array system */ + /* keep tally of size of current_floor->grid_array system */ (fill_data.amount)++; } } @@ -939,7 +939,7 @@ static void cave_fill(POSITION y, POSITION x) else { /* affect boundary */ - grid_array[j][i].info |= CAVE_ICKY; + current_floor->grid_array[j][i].info |= CAVE_ICKY; } } } @@ -957,7 +957,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, /* - * select region connected to center of grid_array system + * select region connected to center of current_floor->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ @@ -990,7 +990,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (y = 0; y <= ysize; ++y) { place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } return FALSE; @@ -1004,12 +1004,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (i = 0; i <= xsize; ++i) { /* top boundary */ - if ((grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) + if ((current_floor->grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) { /* Next to a 'filled' region? - set to be room walls */ place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize); - if (light) grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW); - grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM); + if (light) current_floor->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW); + current_floor->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize); } else @@ -1019,12 +1019,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* bottom boundary */ - if ((grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) + if ((current_floor->grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) { /* Next to a 'filled' region? - set to be room walls */ place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize); - if (light) grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW); - grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM); + if (light) current_floor->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW); + current_floor->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM); place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize); } else @@ -1034,20 +1034,20 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* clear the icky flag-don't need it any more */ - grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); - grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); } /* Do the left and right boundaries minus the corners (done above) */ for (i = 1; i < ysize; ++i) { /* left boundary */ - if ((grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room) + if ((current_floor->grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room) { /* room boundary */ place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize); - if (light) grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW); - grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM); + if (light) current_floor->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW); + current_floor->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize); } else @@ -1056,12 +1056,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, place_extra_bold(y0 + i - yhsize, x0 + 0 - xhsize); } /* right boundary */ - if ((grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room) + if ((current_floor->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room) { /* room boundary */ place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize); - if (light) grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW); - grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM); + if (light) current_floor->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW); + current_floor->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize); } else @@ -1071,8 +1071,8 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* clear icky flag -done with it */ - grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); - grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); } @@ -1082,37 +1082,37 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (y = 1; y < ysize; ++y) { if (is_floor_bold(y0 + y - yhsize, x0 + x - xhsize) && - (grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) + (current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) { /* Clear the icky flag in the filled region */ - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY; + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY; /* Set appropriate flags */ - if (light) grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); - if (room) grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); + if (light) current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); + if (room) current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); } else if (is_outer_bold(y0 + y - yhsize, x0 + x - xhsize) && - (grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) + (current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) { /* Walls */ - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); - if (light) grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); + if (light) current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); if (room) { - grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); } else { place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM); } } else { /* Clear the unconnected regions */ place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } } @@ -1133,7 +1133,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, #ifdef ALLOW_CAVERNS_AND_LAKES /* - * Builds a grid_array system in the center of the dungeon. + * Builds a current_floor->grid_array system in the center of the dungeon. */ void build_cavern(void) { @@ -1144,7 +1144,7 @@ void build_cavern(void) light = done = FALSE; if ((dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; - /* Make a grid_array the size of the dungeon */ + /* Make a current_floor->grid_array the size of the dungeon */ xsize = cur_wid - 1; ysize = cur_hgt - 1; x0 = xsize / 2; @@ -1196,7 +1196,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int feat2 = feat_shallow_water; feat3 = feat_ground_type[randint0(100)]; break; - case LAKE_T_CAVE: /* Collapsed grid_array */ + case LAKE_T_CAVE: /* Collapsed current_floor->grid_array */ feat1 = feat_ground_type[randint0(100)]; feat2 = feat_ground_type[randint0(100)]; feat3 = feat_rubble; @@ -1227,7 +1227,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int } /* - * select region connected to center of grid_array system + * select region connected to center of current_floor->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ @@ -1249,7 +1249,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int /* number of filled squares */ fill_data.amount = 0; - /* select region connected to center of grid_array system + /* select region connected to center of current_floor->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ cave_fill((byte)y0, (byte)x0); @@ -1263,7 +1263,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int for (y = 0; y <= ysize; ++y) { place_floor_bold(y0 + y - yhsize, x0 + x - xhsize); - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); } } return FALSE; @@ -1276,8 +1276,8 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int place_extra_bold(y0 + ysize - yhsize, x0 + i - xhsize); /* clear the icky flag-don't need it any more */ - grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); - grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); } /* Do the left and right boundaries minus the corners (done above) */ @@ -1288,8 +1288,8 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int place_extra_bold(y0 + i - yhsize, x0 + xsize - xhsize); /* clear icky flag -done with it */ - grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); - grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); + current_floor->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); } @@ -1299,17 +1299,17 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int for (y = 1; y < ysize; ++y) { /* Fill unconnected regions with granite */ - if ((!(grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) || + if ((!(current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) || is_outer_bold(y0 + y - yhsize, x0 + x - xhsize)) place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); /* turn off icky flag (no longer needed.) */ - grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); /* Light lava */ if (cave_have_flag_bold(y0 + y - yhsize, x0 + x - xhsize, FF_LAVA)) { - if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) current_floor->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; } } } @@ -1319,7 +1319,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int /* - * makes a lake/collapsed grid_array system in the center of the dungeon + * makes a lake/collapsed current_floor->grid_array system in the center of the dungeon */ void build_lake(int type) { @@ -1548,18 +1548,18 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) for (i = 0; i <= xsize; i++) { place_outer_noperm_bold(y1, x1 + i); - grid_array[y1][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y2, x1 + i); - grid_array[y2][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y2][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); } /* Left and right boundaries */ for (i = 1; i < ysize; i++) { place_outer_noperm_bold(y1 + i, x1); - grid_array[y1 + i][x1].info|=(CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1 + i][x1].info|=(CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y1 + i, x2); - grid_array[y1 + i][x2].info|=(CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1 + i][x2].info|=(CAVE_ROOM | CAVE_ICKY); } /* Middle */ @@ -1571,12 +1571,12 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) { /* clear the untouched region */ place_floor_bold(y1 + y, x1 + x); - grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); } else { /* make it a room- but don't touch */ - grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); + current_floor->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); } } } @@ -1713,7 +1713,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; g_ptr->info |= CAVE_ROOM; if (is_vault) g_ptr->info |= CAVE_ICKY; if ((x == x1 - 1) || (x == x2 + 1) || (y == y1 - 1) || (y == y2 + 1)) @@ -1969,7 +1969,7 @@ void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, if (!in_bounds(y, x)) return; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* hack- check to see if square has been visited before * if so, then exit (use room flag to do this) */ @@ -2049,7 +2049,7 @@ void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int for (x = x1; x <= x2; x++) { /* Point to grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -2135,7 +2135,7 @@ bool generate_rooms(void) /* Limit number of rooms */ int dun_rooms = DUN_ROOMS_MAX * area_size / 100; - /* Assume normal grid_array */ + /* Assume normal current_floor->grid_array */ room_info_type *room_info_ptr = room_info_normal; /* @@ -2192,7 +2192,7 @@ bool generate_rooms(void) MOVE_PLIST(ROOM_T_INNER_FEAT, ROOM_T_OVAL); } - /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc grid_array etc.) */ + /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc current_floor->grid_array etc.) */ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVE) { MOVE_PLIST(ROOM_T_FRACAVE, ROOM_T_NORMAL); diff --git a/src/rooms.h b/src/rooms.h index ef166adef..39485f59f 100644 --- a/src/rooms.h +++ b/src/rooms.h @@ -31,7 +31,7 @@ #define ROOM_T_PIT 5 /*!<部屋型ID:モンスターPIT / Monster pit (33x11) */ #define ROOM_T_LESSER_VAULT 6 /*!<部屋型ID:小型VAULT / Lesser vault (33x22) */ #define ROOM_T_GREATER_VAULT 7 /*!<部屋型ID:大型VAULT / Greater vault (66x44) */ -#define ROOM_T_FRACAVE 8 /*!<部屋型ID:フラクタル地形 / Fractal grid_array (42x24) */ +#define ROOM_T_FRACAVE 8 /*!<部屋型ID:フラクタル地形 / Fractal current_floor->grid_array (42x24) */ #define ROOM_T_RANDOM_VAULT 9 /*!<部屋型ID:ランダムVAULT / Random vault (44x22) */ #define ROOM_T_OVAL 10 /*!<部屋型ID:円形部屋 / Circular rooms (22x22) */ #define ROOM_T_CRYPT 11 /*!<部屋型ID:聖堂 / Crypts (22x22) */ diff --git a/src/save.c b/src/save.c index d7b1e8684..f961c5872 100644 --- a/src/save.c +++ b/src/save.c @@ -851,8 +851,8 @@ static void wr_extra(void) /*! - * @brief フロア保存時のgrid_array情報テンプレートをソートするための比較処理 - * @param u grid_arrayテンプレートの参照ポインタ + * @brief フロア保存時のcurrent_floor->grid_array情報テンプレートをソートするための比較処理 + * @param u current_floor->grid_arrayテンプレートの参照ポインタ * @param v 未使用 * @param a スワップするモンスター種族のID1 * @param b スワップするモンスター種族のID2 @@ -873,8 +873,8 @@ static bool ang_sort_comp_cave_temp(vptr u, vptr v, int a, int b) /*! - * @brief フロア保存時のgrid_array情報テンプレートをソートするためのスワップ処理 / Sorting hook -- Swap function - * @param u grid_arrayテンプレートの参照ポインタ + * @brief フロア保存時のcurrent_floor->grid_array情報テンプレートをソートするためのスワップ処理 / Sorting hook -- Swap function + * @param u current_floor->grid_arrayテンプレートの参照ポインタ * @param v 未使用 * @param a スワップするモンスター種族のID1 * @param b スワップするモンスター種族のID2 @@ -973,7 +973,7 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; for (i = 0; i < num_temp; i++) { @@ -1042,18 +1042,18 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) - /*** "Run-Length-Encoding" of grid_array ***/ + /*** "Run-Length-Encoding" of current_floor->grid_array ***/ /* Note that this will induce two wasted bytes */ count = 0; prev_u16b = 0; - /* Dump the grid_array */ + /* Dump the current_floor->grid_array */ for (y = 0; y < cur_hgt; y++) { for (x = 0; x < cur_wid; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; for (i = 0; i < num_temp; i++) { diff --git a/src/shoot.c b/src/shoot.c index 33d1099f9..f574265b9 100644 --- a/src/shoot.c +++ b/src/shoot.c @@ -519,7 +519,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) /* Shatter Arrow */ if (snipe_type == SP_KILL_WALL) { - g_ptr = &grid_array[ny][nx]; + g_ptr = ¤t_floor->grid_array[ny][nx]; if (cave_have_flag_grid(g_ptr, FF_HURT_ROCK) && !g_ptr->m_idx) { @@ -537,7 +537,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) } /* Stopped by walls/doors */ - if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !grid_array[ny][nx].m_idx) break; + if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !current_floor->grid_array[ny][nx].m_idx) break; /* Advance the distance */ cur_dis++; @@ -545,7 +545,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) /* Sniper */ if (snipe_type == SP_LITE) { - grid_array[ny][nx].info |= (CAVE_GLOW); + current_floor->grid_array[ny][nx].info |= (CAVE_GLOW); note_spot(ny, nx); lite_spot(ny, nx); } @@ -582,7 +582,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) /* Sniper */ if (snipe_type == SP_EVILNESS) { - grid_array[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); note_spot(ny, nx); lite_spot(ny, nx); } @@ -595,9 +595,9 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) y = ny; /* Monster here, Try to hit it */ - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { - grid_type *c_mon_ptr = &grid_array[y][x]; + grid_type *c_mon_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[c_mon_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -718,7 +718,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) /* Sniper */ if (snipe_type == SP_HOLYNESS) { - grid_array[ny][nx].info |= (CAVE_GLOW); + current_floor->grid_array[ny][nx].info |= (CAVE_GLOW); note_spot(ny, nx); lite_spot(ny, nx); } @@ -779,13 +779,13 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) if (!in_bounds2(ny, nx)) break; /* Stopped by walls/doors */ - if (!player_can_enter(grid_array[ny][nx].feat, 0)) break; + if (!player_can_enter(current_floor->grid_array[ny][nx].feat, 0)) break; /* Stopped by monsters */ if (!cave_empty_bold(ny, nx)) break; - grid_array[ny][nx].m_idx = m_idx; - grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[ny][nx].m_idx = m_idx; + current_floor->grid_array[oy][ox].m_idx = 0; m_ptr->fx = nx; m_ptr->fy = ny; @@ -825,7 +825,7 @@ void exe_fire(INVENTORY_IDX item, object_type *j_ptr) if (stick_to) { - MONSTER_IDX m_idx = grid_array[y][x].m_idx; + MONSTER_IDX m_idx = current_floor->grid_array[y][x].m_idx; monster_type *m_ptr = &m_list[m_idx]; OBJECT_IDX o_idx = o_pop(); diff --git a/src/spells-floor.c b/src/spells-floor.c index 5c6b36f93..814ceeb9a 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -45,7 +45,7 @@ void wiz_lite(bool ninja) /* Scan all normal grids */ for (x = 1; x < cur_wid - 1; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Memorize terrain of the grid */ g_ptr->info |= (CAVE_KNOWN); @@ -62,7 +62,7 @@ void wiz_lite(bool ninja) { POSITION yy = y + ddy_ddd[i]; POSITION xx = x + ddx_ddd[i]; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Feature code (applying "mimic" field) */ f_ptr = &f_info[get_feat_mimic(g_ptr)]; @@ -101,7 +101,7 @@ void wiz_lite(bool ninja) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -119,7 +119,7 @@ void wiz_dark(void) { for (x = 1; x < cur_wid - 1; x++) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Process the grid */ g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN); @@ -130,15 +130,15 @@ void wiz_dark(void) /* Forget every grid on horizontal edge */ for (x = 0; x < cur_wid; x++) { - grid_array[0][x].info &= ~(CAVE_MARK); - grid_array[cur_hgt - 1][x].info &= ~(CAVE_MARK); + current_floor->grid_array[0][x].info &= ~(CAVE_MARK); + current_floor->grid_array[cur_hgt - 1][x].info &= ~(CAVE_MARK); } /* Forget every grid on vertical edge */ for (y = 1; y < (cur_hgt - 1); y++) { - grid_array[y][0].info &= ~(CAVE_MARK); - grid_array[y][cur_wid - 1].info &= ~(CAVE_MARK); + current_floor->grid_array[y][0].info &= ~(CAVE_MARK); + current_floor->grid_array[y][cur_wid - 1].info &= ~(CAVE_MARK); } /* Forget all objects */ diff --git a/src/spells-object.c b/src/spells-object.c index a6534e928..ee2bcd5d5 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -114,7 +114,7 @@ bool create_ammo(void) if (!get_rep_dir(&dir, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_CAN_DIG)) { diff --git a/src/spells-status.c b/src/spells-status.c index 117dc2ddd..4b9dfddcf 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -406,10 +406,10 @@ bool fishing(player_type *creature_ptr) msg_print(_("そこは水辺ではない。", "There is no fishing place.")); return FALSE; } - else if (grid_array[y][x].m_idx) + else if (current_floor->grid_array[y][x].m_idx) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0); + monster_desc(m_name, &m_list[current_floor->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/spells1.c b/src/spells1.c index 6c273d2ea..0eabaa17d 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -64,7 +64,7 @@ static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSIT { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x])) { + if (is_mirror_grid(¤t_floor->grid_array[y][x])) { mirror_y[mirror_num] = y; mirror_x[mirror_num] = x; mirror_num++; @@ -122,7 +122,7 @@ static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */ */ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool obvious = FALSE; @@ -466,7 +466,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P if (in_bounds2(by, bx)) { - grid_type *cc_ptr = &grid_array[by][bx]; + grid_type *cc_ptr = ¤t_floor->grid_array[by][bx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { @@ -615,7 +615,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P */ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -995,7 +995,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P { int tmp; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[g_ptr->m_idx]; monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL; @@ -3610,7 +3610,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P x = m_ptr->fx; /* Hack -- get new grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; } /* Fear */ @@ -5656,7 +5656,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da } } if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE; - if (is_mirror_grid(&grid_array[y][x])) + if (is_mirror_grid(¤t_floor->grid_array[y][x])) { /* The target of monsterspell becomes tha mirror(broken) */ monster_target_y = y; @@ -5672,13 +5672,13 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da x = GRID_X(path_g[j]); if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE; if (!who && (project_m_n == 1) && !jump) { - if (grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx]; + if (current_floor->grid_array[project_m_y][project_m_x].m_idx > 0) { + monster_type *m_ptr = &m_list[current_floor->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(grid_array[project_m_y][project_m_x].m_idx); + health_track(current_floor->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -5695,14 +5695,14 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE)) notice = TRUE; if (!who && (project_m_n == 1) && !jump) { - if (grid_array[project_m_y][project_m_x].m_idx > 0) + if (current_floor->grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx]; + monster_type *m_ptr = &m_list[current_floor->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(grid_array[project_m_y][project_m_x].m_idx); + health_track(current_floor->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -5793,7 +5793,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if( second_step )continue; break; } - if( is_mirror_grid(&grid_array[y][x]) && !second_step ) + if( is_mirror_grid(¤t_floor->grid_array[y][x]) && !second_step ) { /* The target of monsterspell becomes tha mirror(broken) */ monster_target_y = y; @@ -5825,13 +5825,13 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da px = GRID_X(path_g[i]); (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE); if(!who && (project_m_n == 1) && !jump){ - if(grid_array[project_m_y][project_m_x].m_idx >0 ){ - monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx]; + if(current_floor->grid_array[project_m_y][project_m_x].m_idx >0 ){ + monster_type *m_ptr = &m_list[current_floor->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(grid_array[project_m_y][project_m_x].m_idx); + health_track(current_floor->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -6204,11 +6204,11 @@ 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[grid_array[y][x].m_idx]; + monster_type *m_ptr = &m_list[current_floor->grid_array[y][x].m_idx]; monster_race *ref_ptr = &r_info[m_ptr->r_idx]; - if ((flg & PROJECT_REFLECTABLE) && grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && - ((grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) && + if ((flg & PROJECT_REFLECTABLE) && current_floor->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && + ((current_floor->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) && (!who || dist_hack > 1) && !one_in_(10)) { POSITION t_y, t_x; @@ -6246,7 +6246,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da else flg |= PROJECT_PLAYER; /* The bolt is reflected */ - project(grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell); + project(current_floor->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell); /* Don't affect the monster any longer */ continue; @@ -6348,14 +6348,14 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da y = project_m_y; /* Track if possible */ - if (grid_array[y][x].m_idx > 0) + if (current_floor->grid_array[y][x].m_idx > 0) { - monster_type *m_ptr = &m_list[grid_array[y][x].m_idx]; + monster_type *m_ptr = &m_list[current_floor->grid_array[y][x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(grid_array[y][x].m_idx); + health_track(current_floor->grid_array[y][x].m_idx); } } } @@ -6490,7 +6490,7 @@ bool binding_field(HIT_POINT dam) { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x]) && + if (is_mirror_grid(¤t_floor->grid_array[y][x]) && distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE && distance(p_ptr->y, p_ptr->x, y, x) != 0 && player_has_los_bold(y, x) && @@ -6624,12 +6624,12 @@ void seal_of_mirror(HIT_POINT dam) { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x])) + if (is_mirror_grid(¤t_floor->grid_array[y][x])) { if (project_m(0, 0, y, x, dam, GF_GENOCIDE, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE)) { - if (!grid_array[y][x].m_idx) + if (!current_floor->grid_array[y][x].m_idx) { remove_mirror(y, x); } diff --git a/src/spells2.c b/src/spells2.c index ca597ffd4..2dd46e65b 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -51,7 +51,7 @@ static bool detect_feat_flag(POSITION range, int flag, bool known) { int dist = distance(p_ptr->y, p_ptr->x, y, x); if (dist > range) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Hack -- Safe */ if (flag == FF_TRAP) @@ -1421,7 +1421,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) /* Stay in the circle of death */ if (k > r) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Lose room and vault */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); @@ -1592,7 +1592,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) /* Stay in the circle of death */ if (k > r) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW; else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) @@ -1606,7 +1606,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - cc_ptr = &grid_array[yy][xx]; + cc_ptr = ¤t_floor->grid_array[yy][xx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { g_ptr->info |= CAVE_GLOW; @@ -1639,7 +1639,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -1719,7 +1719,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Lose room and vault / Lose light and knowledge */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE); @@ -1755,7 +1755,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Important -- Skip "quake" grids */ if (map[16+y-cy][16+x-cx]) continue; - if (grid_array[y][x].m_idx) continue; + if (current_floor->grid_array[y][x].m_idx) continue; /* Count "safe" grids */ sn++; @@ -1772,17 +1772,17 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) { case 1: { - msg_print(_("ダンジョンの壁が崩れた!", "The grid_array ceiling collapses!")); + msg_print(_("ダンジョンの壁が崩れた!", "The current_floor->grid_array ceiling collapses!")); break; } case 2: { - msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The grid_array floor twists in an unnatural way!")); + msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor->grid_array floor twists in an unnatural way!")); break; } default: { - msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The grid_array quakes! You are pummeled with debris!")); + msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor->grid_array quakes! You are pummeled with debris!")); break; } } @@ -1864,7 +1864,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip unaffected grids */ if (!map[16+yy-cy][16+xx-cx]) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; if (g_ptr->m_idx == p_ptr->riding) continue; @@ -1905,8 +1905,8 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (!cave_empty_bold(y, x)) continue; /* Hack -- no safety on glyph of warding */ - if (is_glyph_grid(&grid_array[y][x])) continue; - if (is_explosive_rune_grid(&grid_array[y][x])) continue; + if (is_glyph_grid(¤t_floor->grid_array[y][x])) continue; + if (is_explosive_rune_grid(¤t_floor->grid_array[y][x])) continue; /* ... nor on the Pattern */ if (pattern_tile(y, x)) continue; @@ -1914,7 +1914,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Important -- Skip "quake" grids */ if (map[16+y-cy][16+x-cx]) continue; - if (grid_array[y][x].m_idx) continue; + if (current_floor->grid_array[y][x].m_idx) continue; if (player_bold(y, x)) continue; /* Count "safe" grids */ @@ -1968,13 +1968,13 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Hack -- Escape from the rock */ if (sn) { - IDX m_idx_aux = grid_array[yy][xx].m_idx; + IDX m_idx_aux = current_floor->grid_array[yy][xx].m_idx; /* Update the old location */ - grid_array[yy][xx].m_idx = 0; + current_floor->grid_array[yy][xx].m_idx = 0; /* Update the new location */ - grid_array[sy][sx].m_idx = m_idx_aux; + current_floor->grid_array[sy][sx].m_idx = m_idx_aux; /* Move the monster */ m_ptr->fy = sy; @@ -2004,7 +2004,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip unaffected grids */ if (!map[16+yy-cy][16+xx-cx]) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; /* Paranoia -- never affect player */ /* if (player_bold(yy, xx)) continue; */ @@ -2062,7 +2062,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; - g_ptr = &grid_array[yy][xx]; + g_ptr = ¤t_floor->grid_array[yy][xx]; if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW; else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) @@ -2076,7 +2076,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yyy = yy + ddy_ddd[ii]; xxx = xx + ddx_ddd[ii]; if (!in_bounds2(yyy, xxx)) continue; - cc_ptr = &grid_array[yyy][xxx]; + cc_ptr = ¤t_floor->grid_array[yyy][xxx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { g_ptr->info |= CAVE_GLOW; @@ -2094,7 +2094,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } /* Success */ @@ -2198,7 +2198,7 @@ static void cave_temp_room_lite(void) POSITION y = temp_y[i]; POSITION x = temp_x[i]; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* No longer in the array */ g_ptr->info &= ~(CAVE_TEMP); @@ -2273,7 +2273,7 @@ static void cave_temp_room_unlite(void) POSITION x = temp_x[i]; int j; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; bool do_dark = !is_mirror_grid(g_ptr); /* No longer in the array */ @@ -2291,7 +2291,7 @@ static void cave_temp_room_unlite(void) if (in_bounds2(by, bx)) { - grid_type *cc_ptr = &grid_array[by][bx]; + grid_type *cc_ptr = ¤t_floor->grid_array[by][bx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { @@ -2405,7 +2405,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION)) { grid_type *g_ptr; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Avoid infinite recursion */ if (g_ptr->info & (CAVE_TEMP)) return; @@ -2532,7 +2532,7 @@ void lite_room(POSITION y1, POSITION x1) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + if (current_floor->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -2905,7 +2905,7 @@ bool teleport_swap(DIRECTION dir) tx = p_ptr->x + ddx[dir]; ty = p_ptr->y + ddy[dir]; } - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; if (p_ptr->anti_tele) { @@ -3772,7 +3772,7 @@ bool rush_attack(bool *mdeath) ty = target_row; } - if (in_bounds(ty, tx)) tm_idx = grid_array[ty][tx].m_idx; + if (in_bounds(ty, tx)) tm_idx = current_floor->grid_array[ty][tx].m_idx; path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL); project_length = 0; @@ -3792,7 +3792,7 @@ bool rush_attack(bool *mdeath) int ny = GRID_Y(path_g[i]); int nx = GRID_X(path_g[i]); - if (cave_empty_bold(ny, nx) && player_can_enter(grid_array[ny][nx].feat, 0)) + if (cave_empty_bold(ny, nx) && player_can_enter(current_floor->grid_array[ny][nx].feat, 0)) { ty = ny; tx = nx; @@ -3801,7 +3801,7 @@ bool rush_attack(bool *mdeath) continue; } - if (!grid_array[ny][nx].m_idx) + if (!current_floor->grid_array[ny][nx].m_idx) { if (tm_idx) { @@ -3818,12 +3818,12 @@ bool rush_attack(bool *mdeath) /* Move player before updating the monster */ if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL); - update_monster(grid_array[ny][nx].m_idx, TRUE); + update_monster(current_floor->grid_array[ny][nx].m_idx, TRUE); /* Found a monster */ - m_ptr = &m_list[grid_array[ny][nx].m_idx]; + m_ptr = &m_list[current_floor->grid_array[ny][nx].m_idx]; - if (tm_idx != grid_array[ny][nx].m_idx) + if (tm_idx != current_floor->grid_array[ny][nx].m_idx) { #ifdef JP msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か"); @@ -3868,7 +3868,7 @@ void remove_all_mirrors(bool explode) { for (y = 0; y < cur_hgt; y++) { - if (is_mirror_grid(&grid_array[y][x])) + if (is_mirror_grid(¤t_floor->grid_array[y][x])) { remove_mirror(y, x); if (explode) @@ -4135,7 +4135,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad) if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break; /* Stopped by monsters */ - if ((dir != 5) && grid_array[ny][nx].m_idx != 0) break; + if ((dir != 5) && current_floor->grid_array[ny][nx].m_idx != 0) break; /* Save the new location */ x = nx; @@ -4619,7 +4619,7 @@ bool_hack vampirism(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; stop_mouth(); @@ -4662,7 +4662,7 @@ bool panic_hit(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { py_attack(y, x, 0); if (randint0(p_ptr->skill_dis) < 7) @@ -4969,7 +4969,7 @@ void hayagake(player_type *creature_ptr) } else { - grid_type *g_ptr = &grid_array[creature_ptr->y][creature_ptr->x]; + grid_type *g_ptr = ¤t_floor->grid_array[creature_ptr->y][creature_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; if (!have_flag(f_ptr->flags, FF_PROJECT) || @@ -4993,7 +4993,7 @@ bool double_attack(player_type *creature_ptr) if (!get_rep_dir(&dir, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { if (one_in_(3)) msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!", @@ -5006,7 +5006,7 @@ bool double_attack(player_type *creature_ptr) "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!")); py_attack(y, x, 0); - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { handle_stuff(); py_attack(y, x, 0); @@ -5074,7 +5074,7 @@ bool mirror_concentration(player_type *creature_ptr) msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now.")); return FALSE; } - if (is_mirror_grid(&grid_array[creature_ptr->y][creature_ptr->x])) + if (is_mirror_grid(¤t_floor->grid_array[creature_ptr->y][creature_ptr->x])) { msg_print(_("少し頭がハッキリした。", "You feel your head clear a little.")); @@ -5105,7 +5105,7 @@ bool sword_dancing(player_type *creature_ptr) dir = randint0(8); y = creature_ptr->y + ddy_ddd[dir]; x = creature_ptr->x + ddx_ddd[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Hack -- attack monsters */ if (g_ptr->m_idx) diff --git a/src/spells3.c b/src/spells3.c index 6ff4f4f85..f6cb662b3 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -92,7 +92,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) /* No teleporting into vaults and such */ if (!(p_ptr->inside_quest || p_ptr->inside_arena)) - if (grid_array[ny][nx].info & CAVE_ICKY) continue; + if (current_floor->grid_array[ny][nx].info & CAVE_ICKY) continue; /* This grid looks good */ look = FALSE; @@ -114,10 +114,10 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) sound(SOUND_TPOTHER); /* Update the old location */ - grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - grid_array[ny][nx].m_idx = m_idx; + current_floor->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -194,7 +194,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; /* No teleporting into vaults and such */ - /* if (grid_array[ny][nx].info & (CAVE_ICKY)) continue; */ + /* if (current_floor->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */ /* This grid looks good */ look = FALSE; @@ -215,10 +215,10 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, sound(SOUND_TPOTHER); /* Update the old location */ - grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - grid_array[ny][nx].m_idx = m_idx; + current_floor->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -382,7 +382,7 @@ void teleport_player(POSITION dis, BIT_FLAGS mode) { for (yy = -1; yy < 2; yy++) { - MONSTER_IDX tmp_m_idx = grid_array[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = current_floor->grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx)) @@ -424,7 +424,7 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) { for (yy = -1; yy < 2; yy++) { - MONSTER_IDX tmp_m_idx = grid_array[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = current_floor->grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount or caster may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx)) @@ -483,7 +483,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) } /* Accept any grid when wizard mode */ - if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!grid_array[y][x].m_idx || (grid_array[y][x].m_idx == p_ptr->riding))) break; + if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor->grid_array[y][x].m_idx || (current_floor->grid_array[y][x].m_idx == p_ptr->riding))) break; /* Accept teleportable floor grids */ if (cave_player_teleportable_bold(y, x, mode)) break; @@ -562,7 +562,7 @@ bool teleport_level_other(player_type *creature_ptr) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - target_m_idx = grid_array[target_row][target_col].m_idx; + target_m_idx = current_floor->grid_array[target_row][target_col].m_idx; 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; @@ -1394,7 +1394,7 @@ static bool vanish_dungeon(void) { for (x = 1; x < cur_wid - 1; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Seeing true feature code (ignore mimic) */ f_ptr = &f_info[g_ptr->feat]; @@ -1426,7 +1426,7 @@ static bool vanish_dungeon(void) /* Special boundary walls -- Top and bottom */ for (x = 0; x < cur_wid; x++) { - g_ptr = &grid_array[0][x]; + g_ptr = ¤t_floor->grid_array[0][x]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -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 = &grid_array[cur_hgt - 1][x]; + g_ptr = ¤t_floor->grid_array[cur_hgt - 1][x]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1460,7 +1460,7 @@ static bool vanish_dungeon(void) /* Special boundary walls -- Left and right */ for (y = 1; y < (cur_hgt - 1); y++) { - g_ptr = &grid_array[y][0]; + g_ptr = ¤t_floor->grid_array[y][0]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -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 = &grid_array[y][cur_wid - 1]; + g_ptr = ¤t_floor->grid_array[y][cur_wid - 1]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1511,7 +1511,7 @@ void call_the_(void) for (i = 0; i < 9; i++) { - g_ptr = &grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; + g_ptr = ¤t_floor->grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) { @@ -1594,7 +1594,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) GAME_TEXT o_name[MAX_NLEN]; /* Check to see if an object is already there */ - if (grid_array[p_ptr->y][p_ptr->x].o_idx) + if (current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx) { msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); return; @@ -1612,7 +1612,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) return; } - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; /* We need an item to fetch */ if (!g_ptr->o_idx) @@ -1651,7 +1651,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) { ty += ddy[dir]; tx += ddx[dir]; - g_ptr = &grid_array[ty][tx]; + g_ptr = ¤t_floor->grid_array[ty][tx]; if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) || !cave_have_flag_bold(ty, tx, FF_PROJECT)) return; @@ -1670,7 +1670,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) i = g_ptr->o_idx; g_ptr->o_idx = o_ptr->next_o_idx; - grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ + current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ o_ptr->next_o_idx = 0; o_ptr->iy = p_ptr->y; @@ -1729,8 +1729,8 @@ bool warding_glyph(void) } /* Create a glyph */ - grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph; + current_floor->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + current_floor->grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -1751,11 +1751,11 @@ bool place_mirror(void) } /* Create a mirror */ - grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror; + current_floor->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + current_floor->grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror; /* Turn on the light */ - grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; + current_floor->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -1779,8 +1779,8 @@ bool explosive_rune(void) } /* Create a glyph */ - grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; + current_floor->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + current_floor->grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -3911,7 +3911,7 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) */ bool polymorph_monster(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; monster_type *m_ptr = &m_list[g_ptr->m_idx]; bool polymorphed = FALSE; MONRACE_IDX new_r_idx; @@ -4357,7 +4357,7 @@ void massacre(void) { y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; m_ptr = &m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ @@ -4376,7 +4376,7 @@ bool eat_lock(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)]; @@ -4443,12 +4443,12 @@ bool shock_power(void) x = p_ptr->x + ddx[dir]; dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8); fire_beam(GF_MISSILE, dir, dam); - if (grid_array[y][x].m_idx) + if (current_floor->grid_array[y][x].m_idx) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; - MONSTER_IDX m_idx = grid_array[y][x].m_idx; + MONSTER_IDX m_idx = current_floor->grid_array[y][x].m_idx; monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -4475,8 +4475,8 @@ bool shock_power(void) if ((ty != oy) || (tx != ox)) { msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); - grid_array[oy][ox].m_idx = 0; - grid_array[ty][tx].m_idx = m_idx; + current_floor->grid_array[oy][ox].m_idx = 0; + current_floor->grid_array[ty][tx].m_idx = m_idx; m_ptr->fy = ty; m_ptr->fx = tx; @@ -4540,7 +4540,7 @@ bool detonation(player_type *creature_ptr) void blood_curse_to_enemy(MONSTER_IDX m_idx) { monster_type *m_ptr = &m_list[m_idx]; - grid_type *g_ptr = &grid_array[m_ptr->fy][m_ptr->fx]; + grid_type *g_ptr = ¤t_floor->grid_array[m_ptr->fy][m_ptr->fx]; BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP); int count = 0; do diff --git a/src/store.c b/src/store.c index 505d9a1dc..ad3e5654c 100644 --- a/src/store.c +++ b/src/store.c @@ -5712,7 +5712,7 @@ void do_cmd_store(void) store_bottom = MIN_STOCK + xtra_stock; /* Access the player grid */ - g_ptr = &grid_array[p_ptr->y][p_ptr->x]; + g_ptr = ¤t_floor->grid_array[p_ptr->y][p_ptr->x]; /* Verify a store */ if (!cave_have_flag_grid(g_ptr, FF_STORE)) diff --git a/src/trap.c b/src/trap.c index 3bde1a6ba..02caa5b7d 100644 --- a/src/trap.c +++ b/src/trap.c @@ -83,7 +83,7 @@ FEAT_IDX choose_random_trap(void) */ void disclose_grid(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; if (cave_have_flag_grid(g_ptr, FF_SECRET)) { @@ -112,7 +112,7 @@ void disclose_grid(POSITION y, POSITION x) */ void place_trap(POSITION y, POSITION x) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; /* Paranoia -- verify location */ if (!in_bounds(y, x)) return; @@ -302,7 +302,7 @@ void hit_trap(bool break_trap) { int i, num, dam; POSITION x = p_ptr->x, y = p_ptr->y; - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP; concptr name = _("トラップ", "a trap"); diff --git a/src/types.h b/src/types.h index db7ee354b..d8abbdf1e 100644 --- a/src/types.h +++ b/src/types.h @@ -427,7 +427,7 @@ struct skill_table /* * A single "grid" in a Cave * - * Note that several aspects of the code restrict the actual grid_array + * Note that several aspects of the code restrict the actual current_floor->grid_array * to a max size of 256 by 256. In partcular, locations are often * saved as bytes, limiting each coordinate to the 0-255 range. * @@ -454,13 +454,13 @@ typedef struct grid_type grid_type; struct grid_type { - BIT_FLAGS info; /* Hack -- grid_array flags */ + BIT_FLAGS info; /* Hack -- current_floor->grid_array flags */ FEAT_IDX feat; /* Hack -- feature type */ OBJECT_IDX o_idx; /* Object in this grid */ MONSTER_IDX m_idx; /* Monster in this grid */ - /*! 地形の特別な情報を保存する / Special grid_array info + /*! 地形の特別な情報を保存する / Special current_floor->grid_array info * 具体的な使用一覧はクエスト行き階段の移行先クエストID、 * 各ダンジョン入口の移行先ダンジョンID、 * @@ -1873,3 +1873,7 @@ typedef struct { int type; concptr name; } dragonbreath_type; + +typedef struct { + grid_type *grid_array[MAX_HGT]; +} floor_type; \ No newline at end of file diff --git a/src/variable.c b/src/variable.c index e0b38799a..8755b47a2 100644 --- a/src/variable.c +++ b/src/variable.c @@ -219,23 +219,23 @@ char player_base[32]; char savefile[1024]; char savefile_base[40]; -POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "grid_array.c") +POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "current_floor->grid_array.c") POSITION lite_y[LITE_MAX]; POSITION lite_x[LITE_MAX]; -POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "grid_array.c") +POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor->grid_array.c") POSITION mon_lite_y[MON_LITE_MAX]; POSITION mon_lite_x[MON_LITE_MAX]; -POSITION_IDX view_n; //!< Array of grids viewable to the player (see "grid_array.c") +POSITION_IDX view_n; //!< Array of grids viewable to the player (see "current_floor->grid_array.c") POSITION view_y[VIEW_MAX]; POSITION view_x[VIEW_MAX]; -POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "grid_array.c") +POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "current_floor->grid_array.c") POSITION temp_y[TEMP_MAX]; POSITION temp_x[TEMP_MAX]; -POSITION_IDX redraw_n = 0; //!< Array of grids for delayed visual updating (see "grid_array.c") +POSITION_IDX redraw_n = 0; //!< Array of grids for delayed visual updating (see "current_floor->grid_array.c") POSITION redraw_y[REDRAW_MAX]; POSITION redraw_x[REDRAW_MAX]; @@ -461,11 +461,13 @@ const concptr angband_music_basic_name[MUSIC_BASIC_MAX] = /* - * The array of "grid_array grids" [MAX_WID][MAX_HGT]. + * The array of "current_floor->grid_array grids" [MAX_WID][MAX_HGT]. * Not completely allocated, that would be inefficient * Not completely hardcoded, that would overflow memory */ -grid_type *grid_array[MAX_HGT]; +floor_type floor; +floor_type *current_floor = &floor; + /* diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index ab15518cf..f4e977d98 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -1695,7 +1695,7 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){ int i; 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(is_pet(m_ptr))continue;//pet diff --git a/src/wild.c b/src/wild.c index 1b44c65d4..2bab2997c 100644 --- a/src/wild.c +++ b/src/wild.c @@ -99,7 +99,7 @@ static void perturb_point_mid(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, FEAT_IDX x4 if (avg > depth_max) avg = depth_max; /* Set the new value. */ - grid_array[ymid][xmid].feat = (FEAT_IDX)avg; + current_floor->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; } @@ -134,7 +134,7 @@ static void perturb_point_end(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, POSITION xm if (avg > depth_max) avg = depth_max; /* Set the new value. */ - grid_array[ymid][xmid].feat = (FEAT_IDX)avg; + current_floor->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; } @@ -166,19 +166,19 @@ static void plasma_recursive(POSITION x1, POSITION y1, POSITION x2, POSITION y2, /* Are we done? */ if (x1 + 1 == x2) return; - perturb_point_mid(grid_array[y1][x1].feat, grid_array[y2][x1].feat, grid_array[y1][x2].feat, - grid_array[y2][x2].feat, xmid, ymid, rough, depth_max); + perturb_point_mid(current_floor->grid_array[y1][x1].feat, current_floor->grid_array[y2][x1].feat, current_floor->grid_array[y1][x2].feat, + current_floor->grid_array[y2][x2].feat, xmid, ymid, rough, depth_max); - perturb_point_end(grid_array[y1][x1].feat, grid_array[y1][x2].feat, grid_array[ymid][xmid].feat, + perturb_point_end(current_floor->grid_array[y1][x1].feat, current_floor->grid_array[y1][x2].feat, current_floor->grid_array[ymid][xmid].feat, xmid, y1, rough, depth_max); - perturb_point_end(grid_array[y1][x2].feat, grid_array[y2][x2].feat, grid_array[ymid][xmid].feat, + perturb_point_end(current_floor->grid_array[y1][x2].feat, current_floor->grid_array[y2][x2].feat, current_floor->grid_array[ymid][xmid].feat, x2, ymid, rough, depth_max); - perturb_point_end(grid_array[y2][x2].feat, grid_array[y2][x1].feat, grid_array[ymid][xmid].feat, + perturb_point_end(current_floor->grid_array[y2][x2].feat, current_floor->grid_array[y2][x1].feat, current_floor->grid_array[ymid][xmid].feat, xmid, y2, rough, depth_max); - perturb_point_end(grid_array[y2][x1].feat, grid_array[y1][x1].feat, grid_array[ymid][xmid].feat, + perturb_point_end(current_floor->grid_array[y2][x1].feat, current_floor->grid_array[y1][x1].feat, current_floor->grid_array[ymid][xmid].feat, x1, ymid, rough, depth_max); @@ -223,7 +223,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c { for (x1 = 0; x1 < MAX_WID; x1++) { - grid_array[y1][x1].feat = feat_permanent; + current_floor->grid_array[y1][x1].feat = feat_permanent; } } @@ -245,7 +245,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c { for (x1 = 0; x1 < MAX_WID; x1++) { - grid_array[y1][x1].feat = table_size / 2; + current_floor->grid_array[y1][x1].feat = table_size / 2; } } } @@ -255,42 +255,42 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c * ToDo: calculate the medium height of the adjacent * terrains for every corner. */ - grid_array[1][1].feat = (s16b)randint0(table_size); - grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size); - grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size); - grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size); + current_floor->grid_array[1][1].feat = (s16b)randint0(table_size); + current_floor->grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size); + current_floor->grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size); + current_floor->grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size); if (!corner) { /* Hack -- preserve four corners */ - s16b north_west = grid_array[1][1].feat; - s16b south_west = grid_array[MAX_HGT - 2][1].feat; - s16b north_east = grid_array[1][MAX_WID - 2].feat; - s16b south_east = grid_array[MAX_HGT - 2][MAX_WID - 2].feat; + s16b north_west = current_floor->grid_array[1][1].feat; + s16b south_west = current_floor->grid_array[MAX_HGT - 2][1].feat; + s16b north_east = current_floor->grid_array[1][MAX_WID - 2].feat; + s16b south_east = current_floor->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; /* x1, y1, x2, y2, num_depths, roughness */ plasma_recursive(1, 1, MAX_WID-2, MAX_HGT-2, table_size-1, roughness); /* Hack -- copyback four corners */ - grid_array[1][1].feat = north_west; - grid_array[MAX_HGT - 2][1].feat = south_west; - grid_array[1][MAX_WID - 2].feat = north_east; - grid_array[MAX_HGT - 2][MAX_WID - 2].feat = south_east; + current_floor->grid_array[1][1].feat = north_west; + current_floor->grid_array[MAX_HGT - 2][1].feat = south_west; + current_floor->grid_array[1][MAX_WID - 2].feat = north_east; + current_floor->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = south_east; for (y1 = 1; y1 < MAX_HGT - 1; y1++) { for (x1 = 1; x1 < MAX_WID - 1; x1++) { - grid_array[y1][x1].feat = terrain_table[terrain][grid_array[y1][x1].feat]; + current_floor->grid_array[y1][x1].feat = terrain_table[terrain][current_floor->grid_array[y1][x1].feat]; } } } else /* Hack -- only four corners */ { - grid_array[1][1].feat = terrain_table[terrain][grid_array[1][1].feat]; - grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][grid_array[MAX_HGT - 2][1].feat]; - grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][grid_array[1][MAX_WID - 2].feat]; - grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][grid_array[MAX_HGT - 2][MAX_WID - 2].feat]; + current_floor->grid_array[1][1].feat = terrain_table[terrain][current_floor->grid_array[1][1].feat]; + current_floor->grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][current_floor->grid_array[MAX_HGT - 2][1].feat]; + current_floor->grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][current_floor->grid_array[1][MAX_WID - 2].feat]; + current_floor->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][current_floor->grid_array[MAX_HGT - 2][MAX_WID - 2].feat]; } /* Hack -- Restore the RNG state */ @@ -369,7 +369,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) */ if (wilderness[y][x].road) { - grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor; + current_floor->grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor; if (wilderness[y-1][x].road) { @@ -377,7 +377,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (y1 = 1; y1 < MAX_HGT/2; y1++) { x1 = MAX_WID/2; - grid_array[y1][x1].feat = feat_floor; + current_floor->grid_array[y1][x1].feat = feat_floor; } } @@ -387,7 +387,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (y1 = MAX_HGT/2; y1 < MAX_HGT - 1; y1++) { x1 = MAX_WID/2; - grid_array[y1][x1].feat = feat_floor; + current_floor->grid_array[y1][x1].feat = feat_floor; } } @@ -397,7 +397,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (x1 = MAX_WID/2; x1 < MAX_WID - 1; x1++) { y1 = MAX_HGT/2; - grid_array[y1][x1].feat = feat_floor; + current_floor->grid_array[y1][x1].feat = feat_floor; } } @@ -407,7 +407,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (x1 = 1; x1 < MAX_WID/2; x1++) { y1 = MAX_HGT/2; - grid_array[y1][x1].feat = feat_floor; + current_floor->grid_array[y1][x1].feat = feat_floor; } } } @@ -427,8 +427,8 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) dy = rand_range(6, cur_hgt - 6); dx = rand_range(6, cur_wid - 6); - grid_array[dy][dx].feat = feat_entrance; - grid_array[dy][dx].special = wilderness[y][x].entrance; + current_floor->grid_array[dy][dx].feat = feat_entrance; + current_floor->grid_array[dy][dx].special = wilderness[y][x].entrance; /* Hack -- Restore the RNG state */ Rand_state_restore(state_backup); @@ -475,7 +475,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_WID - 1; i++) { - border.north[i] = grid_array[MAX_HGT - 2][i].feat; + border.north[i] = current_floor->grid_array[MAX_HGT - 2][i].feat; } /* South border */ @@ -483,7 +483,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_WID - 1; i++) { - border.south[i] = grid_array[1][i].feat; + border.south[i] = current_floor->grid_array[1][i].feat; } /* West border */ @@ -491,7 +491,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_HGT - 1; i++) { - border.west[i] = grid_array[i][MAX_WID - 2].feat; + border.west[i] = current_floor->grid_array[i][MAX_WID - 2].feat; } /* East border */ @@ -499,24 +499,24 @@ void wilderness_gen(void) for (i = 1; i < MAX_HGT - 1; i++) { - border.east[i] = grid_array[i][1].feat; + border.east[i] = current_floor->grid_array[i][1].feat; } /* North west corner */ generate_area(y - 1, x - 1, FALSE, TRUE); - border.north_west = grid_array[MAX_HGT - 2][MAX_WID - 2].feat; + border.north_west = current_floor->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; /* North east corner */ generate_area(y - 1, x + 1, FALSE, TRUE); - border.north_east = grid_array[MAX_HGT - 2][1].feat; + border.north_east = current_floor->grid_array[MAX_HGT - 2][1].feat; /* South west corner */ generate_area(y + 1, x - 1, FALSE, TRUE); - border.south_west = grid_array[1][MAX_WID - 2].feat; + border.south_west = current_floor->grid_array[1][MAX_WID - 2].feat; /* South east corner */ generate_area(y + 1, x + 1, FALSE, TRUE); - border.south_east = grid_array[1][1].feat; + border.south_east = current_floor->grid_array[1][1].feat; /* Create terrain of the current area */ @@ -526,49 +526,49 @@ void wilderness_gen(void) /* Special boundary walls -- North */ for (i = 0; i < MAX_WID; i++) { - grid_array[0][i].feat = feat_permanent; - grid_array[0][i].mimic = border.north[i]; + current_floor->grid_array[0][i].feat = feat_permanent; + current_floor->grid_array[0][i].mimic = border.north[i]; } /* Special boundary walls -- South */ for (i = 0; i < MAX_WID; i++) { - grid_array[MAX_HGT - 1][i].feat = feat_permanent; - grid_array[MAX_HGT - 1][i].mimic = border.south[i]; + current_floor->grid_array[MAX_HGT - 1][i].feat = feat_permanent; + current_floor->grid_array[MAX_HGT - 1][i].mimic = border.south[i]; } /* Special boundary walls -- West */ for (i = 0; i < MAX_HGT; i++) { - grid_array[i][0].feat = feat_permanent; - grid_array[i][0].mimic = border.west[i]; + current_floor->grid_array[i][0].feat = feat_permanent; + current_floor->grid_array[i][0].mimic = border.west[i]; } /* Special boundary walls -- East */ for (i = 0; i < MAX_HGT; i++) { - grid_array[i][MAX_WID - 1].feat = feat_permanent; - grid_array[i][MAX_WID - 1].mimic = border.east[i]; + current_floor->grid_array[i][MAX_WID - 1].feat = feat_permanent; + current_floor->grid_array[i][MAX_WID - 1].mimic = border.east[i]; } /* North west corner */ - grid_array[0][0].mimic = border.north_west; + current_floor->grid_array[0][0].mimic = border.north_west; /* North east corner */ - grid_array[0][MAX_WID - 1].mimic = border.north_east; + current_floor->grid_array[0][MAX_WID - 1].mimic = border.north_east; /* South west corner */ - grid_array[MAX_HGT - 1][0].mimic = border.south_west; + current_floor->grid_array[MAX_HGT - 1][0].mimic = border.south_west; /* South east corner */ - grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east; + current_floor->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 (x = 0; x < cur_wid; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (is_daytime()) { @@ -614,7 +614,7 @@ void wilderness_gen(void) { for (x = 0; x < cur_wid; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Seeing true feature code (ignore mimic) */ f_ptr = &f_info[g_ptr->feat]; @@ -639,7 +639,7 @@ void wilderness_gen(void) { for (x = 0; x < cur_wid; x++) { - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; if (cave_have_flag_grid(g_ptr, FF_ENTRANCE)) { @@ -699,7 +699,7 @@ void wilderness_gen_small(void) for (i = 0; i < MAX_WID; i++) for (j = 0; j < MAX_HGT; j++) { - grid_array[j][i].feat = feat_permanent; + current_floor->grid_array[j][i].feat = feat_permanent; } /* Init the wilderness */ @@ -711,18 +711,18 @@ void wilderness_gen_small(void) { if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN)) { - grid_array[j][i].feat = (s16b)feat_town; - grid_array[j][i].special = (s16b)wilderness[j][i].town; + current_floor->grid_array[j][i].feat = (s16b)feat_town; + current_floor->grid_array[j][i].special = (s16b)wilderness[j][i].town; } - else if (wilderness[j][i].road) grid_array[j][i].feat = feat_floor; + else if (wilderness[j][i].road) current_floor->grid_array[j][i].feat = feat_floor; else if (wilderness[j][i].entrance && (p_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) { - grid_array[j][i].feat = feat_entrance; - grid_array[j][i].special = (byte)wilderness[j][i].entrance; + current_floor->grid_array[j][i].feat = feat_entrance; + current_floor->grid_array[j][i].special = (byte)wilderness[j][i].entrance; } - else grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain]; + else current_floor->grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain]; - grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK); } cur_hgt = (s16b) max_wild_y; diff --git a/src/wizard2.c b/src/wizard2.c index f54333c60..c4bad8489 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1550,7 +1550,7 @@ static void do_cmd_wiz_create_feature(void) if (!tgt_pt(&x, &y)) return; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Default */ sprintf(tmp_val, "%d", prev_feat); @@ -1917,7 +1917,7 @@ void do_cmd_debug(void) { for (x = 0; x < cur_wid; x++) { - grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); + current_floor->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); } } wiz_lite(FALSE); diff --git a/src/xtra2.c b/src/xtra2.c index 5fc65ae79..119416b58 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -590,8 +590,8 @@ static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) { POSITION *x = (POSITION*)(u); POSITION *y = (POSITION*)(v); - grid_type *ca_ptr = &grid_array[y[a]][x[a]]; - grid_type *cb_ptr = &grid_array[y[b]][x[b]]; + grid_type *ca_ptr = ¤t_floor->grid_array[y[a]][x[a]]; + grid_type *cb_ptr = ¤t_floor->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_race *ap_ra_ptr, *ap_rb_ptr; @@ -637,8 +637,8 @@ static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) } /* An object get higher priority */ - if (grid_array[y[a]][x[a]].o_idx && !grid_array[y[b]][x[b]].o_idx) return TRUE; - if (!grid_array[y[a]][x[a]].o_idx && grid_array[y[b]][x[b]].o_idx) return FALSE; + if (current_floor->grid_array[y[a]][x[a]].o_idx && !current_floor->grid_array[y[b]][x[b]].o_idx) return TRUE; + if (!current_floor->grid_array[y[a]][x[a]].o_idx && current_floor->grid_array[y[b]][x[b]].o_idx) return FALSE; /* Priority from the terrain */ if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE; @@ -741,7 +741,7 @@ static bool target_set_accept(POSITION y, POSITION x) if (p_ptr->image) return (FALSE); /* Examine the grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Visible monsters */ if (g_ptr->m_idx) @@ -819,7 +819,7 @@ static void target_set_prepare(BIT_FLAGS mode) /* Require "interesting" contents */ if (!target_set_accept(y, x)) continue; - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Require target_able monsters for "TARGET_KILL" */ if ((mode & (TARGET_KILL)) && !target_able(g_ptr->m_idx)) continue; @@ -948,7 +948,7 @@ bool show_gold_on_floor = FALSE; */ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) { - grid_type *g_ptr = &grid_array[y][x]; + grid_type *g_ptr = ¤t_floor->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; concptr s1 = "", s2 = "", s3 = "", x_info = ""; bool boring = TRUE; @@ -1531,7 +1531,7 @@ bool target_set(BIT_FLAGS mode) if (!(mode & TARGET_LOOK)) prt_path(y, x); /* Access */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Allow target */ if (target_able(g_ptr->m_idx)) @@ -1768,7 +1768,7 @@ bool target_set(BIT_FLAGS mode) if (!(mode & TARGET_LOOK)) prt_path(y, x); /* Access */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Default prompt */ strcpy(info, _("qæ­¢ t決 p自 m近 +次 -前", "q,t,p,m,+,-,")); @@ -2378,7 +2378,7 @@ static bool tgt_pt_accept(POSITION y, POSITION x) if (p_ptr->image) return (FALSE); /* Examine the grid */ - g_ptr = &grid_array[y][x]; + g_ptr = ¤t_floor->grid_array[y][x]; /* Interesting memorized features */ if (g_ptr->info & (CAVE_MARK)) @@ -2494,7 +2494,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr) /* Skip stairs which have defferent distance */ for (; n < temp_n; ++ n) { - grid_type *g_ptr = &grid_array[temp_y[n]][temp_x[n]]; + grid_type *g_ptr = ¤t_floor->grid_array[temp_y[n]][temp_x[n]]; if (cave_have_flag_grid(g_ptr, FF_STAIRS) && cave_have_flag_grid(g_ptr, ch == '>' ? FF_MORE : FF_LESS)) -- 2.11.0