mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-08 05:11:09 +00:00
feat(Core/Grids): Remove WorldObject separation in grid containers (#22595)
This commit is contained in:
@@ -86,17 +86,6 @@ Object::Object() : m_PackGUID(sizeof(uint64) + 1)
|
||||
WorldObject::~WorldObject()
|
||||
{
|
||||
sScriptMgr->OnWorldObjectDestroy(this);
|
||||
|
||||
// this may happen because there are many !create/delete
|
||||
if (IsWorldObject() && m_currMap)
|
||||
{
|
||||
if (IsCorpse())
|
||||
{
|
||||
LOG_FATAL("entities.object", "Object::~Object Corpse {}, type={} deleted but still in map!!", GetGUID().ToString(), ((Corpse*)this)->GetType());
|
||||
ABORT();
|
||||
}
|
||||
ResetMap();
|
||||
}
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
@@ -1047,8 +1036,8 @@ void MovementInfo::OutDebug()
|
||||
LOG_INFO("movement", "splineElevation: {}", splineElevation);
|
||||
}
|
||||
|
||||
WorldObject::WorldObject(bool isWorldObject) : WorldLocation(),
|
||||
LastUsedScriptID(0), m_name(""), m_isActive(false), m_visibilityDistanceOverride(), m_isWorldObject(isWorldObject), m_zoneScript(nullptr),
|
||||
WorldObject::WorldObject() : WorldLocation(),
|
||||
LastUsedScriptID(0), m_name(""), m_isActive(false), m_visibilityDistanceOverride(), m_zoneScript(nullptr),
|
||||
_zoneId(0), _areaId(0), _floorZ(INVALID_HEIGHT), _outdoors(false), _liquidData(), _updatePositionData(false), m_transport(nullptr),
|
||||
m_currMap(nullptr), _heartbeatTimer(HEARTBEAT_INTERVAL), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_useCombinedPhases(true),
|
||||
m_notifyflags(0), m_executed_notifies(0), _objectVisibilityContainer(this)
|
||||
@@ -2102,9 +2091,6 @@ void WorldObject::SetMap(Map* map)
|
||||
m_InstanceId = map->GetInstanceId();
|
||||
|
||||
sScriptMgr->OnWorldObjectSetMap(this, map);
|
||||
|
||||
if (IsWorldObject())
|
||||
m_currMap->AddWorldObject(this);
|
||||
}
|
||||
|
||||
void WorldObject::ResetMap()
|
||||
@@ -2112,11 +2098,6 @@ void WorldObject::ResetMap()
|
||||
ASSERT(m_currMap);
|
||||
ASSERT(!IsInWorld());
|
||||
|
||||
if (IsWorldObject())
|
||||
{
|
||||
m_currMap->RemoveWorldObject(this);
|
||||
}
|
||||
|
||||
sScriptMgr->OnWorldObjectResetMap(this);
|
||||
|
||||
m_currMap = nullptr;
|
||||
@@ -2198,10 +2179,10 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
switch (mask)
|
||||
{
|
||||
case UNIT_MASK_SUMMON:
|
||||
summon = new TempSummon(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty, false);
|
||||
summon = new TempSummon(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
break;
|
||||
case UNIT_MASK_GUARDIAN:
|
||||
summon = new Guardian(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty, false);
|
||||
summon = new Guardian(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
break;
|
||||
case UNIT_MASK_PUPPET:
|
||||
summon = new Puppet(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
@@ -2210,7 +2191,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
summon = new Totem(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
break;
|
||||
case UNIT_MASK_MINION:
|
||||
summon = new Minion(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty, false);
|
||||
summon = new Minion(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
|
||||
break;
|
||||
default:
|
||||
return nullptr;
|
||||
@@ -2244,7 +2225,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
|
||||
// call MoveInLineOfSight for nearby creatures
|
||||
Acore::AIRelocationNotifier notifier(*summon);
|
||||
Cell::VisitAllObjects(summon, notifier, GetVisibilityRange());
|
||||
Cell::VisitObjects(summon, notifier, GetVisibilityRange());
|
||||
|
||||
return summon;
|
||||
}
|
||||
@@ -2429,7 +2410,7 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive
|
||||
Creature* creature = nullptr;
|
||||
Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
|
||||
Acore::CreatureLastSearcher<Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
|
||||
Cell::VisitAllObjects(this, searcher, range);
|
||||
Cell::VisitObjects(this, searcher, range);
|
||||
return creature;
|
||||
}
|
||||
|
||||
@@ -2438,7 +2419,7 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range, bool o
|
||||
GameObject* go = nullptr;
|
||||
Acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range, onlySpawned);
|
||||
Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
|
||||
Cell::VisitGridObjects(this, searcher, range);
|
||||
Cell::VisitObjects(this, searcher, range);
|
||||
return go;
|
||||
}
|
||||
|
||||
@@ -2447,7 +2428,7 @@ GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float
|
||||
GameObject* go = nullptr;
|
||||
Acore::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
|
||||
Acore::GameObjectLastSearcher<Acore::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker);
|
||||
Cell::VisitGridObjects(this, searcher, range);
|
||||
Cell::VisitObjects(this, searcher, range);
|
||||
return go;
|
||||
}
|
||||
|
||||
@@ -2457,7 +2438,7 @@ Player* WorldObject::SelectNearestPlayer(float distance) const
|
||||
|
||||
Acore::NearestPlayerInObjectRangeCheck checker(this, distance);
|
||||
Acore::PlayerLastSearcher<Acore::NearestPlayerInObjectRangeCheck> searcher(this, target, checker);
|
||||
Cell::VisitWorldObjects(this, searcher, distance);
|
||||
Cell::VisitObjects(this, searcher, distance);
|
||||
|
||||
return target;
|
||||
}
|
||||
@@ -2475,35 +2456,35 @@ void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameo
|
||||
{
|
||||
Acore::AllGameObjectsWithEntryInRange check(this, entry, maxSearchRange);
|
||||
Acore::GameObjectListSearcher<Acore::AllGameObjectsWithEntryInRange> searcher(this, gameobjectList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
Cell::VisitObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, std::vector<uint32> const& entries, float maxSearchRange) const
|
||||
{
|
||||
Acore::AllGameObjectsMatchingOneEntryInRange check(this, entries, maxSearchRange);
|
||||
Acore::GameObjectListSearcher searcher(this, gameobjectList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
Cell::VisitObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureList, uint32 entry, float maxSearchRange) const
|
||||
{
|
||||
Acore::AllCreaturesOfEntryInRange check(this, entry, maxSearchRange);
|
||||
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
Cell::VisitObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureList, std::vector<uint32> const& entries, float maxSearchRange) const
|
||||
{
|
||||
Acore::AllCreaturesMatchingOneEntryInRange check(this, entries, maxSearchRange);
|
||||
Acore::CreatureListSearcher searcher(this, creatureList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
Cell::VisitObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetDeadCreatureListInGrid(std::list<Creature*>& creaturedeadList, float maxSearchRange, bool alive /*= false*/) const
|
||||
{
|
||||
Acore::AllDeadCreaturesInRange check(this, maxSearchRange, alive);
|
||||
Acore::CreatureListSearcher<Acore::AllDeadCreaturesInRange> searcher(this, creaturedeadList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
Cell::VisitObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2895,7 +2876,7 @@ void WorldObject::PlayRadiusSound(uint32 sound_id, float radius)
|
||||
std::vector<Player*> targets;
|
||||
Acore::AnyPlayerInObjectRangeCheck check(this, radius, false);
|
||||
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check);
|
||||
Cell::VisitWorldObjects(this, searcher, radius);
|
||||
Cell::VisitObjects(this, searcher, radius);
|
||||
|
||||
for (Player* player : targets)
|
||||
player->SendDirectMessage(WorldPackets::Misc::Playsound(sound_id).Write());
|
||||
@@ -2914,7 +2895,7 @@ void WorldObject::PlayRadiusMusic(uint32 music_id, float radius)
|
||||
std::vector<Player*> targets;
|
||||
Acore::AnyPlayerInObjectRangeCheck check(this, radius, false);
|
||||
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check);
|
||||
Cell::VisitWorldObjects(this, searcher, radius);
|
||||
Cell::VisitObjects(this, searcher, radius);
|
||||
|
||||
for (Player* player : targets)
|
||||
player->SendDirectMessage(WorldPackets::Misc::PlayMusic(music_id).Write());
|
||||
@@ -2942,7 +2923,7 @@ void WorldObject::UpdateObjectVisibility(bool /*forced*/, bool /*fromUpdate*/)
|
||||
{
|
||||
//updates object's visibility for nearby players
|
||||
Acore::VisibleChangesNotifier notifier(*this);
|
||||
Cell::VisitWorldObjects(this, notifier, GetVisibilityRange());
|
||||
Cell::VisitObjects(this, notifier, GetVisibilityRange());
|
||||
}
|
||||
|
||||
void WorldObject::AddToNotify(uint16 f)
|
||||
@@ -2990,7 +2971,7 @@ void WorldObject::GetCreaturesWithEntryInRange(std::list<Creature*>& creatureLis
|
||||
{
|
||||
Acore::AllCreaturesOfEntryInRange check(this, entry, radius);
|
||||
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(this, creatureList, check);
|
||||
Cell::VisitAllObjects(this, searcher, radius);
|
||||
Cell::VisitObjects(this, searcher, radius);
|
||||
}
|
||||
|
||||
void WorldObject::AddToObjectUpdate()
|
||||
|
||||
Reference in New Issue
Block a user