• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisão37e39def1535880ec5054ca9b481721860f66212 (tree)
Hora2020-02-17 22:15:22
AutorHourier <hourier@user...>
CommiterHourier

Mensagem de Log

[Refactor] #40030 process_monsters() からsweep_monster_process() を分離 / Separated sweep_monster_process() 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+void sweep_monster_process(player_type *target_ptr);
123124 bool decide_process_continue(player_type *target_ptr, monster_type *m_ptr);
124125 SPEED decide_monster_speed(player_type *target_ptr, monster_type *m_ptr, int monster_number);
125126 void update_player_window(player_type *target_ptr, old_race_flags *old_race_flags_ptr);
@@ -2644,42 +2645,7 @@ void process_monsters(player_type *target_ptr)
26442645
26452646 MONRACE_IDX old_monster_race_idx = target_ptr->monster_race_idx;
26462647 save_old_race_flags(target_ptr, old_race_flags_ptr);
2647-
2648- for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--)
2649- {
2650- monster_type *m_ptr;
2651- monster_race *r_ptr;
2652- m_ptr = &floor_ptr->m_list[i];
2653- r_ptr = &r_info[m_ptr->r_idx];
2654-
2655- if (target_ptr->leaving) break;
2656- if (!monster_is_valid(m_ptr)) continue;
2657- if (target_ptr->wild_mode) continue;
2658-
2659- if (m_ptr->mflag & MFLAG_BORN)
2660- {
2661- m_ptr->mflag &= ~(MFLAG_BORN);
2662- continue;
2663- }
2664-
2665- if (m_ptr->cdis >= AAF_LIMIT) continue;
2666- if (!decide_process_continue(target_ptr, m_ptr)) continue;
2667-
2668- SPEED speed = decide_monster_speed(target_ptr, m_ptr, i);
2669- m_ptr->energy_need -= SPEED_TO_ENERGY(speed);
2670- if (m_ptr->energy_need > 0) continue;
2671-
2672- m_ptr->energy_need += ENERGY_NEED();
2673- hack_m_idx = i;
2674- process_monster(target_ptr, i);
2675- reset_target(m_ptr);
2676-
2677- if (target_ptr->no_flowed && one_in_(3))
2678- m_ptr->mflag2 |= MFLAG2_NOFLOW;
2679-
2680- if (!target_ptr->playing || target_ptr->is_dead) break;
2681- if (target_ptr->leaving) break;
2682- }
2648+ sweep_monster_process(target_ptr);
26832649
26842650 hack_m_idx = 0;
26852651 if (!target_ptr->monster_race_idx || (target_ptr->monster_race_idx != old_monster_race_idx))
@@ -2743,6 +2709,51 @@ void save_old_race_flags(player_type *target_ptr, old_race_flags *old_race_flags
27432709
27442710
27452711 /*!
2712+ * @brief フロア内のモンスターについてターン終了時の処理を繰り返す
2713+ * @param target_ptr プレーヤーへの参照ポインタ
2714+ */
2715+void sweep_monster_process(player_type *target_ptr)
2716+{
2717+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
2718+ for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--)
2719+ {
2720+ monster_type *m_ptr;
2721+ monster_race *r_ptr;
2722+ m_ptr = &floor_ptr->m_list[i];
2723+ r_ptr = &r_info[m_ptr->r_idx];
2724+
2725+ if (target_ptr->leaving) return;
2726+ if (!monster_is_valid(m_ptr)) continue;
2727+ if (target_ptr->wild_mode) continue;
2728+
2729+ if (m_ptr->mflag & MFLAG_BORN)
2730+ {
2731+ m_ptr->mflag &= ~(MFLAG_BORN);
2732+ continue;
2733+ }
2734+
2735+ if (m_ptr->cdis >= AAF_LIMIT) continue;
2736+ if (!decide_process_continue(target_ptr, m_ptr)) continue;
2737+
2738+ SPEED speed = decide_monster_speed(target_ptr, m_ptr, i);
2739+ m_ptr->energy_need -= SPEED_TO_ENERGY(speed);
2740+ if (m_ptr->energy_need > 0) continue;
2741+
2742+ m_ptr->energy_need += ENERGY_NEED();
2743+ hack_m_idx = i;
2744+ process_monster(target_ptr, i);
2745+ reset_target(m_ptr);
2746+
2747+ if (target_ptr->no_flowed && one_in_(3))
2748+ m_ptr->mflag2 |= MFLAG2_NOFLOW;
2749+
2750+ if (!target_ptr->playing || target_ptr->is_dead) return;
2751+ if (target_ptr->leaving) return;
2752+ }
2753+}
2754+
2755+
2756+/*!
27462757 * todo fy/fxへの代入は有効活用されていないはず
27472758 * @brief 後続のモンスター処理が必要かどうか判定する (要調査)
27482759 * @param target_ptr プレーヤーへの参照ポインタ
Show on old repository browser