mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8678] Move objects updates store and proccessing for send to client in per map way.
This commit is contained in:
parent
abb77cfdbf
commit
8bf52f7c63
10 changed files with 80 additions and 61 deletions
|
|
@ -697,6 +697,9 @@ void Map::Update(const uint32 &t_diff)
|
|||
}
|
||||
}
|
||||
|
||||
// Send world objects and item update field changes
|
||||
SendObjectUpdates();
|
||||
|
||||
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
|
||||
// This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended
|
||||
if (!IsBattleGroundOrArena())
|
||||
|
|
@ -3415,3 +3418,25 @@ DynamicObject* Map::GetDynamicObject(uint64 guid)
|
|||
{
|
||||
return m_objectsStore.find<DynamicObject>(guid, (DynamicObject*)NULL);
|
||||
}
|
||||
|
||||
void Map::SendObjectUpdates()
|
||||
{
|
||||
UpdateDataMapType update_players;
|
||||
|
||||
while(!i_objectsToClientUpdate.empty())
|
||||
{
|
||||
Object* obj = *i_objectsToClientUpdate.begin();
|
||||
i_objectsToClientUpdate.erase(i_objectsToClientUpdate.begin());
|
||||
if (!obj)
|
||||
continue;
|
||||
obj->BuildUpdateData(update_players);
|
||||
}
|
||||
|
||||
WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
|
||||
for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
|
||||
{
|
||||
iter->second.BuildPacket(&packet);
|
||||
iter->first->GetSession()->SendPacket(&packet);
|
||||
packet.clear(); // clean the string
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue