• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisão03442f3a16364bc46a94e72ebf32af04cec146e5 (tree)
Hora2020-02-17 21:53:13
AutorHourier <hourier@user...>
CommiterHourier

Mensagem de Log

[Refactor] #40030 process_monsters() からdecide_process_continue() を分離 / Separated decide_process_continue() from process_monsters()

Mudança Sumário

Diff

--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -120,6 +120,7 @@ void monster_pickup_object(player_type *target_ptr, turn_flags *turn_flags_ptr,
120120 bool process_monster_fear(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx);
121121
122122 void save_old_race_flags(player_type *target_ptr, old_race_flags *old_race_flags_ptr);
123+bool decide_process_continue(player_type *target_ptr, monster_type *m_ptr);
123124
124125 /*!
125126 * @brief モンスターが敵に接近するための方向を決める /
@@ -2661,30 +2662,7 @@ void process_monsters(player_type *target_ptr)
26612662
26622663 if (m_ptr->cdis >= AAF_LIMIT) continue;
26632664
2664- // todo この代入は有効活用されていないはず
2665- POSITION fx = m_ptr->fx;
2666- POSITION fy = m_ptr->fy;
2667- if (!target_ptr->no_flowed)
2668- {
2669- m_ptr->mflag2 &= ~MFLAG2_NOFLOW;
2670- }
2671-
2672- bool test = FALSE;
2673- if (m_ptr->cdis <= (is_pet(m_ptr) ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
2674- {
2675- test = TRUE;
2676- }
2677- else if ((m_ptr->cdis <= MAX_SIGHT || target_ptr->phase_out) &&
2678- (player_has_los_bold(target_ptr, fy, fx) || (target_ptr->cursed & TRC_AGGRAVATE)))
2679- {
2680- test = TRUE;
2681- }
2682- else if (m_ptr->target_y)
2683- {
2684- test = TRUE;
2685- }
2686-
2687- if (!test) continue;
2665+ if (!decide_process_continue(target_ptr, m_ptr)) continue;
26882666
26892667 SPEED speed;
26902668 if (target_ptr->riding == i)
@@ -2789,3 +2767,34 @@ void save_old_race_flags(player_type *target_ptr, old_race_flags *old_race_flags
27892767
27902768 old_race_flags_ptr->old_r_cast_spell = r_ptr->r_cast_spell;
27912769 }
2770+
2771+
2772+/*!
2773+ * todo fy/fxへの代入は有効活用されていないはず
2774+ * @brief 後続のモンスター処理が必要かどうか判定する (要調査)
2775+ * @param target_ptr プレーヤーへの参照ポインタ
2776+ * @param m_ptr モンスターへの参照ポインタ
2777+ */
2778+bool decide_process_continue(player_type *target_ptr, monster_type *m_ptr)
2779+{
2780+ monster_race *r_ptr;
2781+ r_ptr = &r_info[m_ptr->r_idx];
2782+ POSITION fx = m_ptr->fx;
2783+ POSITION fy = m_ptr->fy;
2784+ if (!target_ptr->no_flowed)
2785+ {
2786+ m_ptr->mflag2 &= ~MFLAG2_NOFLOW;
2787+ }
2788+
2789+ if (m_ptr->cdis <= (is_pet(m_ptr) ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
2790+ return TRUE;
2791+
2792+ if ((m_ptr->cdis <= MAX_SIGHT || target_ptr->phase_out) &&
2793+ (player_has_los_bold(target_ptr, fy, fx) || (target_ptr->cursed & TRC_AGGRAVATE)))
2794+ return TRUE;
2795+
2796+ if (m_ptr->target_y)
2797+ return TRUE;
2798+
2799+ return FALSE;
2800+}
Show on old repository browser