From 43131cb5d487a36a2b680ec897669ad8a9d268d5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 17 Jun 2021 20:52:06 +0800 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 7 ------- server/gameserver/creature.h | 1 - server/gameserver/moveableentity.cc | 7 +++++++ server/gameserver/moveableentity.h | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 13b2e3a..5eb1866 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1187,13 +1187,6 @@ bool Creature::IsEnemy(Creature* target) } } -void Creature::TraverseCreatures(std::function func) -{ - room->grid_service->TraverseCreatures(room->GetRoomIdx(), - GetGridList(), - func); -} - void Creature::TraverseProperTargets(std::function func) { auto callback = diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 59a613e..9f2aacb 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -151,7 +151,6 @@ class Creature : public MoveableEntity int GetActionType() { return action_type; } int GetActionTargetId() { return action_target_id; } - void TraverseCreatures(std::function func); void TraverseProperTargets(std::function func); void TraverseProperTargetsNoTeammate(std::function func); CreatureWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; }; diff --git a/server/gameserver/moveableentity.cc b/server/gameserver/moveableentity.cc index ca65da5..d207d91 100644 --- a/server/gameserver/moveableentity.cc +++ b/server/gameserver/moveableentity.cc @@ -63,3 +63,10 @@ void MoveableEntity::SyncAroundPlayers(const char* file, int line, const char* f hum->AddToNewObjects(this); }); } + +void MoveableEntity::TraverseCreatures(std::function func) +{ + room->grid_service->TraverseCreatures(room->GetRoomIdx(), + GetGridList(), + func); +} diff --git a/server/gameserver/moveableentity.h b/server/gameserver/moveableentity.h index 6919f9d..9fd2926 100644 --- a/server/gameserver/moveableentity.h +++ b/server/gameserver/moveableentity.h @@ -13,6 +13,7 @@ class MoveableEntity : public RoomEntity int UpdatedTimes() { return updated_times_;} std::set& GetGridList() { return grid_list_; } + void TraverseCreatures(std::function func); void TraverseAllLayerEntityList(std::function func); void TraverseAllLayerHumanList(std::function func);