X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd-action%2Fcmd-pet.cpp;h=0806dc328686a99616aac99ddbe67c10dcc775e1;hb=f840acc725e5e1dd9404448686d669cd6980dcdf;hp=6df201061965183c8e25c9ac8bab1d6bd1d58642;hpb=d05be23e87882abc4faca27fa91dcf9ffaa031ab;p=hengbandforosx%2Fhengbandosx.git diff --git a/src/cmd-action/cmd-pet.cpp b/src/cmd-action/cmd-pet.cpp index 6df201061..0806dc328 100644 --- a/src/cmd-action/cmd-pet.cpp +++ b/src/cmd-action/cmd-pet.cpp @@ -28,6 +28,7 @@ #include "monster/monster-info.h" #include "monster/monster-status-setter.h" #include "monster/monster-status.h" +#include "monster/monster-util.h" #include "monster/smart-learn-types.h" #include "object-hook/hook-weapon.h" #include "pet/pet-util.h" @@ -218,7 +219,7 @@ bool do_cmd_riding(PlayerType *player_ptr, bool force) return false; } - if (grid.m_idx) { + if (is_monster(grid.m_idx)) { PlayerEnergy(player_ptr).set_player_turn_energy(100); msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -237,7 +238,7 @@ bool do_cmd_riding(PlayerType *player_ptr, bool force) const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx]; - if (!grid.m_idx || !m_ptr->ml) { + if (!is_monster(grid.m_idx) || !m_ptr->ml) { msg_print(_("その場所にはモンスターはいません。", "There is no monster here.")); return false; } @@ -326,7 +327,7 @@ static void do_name_pet(PlayerType *player_ptr) target_pet = old_target_pet; auto &floor = *player_ptr->current_floor_ptr; const auto &grid = floor.grid_array[target_row][target_col]; - if (grid.m_idx == 0) { + if (!is_monster(grid.m_idx)) { return; } @@ -703,7 +704,7 @@ void do_cmd_pet(PlayerType *player_ptr) player_ptr->pet_t_m_idx = 0; } else { auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col]; - if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) { + if (is_monster(g_ptr->m_idx) && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) { player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; player_ptr->pet_follow_distance = PET_DESTROY_DIST; } else {