• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisão6baaed8f63980e08cd4d510fb800be86247b944b (tree)
Hora2020-02-17 21:40:38
AutorHourier <hourier@user...>
CommiterHourier

Mensagem de Log

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

Mudança Sumário

Diff

--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -59,7 +59,25 @@ typedef struct {
5959 bool did_kill_wall;
6060 } turn_flags;
6161
62+typedef struct {
63+ BIT_FLAGS old_r_flags1;
64+ BIT_FLAGS old_r_flags2;
65+ BIT_FLAGS old_r_flags3;
66+ BIT_FLAGS old_r_flags4;
67+ BIT_FLAGS old_r_flags5;
68+ BIT_FLAGS old_r_flags6;
69+ BIT_FLAGS old_r_flagsr;
70+
71+ byte old_r_blows0;
72+ byte old_r_blows1;
73+ byte old_r_blows2;
74+ byte old_r_blows3;
75+
76+ byte old_r_cast_spell;
77+} old_race_flags;
78+
6279 turn_flags *init_turn_flags(player_type *target_ptr, MONSTER_IDX m_idx, turn_flags *turn_flags_ptr);
80+old_race_flags *init_old_race_flags(old_race_flags *old_race_flags_ptr);
6381
6482 void decide_drop_from_monster(player_type *target_ptr, MONSTER_IDX m_idx, bool is_riding_mon);
6583 bool process_stealth(player_type *target_ptr, MONSTER_IDX m_idx);
@@ -1794,6 +1812,7 @@ bool cast_spell(player_type *target_ptr, MONSTER_IDX m_idx, bool aware)
17941812
17951813
17961814 /*!
1815+ * todo 少し長いが、これといってブロックとしてまとまった部分もないので暫定でこのままとする
17971816 * @brief モンスターの移動に関するメインルーチン
17981817 * @param target_ptr プレーヤーへの参照ポインタ
17991818 * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ
@@ -2612,43 +2631,32 @@ bool process_monster_fear(player_type *target_ptr, turn_flags *turn_flags_ptr, M
26122631 */
26132632 void process_monsters(player_type *target_ptr)
26142633 {
2615- BIT_FLAGS old_r_flags1 = 0L;
2616- BIT_FLAGS old_r_flags2 = 0L;
2617- BIT_FLAGS old_r_flags3 = 0L;
2618- BIT_FLAGS old_r_flags4 = 0L;
2619- BIT_FLAGS old_r_flags5 = 0L;
2620- BIT_FLAGS old_r_flags6 = 0L;
2621- BIT_FLAGS old_r_flagsr = 0L;
2622-
2623- byte old_r_blows0 = 0;
2624- byte old_r_blows1 = 0;
2625- byte old_r_blows2 = 0;
2626- byte old_r_blows3 = 0;
2634+ old_race_flags tmp_flags;
2635+ old_race_flags *old_race_flags_ptr = init_old_race_flags(&tmp_flags);
26272636
26282637 floor_type *floor_ptr = target_ptr->current_floor_ptr;
26292638 floor_ptr->monster_noise = FALSE;
26302639
26312640 MONRACE_IDX old_monster_race_idx = target_ptr->monster_race_idx;
2632- byte old_r_cast_spell = 0;
26332641 if (target_ptr->monster_race_idx)
26342642 {
26352643 monster_race *r_ptr;
26362644 r_ptr = &r_info[target_ptr->monster_race_idx];
26372645
2638- old_r_flags1 = r_ptr->r_flags1;
2639- old_r_flags2 = r_ptr->r_flags2;
2640- old_r_flags3 = r_ptr->r_flags3;
2641- old_r_flags4 = r_ptr->r_flags4;
2642- old_r_flags5 = r_ptr->r_flags5;
2643- old_r_flags6 = r_ptr->r_flags6;
2644- old_r_flagsr = r_ptr->r_flagsr;
2646+ old_race_flags_ptr->old_r_flags1 = r_ptr->r_flags1;
2647+ old_race_flags_ptr->old_r_flags2 = r_ptr->r_flags2;
2648+ old_race_flags_ptr->old_r_flags3 = r_ptr->r_flags3;
2649+ old_race_flags_ptr->old_r_flags4 = r_ptr->r_flags4;
2650+ old_race_flags_ptr->old_r_flags5 = r_ptr->r_flags5;
2651+ old_race_flags_ptr->old_r_flags6 = r_ptr->r_flags6;
2652+ old_race_flags_ptr->old_r_flagsr = r_ptr->r_flagsr;
26452653
2646- old_r_blows0 = r_ptr->r_blows[0];
2647- old_r_blows1 = r_ptr->r_blows[1];
2648- old_r_blows2 = r_ptr->r_blows[2];
2649- old_r_blows3 = r_ptr->r_blows[3];
2654+ old_race_flags_ptr->old_r_blows0 = r_ptr->r_blows[0];
2655+ old_race_flags_ptr->old_r_blows1 = r_ptr->r_blows[1];
2656+ old_race_flags_ptr->old_r_blows2 = r_ptr->r_blows[2];
2657+ old_race_flags_ptr->old_r_blows3 = r_ptr->r_blows[3];
26502658
2651- old_r_cast_spell = r_ptr->r_cast_spell;
2659+ old_race_flags_ptr->old_r_cast_spell = r_ptr->r_cast_spell;
26522660 }
26532661
26542662 for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--)
@@ -2670,6 +2678,7 @@ void process_monsters(player_type *target_ptr)
26702678
26712679 if (m_ptr->cdis >= AAF_LIMIT) continue;
26722680
2681+ // todo この代入は有効活用されていないはず
26732682 POSITION fx = m_ptr->fx;
26742683 POSITION fy = m_ptr->fy;
26752684 if (!target_ptr->no_flowed)
@@ -2730,19 +2739,39 @@ void process_monsters(player_type *target_ptr)
27302739 monster_race *r_ptr;
27312740 r_ptr = &r_info[target_ptr->monster_race_idx];
27322741
2733- if ((old_r_flags1 != r_ptr->r_flags1) ||
2734- (old_r_flags2 != r_ptr->r_flags2) ||
2735- (old_r_flags3 != r_ptr->r_flags3) ||
2736- (old_r_flags4 != r_ptr->r_flags4) ||
2737- (old_r_flags5 != r_ptr->r_flags5) ||
2738- (old_r_flags6 != r_ptr->r_flags6) ||
2739- (old_r_flagsr != r_ptr->r_flagsr) ||
2740- (old_r_blows0 != r_ptr->r_blows[0]) ||
2741- (old_r_blows1 != r_ptr->r_blows[1]) ||
2742- (old_r_blows2 != r_ptr->r_blows[2]) ||
2743- (old_r_blows3 != r_ptr->r_blows[3]) ||
2744- (old_r_cast_spell != r_ptr->r_cast_spell))
2742+ if ((old_race_flags_ptr->old_r_flags1 != r_ptr->r_flags1) ||
2743+ (old_race_flags_ptr->old_r_flags2 != r_ptr->r_flags2) ||
2744+ (old_race_flags_ptr->old_r_flags3 != r_ptr->r_flags3) ||
2745+ (old_race_flags_ptr->old_r_flags4 != r_ptr->r_flags4) ||
2746+ (old_race_flags_ptr->old_r_flags5 != r_ptr->r_flags5) ||
2747+ (old_race_flags_ptr->old_r_flags6 != r_ptr->r_flags6) ||
2748+ (old_race_flags_ptr->old_r_flagsr != r_ptr->r_flagsr) ||
2749+ (old_race_flags_ptr->old_r_blows0 != r_ptr->r_blows[0]) ||
2750+ (old_race_flags_ptr->old_r_blows1 != r_ptr->r_blows[1]) ||
2751+ (old_race_flags_ptr->old_r_blows2 != r_ptr->r_blows[2]) ||
2752+ (old_race_flags_ptr->old_r_blows3 != r_ptr->r_blows[3]) ||
2753+ (old_race_flags_ptr->old_r_cast_spell != r_ptr->r_cast_spell))
27452754 {
27462755 target_ptr->window |= (PW_MONSTER);
27472756 }
27482757 }
2758+
2759+
2760+old_race_flags *init_old_race_flags(old_race_flags *old_race_flags_ptr)
2761+{
2762+ old_race_flags_ptr->old_r_flags1 = 0L;
2763+ old_race_flags_ptr->old_r_flags2 = 0L;
2764+ old_race_flags_ptr->old_r_flags3 = 0L;
2765+ old_race_flags_ptr->old_r_flags4 = 0L;
2766+ old_race_flags_ptr->old_r_flags5 = 0L;
2767+ old_race_flags_ptr->old_r_flags6 = 0L;
2768+ old_race_flags_ptr->old_r_flagsr = 0L;
2769+
2770+ old_race_flags_ptr->old_r_blows0 = 0;
2771+ old_race_flags_ptr->old_r_blows1 = 0;
2772+ old_race_flags_ptr->old_r_blows2 = 0;
2773+ old_race_flags_ptr->old_r_blows3 = 0;
2774+
2775+ old_race_flags_ptr->old_r_cast_spell = 0;
2776+ return old_race_flags_ptr;
2777+}
Show on old repository browser