OSDN Git Service

[Fix] #963 Resolved the indication that unique_ptr<PlayerEnergy> should be PlayerEnergy
[hengbandforosx/hengbandosx.git] / src / cmd-action / cmd-pet.cpp
index a8b6ef0..aa08f74 100644 (file)
@@ -8,11 +8,12 @@
 #include "core/stuff-handler.h"
 #include "core/window-redrawer.h"
 #include "effect/spells-effect-util.h"
+#include "floor/geometry.h"
 #include "floor/pattern-walk.h"
 #include "game-option/input-options.h"
+#include "game-option/map-screen-options.h"
 #include "game-option/play-record-options.h"
 #include "game-option/text-display-options.h"
-#include "game-option/map-screen-options.h"
 #include "grid/feature.h"
 #include "grid/grid.h"
 #include "inventory/inventory-slot-types.h"
 #include "monster/smart-learn-types.h"
 #include "object-hook/hook-weapon.h"
 #include "pet/pet-util.h"
+#include "player-info/equipment-info.h"
+#include "player-status/player-energy.h"
+#include "player-status/player-hand-types.h"
 #include "player/attack-defense-types.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-move.h"
 #include "player/player-skill.h"
 #include "player/player-status-flags.h"
-#include "player/player-status.h"
 #include "player/special-defense-types.h"
 #include "status/action-setter.h"
 #include "system/floor-type-definition.h"
+#include "system/monster-race-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
 #include "target/target-checker.h"
 #include "target/target-getter.h"
 #include "target/target-setter.h"
@@ -57,8 +64,6 @@
 #include "view/display-messages.h"
 #include "world/world.h"
 
-int total_friends = 0;
-
 /*!
  * @brief ペットを開放するコマンドのメインルーチン
  * @return なし
@@ -218,7 +223,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
             return FALSE;
 
         if (g_ptr->m_idx) {
-            take_turn(creature_ptr, 100);
+            PlayerEnergy(creature_ptr).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
 
             msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -255,7 +260,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
             /* Feature code (applying "mimic" field) */
             feature_type *f_ptr = &f_info[get_feat_mimic(g_ptr)];
 #ifdef JP
-            msg_format("そのモンスターは%sの%sにいる。", f_name + f_ptr->name,
+            msg_format("そのモンスターは%sの%sにいる。", f_ptr->name.c_str(),
                 ((!has_flag(f_ptr->flags, FF_MOVE) && !has_flag(f_ptr->flags, FF_CAN_FLY))
                     || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
                     ? "中"
@@ -266,14 +271,14 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
                     || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
                     ? "in"
                     : "on",
-                f_name + f_ptr->name);
+                f_ptr->name.c_str());
 #endif
 
             return FALSE;
         }
         if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[GINOU_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
             msg_print(_("うまく乗れなかった。", "You failed to ride."));
-            take_turn(creature_ptr, 100);
+            PlayerEnergy(creature_ptr).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
             return FALSE;
         }
 
@@ -294,7 +299,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
             health_track(creature_ptr, 0);
     }
 
-    take_turn(creature_ptr, 100);
+    PlayerEnergy(creature_ptr).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
 
     /* Mega-Hack -- Forget the view and lite */
     creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
@@ -408,13 +413,13 @@ void do_cmd_pet(player_type *creature_ptr)
 #ifdef JP
     sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)",
         (creature_ptr->pet_t_m_idx
-                ? (creature_ptr->image ? "何か奇妙な物" : (r_name + r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name))
+                ? (creature_ptr->image ? "何か奇妙な物" : r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name.c_str())
                 : "指定なし"));
 #else
     sprintf(target_buf, "specify a target of pet (now:%s)",
-        (creature_ptr->pet_t_m_idx ? (
-             creature_ptr->image ? "something strange" : (r_name + r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name))
-                                   : "nothing"));
+        (creature_ptr->pet_t_m_idx
+                ? (creature_ptr->image ? "something strange" : r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name.c_str())
+                : "nothing"));
 #endif
     power_desc[num] = target_buf;
     powers[num++] = PET_TARGET;
@@ -678,7 +683,7 @@ void do_cmd_pet(player_type *creature_ptr)
 
         /* Abort if needed */
         if (!flag) {
-            free_turn(creature_ptr);
+            PlayerEnergy(creature_ptr).reset_player_turn();
             return;
         }