OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-market-edits' into feature...
[hengband/hengband.git] / src / pet / pet-fall-off.c
index d424679..b7ab5f1 100644 (file)
@@ -9,9 +9,8 @@
 #include "core/player-update-types.h"
 #include "core/stuff-handler.h"
 #include "core/window-redrawer.h"
-#include "floor/floor.h"
+#include "floor/cave.h"
 #include "grid/feature.h"
-#include "io/targeting.h"
 #include "monster-race/monster-race.h"
 #include "monster/monster-describer.h"
 #include "pet/pet-util.h"
@@ -19,7 +18,7 @@
 #include "player/player-move.h"
 #include "player/player-skill.h"
 #include "system/floor-type-definition.h"
-#include "util/bit-flags-calculator.h"
+#include "target/target-checker.h"
 #include "view/display-messages.h"
 
 /*!
@@ -90,20 +89,20 @@ static bool calc_fall_off_possibility(player_type *creature_ptr, const HIT_POINT
  */
 bool process_fall_off_horse(player_type *creature_ptr, HIT_POINT dam, bool force)
 {
-    POSITION sy = 0, sx = 0;
+    POSITION sy = 0;
+    POSITION sx = 0;
     int sn = 0;
     GAME_TEXT m_name[MAX_NLEN];
     monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
     monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-    if (!creature_ptr->riding)
-        return FALSE;
-    if (creature_ptr->wild_mode)
+    if (!creature_ptr->riding || creature_ptr->wild_mode)
         return FALSE;
 
     if (dam >= 0 || force) {
-        calc_fall_off_possibility(creature_ptr, dam, force, r_ptr);
-        
+        if (!calc_fall_off_possibility(creature_ptr, dam, force, r_ptr))
+            return FALSE;
+
         /* Check around the player */
         for (DIRECTION i = 0; i < 8; i++) {
             POSITION y = creature_ptr->y + ddy_ddd[i];
@@ -116,12 +115,12 @@ bool process_fall_off_horse(player_type *creature_ptr, HIT_POINT dam, bool force
                 continue;
 
             /* Skip non-empty grids */
-            if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !cave_have_flag_grid(g_ptr, FF_CAN_FLY)) {
+            if (!cave_has_flag_grid(g_ptr, FF_MOVE) && !cave_has_flag_grid(g_ptr, FF_CAN_FLY)) {
                 if (!can_player_ride_pet(creature_ptr, g_ptr, FALSE))
                     continue;
             }
 
-            if (cave_have_flag_grid(g_ptr, FF_PATTERN))
+            if (cave_has_flag_grid(g_ptr, FF_PATTERN))
                 continue;
 
             /* Count "safe" grids */
@@ -178,4 +177,4 @@ bool process_fall_off_horse(player_type *creature_ptr, HIT_POINT dam, bool force
         (void)move_player_effect(creature_ptr, creature_ptr->y, creature_ptr->x, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
 
     return fall_dam;
-}
+}
\ No newline at end of file