From 030bba760b9276828fb53ab2904530f0cb46fecb Mon Sep 17 00:00:00 2001 From: Hourier Date: Sat, 18 Jan 2020 21:08:12 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20is=5Fknown=5Ftrap()=20?= =?utf8?q?=E3=81=A8is=5Fhidden=5Fdoor()=E3=81=ABplayer=5Ftype=20*=20?= =?utf8?q?=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0=20/=20Added=20play?= =?utf8?q?er=5Ftype=20*=20argument=20to=20is=5Fknown=5Ftrap()=20and=20is?= =?utf8?q?=5Fhidden=5Fdoor()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd/cmd-basic.c | 14 +++++++------- src/feature.c | 9 ++++++--- src/feature.h | 4 ++-- src/floor-generate.c | 2 +- src/floor-save.c | 4 ++-- src/floor-streams.c | 2 +- src/floor.c | 2 +- src/grid.c | 35 +++++++++++++++++++---------------- src/grid.h | 13 ++++++++----- src/mind.c | 4 ++-- src/monster-process.c | 6 +++--- src/player-move.c | 10 +++++----- src/realm-hissatsu.c | 4 ++-- src/rooms-special.c | 2 +- src/rooms-vault.c | 2 +- src/spells-floor.c | 4 ++-- src/spells1.c | 8 ++++---- src/spells3.c | 8 ++++---- src/trap.c | 2 +- src/warning.c | 2 +- 20 files changed, 73 insertions(+), 64 deletions(-) diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index 1f054c6fb..074e52d1e 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -621,7 +621,7 @@ static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OB * @details Return the number of features around (or under) the character. * Usually look for doors and floor traps. */ -static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (*test)(FEAT_IDX feat), bool under) +static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (*test)(player_type*, FEAT_IDX feat), bool under) { /* Check around (and under) the character */ int count = 0; @@ -647,7 +647,7 @@ static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (* feat = get_feat_mimic(g_ptr); /* Not looking for this feature */ - if (!((*test)(feat))) continue; + if (!((*test)(creature_ptr, feat))) continue; /* OK */ ++count; @@ -902,7 +902,7 @@ static bool exe_close(player_type *creature_ptr, POSITION y, POSITION x) return more; } - s16b closed_feat = feat_state(old_feat, FF_CLOSE); + s16b closed_feat = feat_state(creature_ptr, old_feat, FF_CLOSE); /* Hack -- object in the way */ if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) && @@ -1160,7 +1160,7 @@ static bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x) } } - if (is_hidden_door(g_ptr)) + if (is_hidden_door(creature_ptr, g_ptr)) { /* Occasional Search XXX XXX */ if (randint0(100) < 25) search(creature_ptr); @@ -1276,7 +1276,7 @@ bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x) feature_type *f_ptr = &f_info[g_ptr->feat]; /* Must be a closed door */ - if (!is_closed_door(g_ptr->feat)) + if (!is_closed_door(creature_ptr, g_ptr->feat)) { return FALSE; } @@ -1579,7 +1579,7 @@ void do_cmd_disarm(player_type *creature_ptr) o_idx = chest_check(creature_ptr->current_floor_ptr, y, x, TRUE); /* Disarm a trap */ - if (!is_trap(feat) && !o_idx) + if (!is_trap(creature_ptr, feat) && !o_idx) { msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm.")); } @@ -1663,7 +1663,7 @@ static bool do_cmd_bash_aux(player_type *creature_ptr, POSITION y, POSITION x, D sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR); /* Break down the door */ - if ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS)) + if ((randint0(100) < 50) || (feat_state(creature_ptr, g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS)) { cave_alter_feat(creature_ptr, y, x, FF_BASH); } diff --git a/src/feature.c b/src/feature.c index ace583e3a..e63a1f9b9 100644 --- a/src/feature.c +++ b/src/feature.c @@ -103,8 +103,10 @@ FEAT_IDX max_f_idx; * @param feat 地形情報のID * @return 罠持ちの地形ならばTRUEを返す。 */ -bool is_trap(FEAT_IDX feat) +bool is_trap(player_type *player_ptr, FEAT_IDX feat) { + /* 関数ポインタの都合 */ + (void)player_ptr; return have_flag(f_info[feat].flags, FF_TRAP); } @@ -113,11 +115,12 @@ bool is_trap(FEAT_IDX feat) * @param feat 地形情報のID * @return 閉じたドアのある地形ならばTRUEを返す。 */ -bool is_closed_door(FEAT_IDX feat) +bool is_closed_door(player_type *player_ptr, FEAT_IDX feat) { + /* 関数ポインタの都合 */ + (void)player_ptr; feature_type *f_ptr = &f_info[feat]; return (have_flag(f_ptr->flags, FF_OPEN) || have_flag(f_ptr->flags, FF_BASH)) && !have_flag(f_ptr->flags, FF_MOVE); } - diff --git a/src/feature.h b/src/feature.h index 16f990cd7..c5559f900 100644 --- a/src/feature.h +++ b/src/feature.h @@ -198,8 +198,8 @@ extern feature_type *f_info; extern char *f_name; extern char *f_tag; -extern bool is_closed_door(FEAT_IDX feat); -extern bool is_trap(FEAT_IDX feat); +extern bool is_closed_door(player_type *player_ptr, FEAT_IDX feat); +extern bool is_trap(player_type *player_ptr, FEAT_IDX feat); /*** Terrain feature variables ***/ extern FEAT_IDX feat_none; diff --git a/src/floor-generate.c b/src/floor-generate.c index c2bab251e..b01e0920d 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -287,7 +287,7 @@ static bool alloc_stairs(player_type *owner_ptr, FEAT_IDX feat, int num, int wal g_ptr->mimic = 0; /* Clear previous contents, add stairs */ - g_ptr->feat = (i < shaft_num) ? feat_state(feat, FF_SHAFT) : feat; + g_ptr->feat = (i < shaft_num) ? feat_state(owner_ptr, feat, FF_SHAFT) : feat; /* No longer "FLOOR" */ g_ptr->info &= ~(CAVE_FLOOR); diff --git a/src/floor-save.c b/src/floor-save.c index babd1d583..90fa7ef15 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -1340,13 +1340,13 @@ void change_floor(player_type *creature_ptr) /* No stairs down from Quest */ if ((creature_ptr->change_floor_mode & CFM_UP) && !quest_number(creature_ptr, creature_ptr->current_floor_ptr->dun_level)) { - g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair; + g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(creature_ptr, feat_down_stair, FF_SHAFT) : feat_down_stair; } /* No stairs up when ironman_downward */ else if ((creature_ptr->change_floor_mode & CFM_DOWN) && !ironman_downward) { - g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair; + g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(creature_ptr, feat_up_stair, FF_SHAFT) : feat_up_stair; } /* Paranoia -- Clear mimic */ diff --git a/src/floor-streams.c b/src/floor-streams.c index a8b6532a6..68db430e5 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -291,7 +291,7 @@ void build_streamer(player_type *player_ptr, FEAT_IDX feat, int chance) if (streamer_is_wall) { if (!is_extra_grid(g_ptr) && !is_inner_grid(g_ptr) && !is_outer_grid(g_ptr) && !is_solid_grid(g_ptr)) continue; - if (is_closed_door(g_ptr->feat)) continue; + if (is_closed_door(player_ptr, g_ptr->feat)) continue; } if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) diff --git a/src/floor.c b/src/floor.c index dc1e51dda..461bc0017 100644 --- a/src/floor.c +++ b/src/floor.c @@ -162,7 +162,7 @@ void update_smell(floor_type *floor_ptr, player_type *subject_ptr) g_ptr = &floor_ptr->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; + if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(subject_ptr, g_ptr->feat)) continue; /* Grid must not be blocked by walls from the character */ if (!player_has_los_bold(subject_ptr, y, x)) continue; diff --git a/src/grid.c b/src/grid.c index 21aaf7c45..f4a508edd 100644 --- a/src/grid.c +++ b/src/grid.c @@ -250,7 +250,7 @@ void place_bound_perm_wall(player_type *player_ptr, grid_type *g_ptr) /* Hack -- Decline boundary walls with known treasure */ if ((have_flag(f_ptr->flags, FF_HAS_GOLD) || have_flag(f_ptr->flags, FF_HAS_ITEM)) && !have_flag(f_ptr->flags, FF_SECRET)) - g_ptr->feat = feat_state(g_ptr->feat, FF_ENSECRET); + g_ptr->feat = feat_state(player_ptr, g_ptr->feat, FF_ENSECRET); /* Set boundary mimic */ g_ptr->mimic = g_ptr->feat; @@ -262,13 +262,14 @@ void place_bound_perm_wall(player_type *player_ptr, grid_type *g_ptr) /*! * @brief マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap + * @param player_ptr プレーヤーへの参照ポインタ * @param g_ptr マス構造体の参照ポインタ * @return 看破済みの罠があるならTRUEを返す。 */ -bool is_known_trap(grid_type *g_ptr) +bool is_known_trap(player_type *player_ptr, grid_type *g_ptr) { if (!g_ptr->mimic && !cave_have_flag_grid(g_ptr, FF_SECRET) && - is_trap(g_ptr->feat)) return TRUE; + is_trap(player_ptr, g_ptr->feat)) return TRUE; else return FALSE; } @@ -277,13 +278,14 @@ bool is_known_trap(grid_type *g_ptr) /*! * @brief マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door + * @param player_ptr プレーヤーへの参照ポインタ * @param g_ptr マス構造体の参照ポインタ * @return 隠されたドアがあるならTRUEを返す。 */ -bool is_hidden_door(grid_type *g_ptr) +bool is_hidden_door(player_type *player_ptr, grid_type *g_ptr) { if ((g_ptr->mimic || cave_have_flag_grid(g_ptr, FF_SECRET)) && - is_closed_door(g_ptr->feat)) + is_closed_door(player_ptr, g_ptr->feat)) return TRUE; else return FALSE; @@ -925,13 +927,13 @@ void update_flow(player_type *subject_ptr) g_ptr = &subject_ptr->current_floor_ptr->grid_array[y][x]; - if (is_closed_door(g_ptr->feat)) m += 3; + if (is_closed_door(subject_ptr, g_ptr->feat)) m += 3; /* Ignore "pre-stamped" entries */ if (g_ptr->dist != 0 && g_ptr->dist <= n && g_ptr->cost <= m) continue; /* Ignore "walls" and "rubble" */ - if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(g_ptr->feat)) continue; + if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(subject_ptr, g_ptr->feat)) continue; /* Save the flow cost */ if (g_ptr->cost == 0 || g_ptr->cost > m) g_ptr->cost = m; @@ -957,20 +959,21 @@ void update_flow(player_type *subject_ptr) * Take a feature, determine what that feature becomes * through applying the given action. */ -FEAT_IDX feat_state(FEAT_IDX feat, int action) +FEAT_IDX feat_state(player_type *player_ptr, FEAT_IDX feat, int action) { feature_type *f_ptr = &f_info[feat]; int i; /* Get the new feature */ + floor_type *floor_ptr = player_ptr->current_floor_ptr; for (i = 0; i < MAX_FEAT_STATES; i++) { - if (f_ptr->state[i].action == action) return conv_dungeon_feat(p_ptr->current_floor_ptr, f_ptr->state[i].result); + if (f_ptr->state[i].action == action) return conv_dungeon_feat(floor_ptr, f_ptr->state[i].result); } if (have_flag(f_ptr->flags, FF_PERMANENT)) return feat; - return (feature_action_flags[action] & FAF_DESTROY) ? conv_dungeon_feat(p_ptr->current_floor_ptr, f_ptr->destroyed) : feat; + return (feature_action_flags[action] & FAF_DESTROY) ? conv_dungeon_feat(floor_ptr, f_ptr->destroyed) : feat; } /* @@ -984,7 +987,7 @@ void cave_alter_feat(player_type *player_ptr, POSITION y, POSITION x, int action FEAT_IDX oldfeat = floor_ptr->grid_array[y][x].feat; /* Get the new feat */ - FEAT_IDX newfeat = feat_state(oldfeat, action); + FEAT_IDX newfeat = feat_state(player_ptr, oldfeat, action); /* No change */ if (newfeat == oldfeat) return; @@ -1178,9 +1181,9 @@ bool cave_player_teleportable_bold(player_type *player_ptr, POSITION y, POSITION * @param feat 地形ID * @return 開いた地形である場合TRUEを返す / Return TRUE if the given feature is an open door */ -bool is_open(FEAT_IDX feat) +bool is_open(player_type *player_ptr, FEAT_IDX feat) { - return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE)); + return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(player_ptr, feat, FF_CLOSE)); } /*! @@ -1254,7 +1257,7 @@ void place_grid(player_type *player_ptr, grid_type *g_ptr, grid_bold_type gb_typ feature_type *f_ptr = &f_info[feat_wall_outer]; if (permanent_wall(f_ptr)) { - g_ptr->feat = (s16b)feat_state(feat_wall_outer, FF_UNPERM); + g_ptr->feat = (s16b)feat_state(player_ptr, feat_wall_outer, FF_UNPERM); } else { @@ -1352,7 +1355,7 @@ void place_bold(player_type *player_ptr, POSITION y, POSITION x, grid_bold_type case outer_noperm: { feature_type *_f_ptr = &f_info[feat_wall_outer]; - if (permanent_wall(_f_ptr)) set_cave_feat(floor_ptr, y, x, (s16b)feat_state(feat_wall_outer, FF_UNPERM)); + if (permanent_wall(_f_ptr)) set_cave_feat(floor_ptr, y, x, (s16b)feat_state(player_ptr, feat_wall_outer, FF_UNPERM)); else set_cave_feat(floor_ptr, y, x, feat_wall_outer); floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); add_cave_info(floor_ptr, y, x, (CAVE_OUTER | CAVE_VAULT)); @@ -1369,7 +1372,7 @@ void place_bold(player_type *player_ptr, POSITION y, POSITION x, grid_bold_type { feature_type *f_ptr = &f_info[feat_wall_solid]; if ((floor_ptr->grid_array[y][x].info & CAVE_VAULT) && permanent_wall(f_ptr)) - set_cave_feat(floor_ptr, y, x, feat_state(feat_wall_solid, FF_UNPERM)); + set_cave_feat(floor_ptr, y, x, feat_state(player_ptr, feat_wall_solid, FF_UNPERM)); else set_cave_feat(floor_ptr, y, x, feat_wall_solid); floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); add_cave_info(floor_ptr, y, x, CAVE_SOLID); diff --git a/src/grid.h b/src/grid.h index da878836b..4a22f0a6c 100644 --- a/src/grid.h +++ b/src/grid.h @@ -171,8 +171,8 @@ extern bool new_player_spot(player_type *creature_ptr); extern void place_bound_perm_wall(player_type *player_ptr, grid_type *g_ptr); -extern bool is_known_trap(grid_type *g_ptr); -extern bool is_hidden_door(grid_type *g_ptr); +extern bool is_known_trap(player_type *player_ptr, grid_type *g_ptr); +extern bool is_hidden_door(player_type *player_ptr, grid_type *g_ptr); extern bool is_mirror_grid(grid_type *g_ptr); extern bool is_glyph_grid(grid_type *g_ptr); extern bool is_explosive_rune_grid(grid_type *g_ptr); @@ -184,7 +184,10 @@ extern bool player_can_enter(player_type *creature_ptr, FEAT_IDX feature, BIT_FL */ #define feat_uses_special(F) (have_flag(f_info[(F)].flags, FF_SPECIAL)) -/* grids.c */ +/*! + * grids.c + * ここにfloor_type を引数として加えるとコンパイルエラー + */ extern POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2); extern void update_local_illumination(player_type *creature_ptr, POSITION y, POSITION x); extern bool no_lite(player_type *creature_ptr); @@ -192,10 +195,10 @@ extern void print_rel(player_type *subject_ptr, SYMBOL_CODE c, TERM_COLOR a, TER extern void note_spot(player_type *player_ptr, POSITION y, POSITION x); extern void lite_spot(player_type *player_ptr, POSITION y, POSITION x); extern void update_flow(player_type *subject_ptr); -extern FEAT_IDX feat_state(FEAT_IDX feat, int action); +extern FEAT_IDX feat_state(player_type *player_ptr, FEAT_IDX feat, int action); extern void cave_alter_feat(player_type *player_ptr, POSITION y, POSITION x, int action); extern void remove_mirror(player_type *caster_ptr, POSITION y, POSITION x); -extern bool is_open(FEAT_IDX feat); +extern bool is_open(player_type *player_ptr, FEAT_IDX feat); extern bool check_local_illumination(player_type *creature_ptr, POSITION y, POSITION x); extern bool cave_monster_teleportable_bold(player_type *player_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode); diff --git a/src/mind.c b/src/mind.c index 92f17201d..cc9ee8998 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1497,13 +1497,13 @@ static bool cast_berserk_spell(player_type *caster_ptr, int spell) py_attack(caster_ptr, y, x, 0); - if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat)) + if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) + if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); diff --git a/src/monster-process.c b/src/monster-process.c index e968a6a4c..efd9632bf 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -340,7 +340,7 @@ static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION if (!(((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) || ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != target_ptr->riding)))) { if (cost == 0) continue; - if (!can_open_door && is_closed_door(g_ptr->feat)) continue; + if (!can_open_door && is_closed_door(target_ptr, g_ptr->feat)) continue; } /* Hack -- for kill or pass wall monster.. */ @@ -1803,7 +1803,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx) } /* Handle doors and secret doors */ - else if (is_closed_door(g_ptr->feat)) + else if (is_closed_door(target_ptr, g_ptr->feat)) { bool may_bash = TRUE; @@ -1872,7 +1872,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx) if (did_open_door || did_bash_door) { /* Break down the door */ - if (did_bash_door && ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))) + if (did_bash_door && ((randint0(100) < 50) || (feat_state(target_ptr, g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))) { cave_alter_feat(target_ptr, ny, nx, FF_BASH); diff --git a/src/player-move.c b/src/player-move.c index 8e87b8849..7ae0208ad 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -193,14 +193,14 @@ static void discover_hidden_things(player_type *creature_ptr, POSITION y, POSITI floor_type *floor_ptr = creature_ptr->current_floor_ptr; g_ptr = &floor_ptr->grid_array[y][x]; - if (g_ptr->mimic && is_trap(g_ptr->feat)) + if (g_ptr->mimic && is_trap(creature_ptr, g_ptr->feat)) { disclose_grid(creature_ptr, y, x); msg_print(_("トラップを発見した。", "You have found a trap.")); disturb(creature_ptr, FALSE, TRUE); } - if (is_hidden_door(g_ptr)) + if (is_hidden_door(creature_ptr, g_ptr)) { msg_print(_("隠しドアを発見した。", "You have found a secret door.")); disclose_grid(creature_ptr, y, x); @@ -638,7 +638,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); /* Remove "unsafe" flag */ - if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE); + if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(creature_ptr, g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE); /* For get everything when requested hehe I'm *NASTY* */ if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr); @@ -1177,7 +1177,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool else { /* Closed doors */ - if (easy_open && is_closed_door(feat) && easy_open_door(creature_ptr, y, x)) return; + if (easy_open && is_closed_door(creature_ptr, feat) && easy_open_door(creature_ptr, y, x)) return; #ifdef JP msg_format("%sが行く手をはばんでいる。", name); @@ -1926,7 +1926,7 @@ static DIRECTION travel_test(player_type *creature_ptr, DIRECTION prev_dir) g_ptr = &floor_ptr->grid_array[creature_ptr->y+ddy[new_dir]][creature_ptr->x+ddx[new_dir]]; /* Close door abort traveling */ - if (!easy_open && is_closed_door(g_ptr->feat)) return 0; + if (!easy_open && is_closed_door(creature_ptr, g_ptr->feat)) return 0; /* Visible and unignorable trap abort tarveling */ if (!g_ptr->mimic && !trap_can_be_ignored(creature_ptr, g_ptr->feat)) return 0; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index b6989f9ab..4e5b53df9 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -210,13 +210,13 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo py_attack(caster_ptr, y, x, 0); - if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat)) + if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) + if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); diff --git a/src/rooms-special.c b/src/rooms-special.c index 7df515861..ede06186d 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -118,7 +118,7 @@ bool build_type15(player_type *player_ptr) x = xval + 2 * ddx_ddd[dir1]; place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR); g_ptr = &floor_ptr->grid_array[y][x]; - if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall; + if (is_closed_door(player_ptr, g_ptr->feat)) g_ptr->mimic = feat_glass_wall; /* Place a potion */ get_obj_num_hook = kind_is_potion; diff --git a/src/rooms-vault.c b/src/rooms-vault.c index ad7c973a1..40498e100 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -432,7 +432,7 @@ static void build_vault(player_type *player_ptr, POSITION yval, POSITION xval, P /* Secret glass doors */ case '-': place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR); - if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall; + if (is_closed_door(player_ptr, g_ptr->feat)) g_ptr->mimic = feat_glass_wall; break; /* Curtains */ diff --git a/src/spells-floor.c b/src/spells-floor.c index 397dcec0b..0ad3721e0 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -361,13 +361,13 @@ void stair_creation(player_type *caster_ptr) { cave_set_feat(caster_ptr, caster_ptr->y, caster_ptr->x, (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= floor_ptr->dun_level - 2)) ? - feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair); + feat_state(caster_ptr, feat_up_stair, FF_SHAFT) : feat_up_stair); } else { cave_set_feat(caster_ptr, caster_ptr->y, caster_ptr->x, (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= floor_ptr->dun_level + 2)) ? - feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair); + feat_state(caster_ptr, feat_down_stair, FF_SHAFT) : feat_down_stair); } /* Connect this stairs to the destination */ diff --git a/src/spells1.c b/src/spells1.c index ab484e510..8f7395d3a 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -370,7 +370,7 @@ static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI case GF_KILL_TRAP: { /* Reveal secret doors */ - if (is_hidden_door(g_ptr)) + if (is_hidden_door(caster_ptr, g_ptr)) { /* Pick a door */ disclose_grid(caster_ptr, y, x); @@ -383,7 +383,7 @@ static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI } /* Destroy traps */ - if (is_trap(g_ptr->feat)) + if (is_trap(caster_ptr, g_ptr->feat)) { /* Check line of sight */ if (known) @@ -397,7 +397,7 @@ static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI } /* Locked doors are unlocked */ - if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN)) + if (is_closed_door(caster_ptr, g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN)) { FEAT_IDX old_feat = g_ptr->feat; @@ -427,7 +427,7 @@ static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI case GF_KILL_DOOR: { /* Destroy all doors and traps */ - if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR)) + if (is_trap(caster_ptr, g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR)) { /* Check line of sight */ if (known) diff --git a/src/spells3.c b/src/spells3.c index 3f09435ee..a79dee6d9 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -1068,7 +1068,7 @@ bool vanish_dungeon(player_type *caster_ptr) /* Set boundary mimic if needed */ if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); @@ -1083,7 +1083,7 @@ bool vanish_dungeon(player_type *caster_ptr) /* Set boundary mimic if needed */ if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); @@ -1102,7 +1102,7 @@ bool vanish_dungeon(player_type *caster_ptr) /* Set boundary mimic if needed */ if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); @@ -1117,7 +1117,7 @@ bool vanish_dungeon(player_type *caster_ptr) /* Set boundary mimic if needed */ if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(g_ptr->mimic, FF_HURT_DISI); + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); /* Check for change to boring grid */ if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); diff --git a/src/trap.c b/src/trap.c index a01d3d608..6a4b7b1f5 100644 --- a/src/trap.c +++ b/src/trap.c @@ -670,7 +670,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) } } - if (break_trap && is_trap(g_ptr->feat)) + if (break_trap && is_trap(trapped_ptr, g_ptr->feat)) { cave_alter_feat(trapped_ptr, y, x, FF_DISARM); msg_print(_("トラップを粉砕した。", "You destroyed the trap.")); diff --git a/src/warning.c b/src/warning.c index 90d2f22e3..4b37193f2 100644 --- a/src/warning.c +++ b/src/warning.c @@ -514,7 +514,7 @@ bool process_warning(player_type *creature_ptr, POSITION xx, POSITION yy) else old_damage = old_damage / 2; g_ptr = &creature_ptr->current_floor_ptr->grid_array[yy][xx]; - bool is_warning = (!easy_disarm && is_trap(g_ptr->feat)) || (g_ptr->mimic && is_trap(g_ptr->feat)); + bool is_warning = (!easy_disarm && is_trap(creature_ptr, g_ptr->feat)) || (g_ptr->mimic && is_trap(creature_ptr, g_ptr->feat)); is_warning = !one_in_(13); if (!is_warning) return TRUE; -- 2.11.0