• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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


Commit MetaInfo

Revision31572f0533aeeac1341deca7fb6c7c86c05ad748 (tree)
Time2020-03-08 13:32:36
AuthorHourier <hourier@user...>
CommiterHourier

Log Message

[Refactor] #40030 Changed function names in monster-process.c

Change Summary

Incremental Difference

--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -120,7 +120,7 @@ static bool mon_will_run(player_type *target_ptr, MONSTER_IDX m_idx)
120120 * @param xp 適したマスのX座標を返す参照ポインタ
121121 * @return 有効なマスがあった場合TRUEを返す
122122 */
123-static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
123+static bool sweep_ranged_attack_grid(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
124124 {
125125 floor_type *floor_ptr = target_ptr->current_floor_ptr;
126126 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
@@ -181,7 +181,7 @@ static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION
181181 * @param yp 移動先のマスのY座標を返す参照ポインタ
182182 * @param xp 移動先のマスのX座標を返す参照ポインタ
183183 * @param no_flow モンスターにFLOWフラグが経っていない状態でTRUE
184- * @return 有効なマスがあった場合TRUEを返す
184+ * @return なし
185185 * @details
186186 * Note that ghosts and rock-eaters are never allowed to "flow",\n
187187 * since they should move directly towards the player.\n
@@ -202,7 +202,7 @@ static bool get_moves_aux2(player_type *target_ptr, MONSTER_IDX m_idx, POSITION
202202 * being close enough to chase directly. I have no idea what will\n
203203 * happen if you combine "smell" with low "aaf" values.\n
204204 */
205-static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no_flow)
205+static void sweep_movable_grid(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no_flow)
206206 {
207207 grid_type *g_ptr;
208208 floor_type *floor_ptr = target_ptr->current_floor_ptr;
@@ -213,16 +213,16 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *
213213 r_ptr->a_ability_flags1 & (RF5_ATTACK_MASK) ||
214214 r_ptr->a_ability_flags2 & (RF6_ATTACK_MASK))
215215 {
216- if (get_moves_aux2(target_ptr, m_idx, yp, xp)) return TRUE;
216+ if (sweep_ranged_attack_grid(target_ptr, m_idx, yp, xp)) return;
217217 }
218218
219- if (no_flow) return FALSE;
220- if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) return FALSE;
221- if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != target_ptr->riding)) return FALSE;
219+ if (no_flow) return;
220+ if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) return;
221+ if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != target_ptr->riding)) return;
222222
223223 POSITION y1 = m_ptr->fy;
224224 POSITION x1 = m_ptr->fx;
225- if (player_has_los_bold(target_ptr, y1, x1) && projectable(target_ptr, target_ptr->y, target_ptr->x, y1, x1)) return FALSE;
225+ if (player_has_los_bold(target_ptr, y1, x1) && projectable(target_ptr, target_ptr->y, target_ptr->x, y1, x1)) return;
226226
227227 g_ptr = &floor_ptr->grid_array[y1][x1];
228228
@@ -234,14 +234,14 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *
234234 }
235235 else if (g_ptr->when)
236236 {
237- if (floor_ptr->grid_array[target_ptr->y][target_ptr->x].when - g_ptr->when > 127) return FALSE;
237+ if (floor_ptr->grid_array[target_ptr->y][target_ptr->x].when - g_ptr->when > 127) return;
238238
239239 use_scent = TRUE;
240240 best = 0;
241241 }
242242 else
243243 {
244- return FALSE;
244+ return;
245245 }
246246
247247 for (int i = 7; i >= 0; i--)
@@ -279,10 +279,6 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *
279279 *yp = target_ptr->y + 16 * ddy_ddd[i];
280280 *xp = target_ptr->x + 16 * ddx_ddd[i];
281281 }
282-
283- if (best == 999 || best == 0) return FALSE;
284-
285- return TRUE;
286282 }
287283
288284
@@ -298,7 +294,7 @@ static bool get_moves_aux(player_type *target_ptr, MONSTER_IDX m_idx, POSITION *
298294 * but instead of heading directly for it, the monster should "swerve"\n
299295 * around the player so that he has a smaller chance of getting hit.\n
300296 */
301-static bool get_fear_moves_aux(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
297+static bool sweep_runnable_away_grid(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
302298 {
303299 POSITION gy = 0, gx = 0;
304300
@@ -345,7 +341,7 @@ static bool get_fear_moves_aux(floor_type *floor_ptr, MONSTER_IDX m_idx, POSITIO
345341 * @param mm 移動方向を返す方向IDの参照ポインタ
346342 * @return 有効方向があった場合TRUEを返す
347343 */
348-static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm)
344+static bool get_movable_grid(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm)
349345 {
350346 floor_type *floor_ptr = target_ptr->current_floor_ptr;
351347 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
@@ -433,7 +429,7 @@ static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm)
433429
434430 if (!done)
435431 {
436- (void)get_moves_aux(target_ptr, m_idx, &y2, &x2, no_flow);
432+ sweep_movable_grid(target_ptr, m_idx, &y2, &x2, no_flow);
437433 y = m_ptr->fy - y2;
438434 x = m_ptr->fx - x2;
439435 }
@@ -450,7 +446,7 @@ static bool get_moves(player_type *target_ptr, MONSTER_IDX m_idx, DIRECTION *mm)
450446 int tmp_y = (-y);
451447 if (find_safety(target_ptr, m_idx, &y, &x) && !no_flow)
452448 {
453- if (get_fear_moves_aux(target_ptr->current_floor_ptr, m_idx, &y, &x))
449+ if (sweep_runnable_away_grid(target_ptr->current_floor_ptr, m_idx, &y, &x))
454450 done = TRUE;
455451 }
456452
@@ -545,7 +541,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
545541 mm[0] = mm[1] = mm[2] = mm[3] = 0;
546542 mm[4] = mm[5] = mm[6] = mm[7] = 0;
547543
548- if (!decide_monster_movement_direction(target_ptr, mm, m_idx, turn_flags_ptr->aware, get_moves)) return;
544+ if (!decide_monster_movement_direction(target_ptr, mm, m_idx, turn_flags_ptr->aware, get_movable_grid)) return;
549545
550546 int count = 0;
551547 if (!process_monster_movement(target_ptr, turn_flags_ptr, m_idx, mm, oy, ox, &count)) return;
--- a/src/monster/monster-direction.c
+++ b/src/monster/monster-direction.c
@@ -180,7 +180,7 @@ static bool random_walk(player_type *target_ptr, DIRECTION *mm, monster_type *m_
180180 * @param m_idx モンスターID
181181 * @return モンスターがペットであればTRUE
182182 */
183-static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, get_moves_pf get_moves)
183+static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, get_moves_pf get_movable_grid)
184184 {
185185 monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
186186 if (!is_pet(m_ptr)) return FALSE;
@@ -198,7 +198,7 @@ static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm
198198 target_ptr->pet_follow_distance = PET_SEEK_DIST;
199199 }
200200
201- (void)get_moves(target_ptr, m_idx, mm);
201+ (void)get_movable_grid(target_ptr, m_idx, mm);
202202 target_ptr->pet_follow_distance = (s16b)dis;
203203 return TRUE;
204204 }
@@ -212,7 +212,7 @@ static bool decide_pet_movement_direction(player_type *target_ptr, DIRECTION *mm
212212 * @param aware モンスターがプレーヤーに気付いているならばTRUE、超隠密状態ならばFALSE
213213 * @return 移動先が存在すればTRUE
214214 */
215-bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_moves)
215+bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_movable_grid)
216216 {
217217 monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
218218 monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -231,7 +231,7 @@ bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, M
231231 return TRUE;
232232 }
233233
234- if (decide_pet_movement_direction(target_ptr, mm, m_idx, get_moves)) return TRUE;
234+ if (decide_pet_movement_direction(target_ptr, mm, m_idx, get_movable_grid)) return TRUE;
235235
236236 if (!is_hostile(m_ptr))
237237 {
@@ -240,7 +240,7 @@ bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, M
240240 return TRUE;
241241 }
242242
243- if (!get_moves(target_ptr, m_idx, mm)) return FALSE;
243+ if (!get_movable_grid(target_ptr, m_idx, mm)) return FALSE;
244244
245245 return TRUE;
246246 }
--- a/src/monster/monster-direction.h
+++ b/src/monster/monster-direction.h
@@ -6,4 +6,4 @@
66 typedef bool(*get_moves_pf)(player_type*, MONSTER_IDX, DIRECTION*);
77
88 bool get_enemy_dir(player_type *target_ptr, MONSTER_IDX m_idx, int *mm);
9-bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_moves);
9+bool decide_monster_movement_direction(player_type *target_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware, get_moves_pf get_movable_grid);
--- a/src/monster/monster-util.c
+++ b/src/monster/monster-util.c
@@ -133,7 +133,7 @@ void store_enemy_approch_direction(int *mm, POSITION y, POSITION x)
133133
134134
135135 /*!
136- * @brief get_moves() における移動の方向を保存する
136+ * @brief get_movable_grid() における移動の方向を保存する
137137 * @param mm 移動方向
138138 * @param y 移動先Y座標
139139 * @param x 移動先X座標