1 #include "pet/pet-util.h"
2 #include "core/player-update-types.h"
3 #include "core/stuff-handler.h"
4 #include "monster/monster-info.h"
5 #include "world/world.h"
8 * @brief プレイヤーの騎乗/下馬処理判定
9 * @param g_ptr プレイヤーの移動先マスの構造体参照ポインタ
10 * @param now_riding TRUEなら下馬処理、FALSEならば騎乗処理
11 * @return 可能ならばTRUEを返す
13 bool can_player_ride_pet(player_type *creature_ptr, grid_type *g_ptr, bool now_riding)
15 bool old_character_xtra = current_world_ptr->character_xtra;
16 MONSTER_IDX old_riding = creature_ptr->riding;
17 bool old_riding_two_hands = creature_ptr->riding_ryoute;
18 bool old_old_riding_two_hands = creature_ptr->old_riding_ryoute;
19 bool old_pf_two_hands = (creature_ptr->pet_extra_flags & PF_TWO_HANDS) ? TRUE : FALSE;
20 current_world_ptr->character_xtra = TRUE;
23 creature_ptr->riding = g_ptr->m_idx;
25 creature_ptr->riding = 0;
26 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
27 creature_ptr->riding_ryoute = creature_ptr->old_riding_ryoute = FALSE;
30 creature_ptr->update |= PU_BONUS;
31 handle_stuff(creature_ptr);
33 bool p_can_enter = player_can_enter(creature_ptr, g_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
34 creature_ptr->riding = old_riding;
36 creature_ptr->pet_extra_flags |= (PF_TWO_HANDS);
38 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
40 creature_ptr->riding_ryoute = old_riding_two_hands;
41 creature_ptr->old_riding_ryoute = old_old_riding_two_hands;
42 creature_ptr->update |= PU_BONUS;
43 handle_stuff(creature_ptr);
45 current_world_ptr->character_xtra = old_character_xtra;