OSDN Git Service

[Refactor] #38844 ゲームシステム進行フラグを world_type 構造体へ移動.
[hengband/hengband.git] / src / cmd-pet.c
index f3b9cec..d033d7a 100644 (file)
@@ -1,6 +1,7 @@
 #include "angband.h"
 #include "util.h"
 
+#include "cmd-dump.h"
 #include "floor.h"
 #include "grid.h"
 #include "melee.h"
 #include "player-status.h"
 #include "player-effects.h"
 #include "player-skill.h"
+#include "player-class.h"
 #include "object-hook.h"
 #include "monster.h"
 #include "monster-status.h"
 #include "cmd-pet.h"
 #include "cmd-basic.h"
 #include "view-mainwindow.h"
+#include "targeting.h"
+#include "world.h"
 
 /*!
 * @brief プレイヤーの騎乗/下馬処理判定
 bool player_can_ride_aux(grid_type *g_ptr, bool now_riding)
 {
        bool p_can_enter;
-       bool old_character_xtra = character_xtra;
+       bool old_character_xtra = current_world_ptr->character_xtra;
        MONSTER_IDX old_riding = p_ptr->riding;
        bool old_riding_ryoute = p_ptr->riding_ryoute;
        bool old_old_riding_ryoute = p_ptr->old_riding_ryoute;
        bool old_pf_ryoute = (p_ptr->pet_extra_flags & PF_RYOUTE) ? TRUE : FALSE;
 
        /* Hack -- prevent "icky" message */
-       character_xtra = TRUE;
+       current_world_ptr->character_xtra = TRUE;
 
        if (now_riding) p_ptr->riding = g_ptr->m_idx;
        else
@@ -56,7 +60,7 @@ bool player_can_ride_aux(grid_type *g_ptr, bool now_riding)
        p_ptr->update |= PU_BONUS;
        handle_stuff();
 
-       character_xtra = old_character_xtra;
+       current_world_ptr->character_xtra = old_character_xtra;
 
        return p_can_enter;
 }
@@ -74,7 +78,7 @@ PERCENTAGE calculate_upkeep(void)
 
        total_friends = 0;
 
-       for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
+       for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
        {
                monster_type *m_ptr;
                monster_race *r_ptr;
@@ -145,7 +149,7 @@ void do_cmd_pet_dismiss(void)
        C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
 
        /* Process the monsters (backwards) */
-       for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+       for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
        {
                if (is_pet(&current_floor_ptr->m_list[pet_ctr]))
                        who[max_pet++] = pet_ctr;
@@ -595,9 +599,9 @@ void do_cmd_pet(void)
        if (p_ptr->riding)
        {
                if ((p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
-                       object_allow_two_hands_wielding(&inventory[INVEN_RARM])) ||
+                       object_allow_two_hands_wielding(&p_ptr->inventory_list[INVEN_RARM])) ||
                        (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
-                               object_allow_two_hands_wielding(&inventory[INVEN_LARM])))
+                               object_allow_two_hands_wielding(&p_ptr->inventory_list[INVEN_LARM])))
                {
                        if (p_ptr->pet_extra_flags & PF_RYOUTE)
                        {
@@ -814,7 +818,7 @@ void do_cmd_pet(void)
        case PET_DISMISS: /* Dismiss pets */
        {
                /* Check pets (backwards) */
-               for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+               for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                {
                        /* Player has pet */
                        if (is_pet(&current_floor_ptr->m_list[pet_ctr])) break;
@@ -892,7 +896,7 @@ void do_cmd_pet(void)
                if (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS)
                {
                        p_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
-                       for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+                       for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
                        {
                                /* Access the monster */
                                m_ptr = &current_floor_ptr->m_list[pet_ctr];