mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8653] Implemented per map guids store.
This patch implements storing guid->object pairs on per map level, this leads to less locking in ObjectAccessor in case of further multithreaded map update. For case of cross map guid looking (auras cases) all maps are linked into ObjectAccessor and can be traversed for this lookup. Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
40b0612dfc
commit
45c9c136ba
18 changed files with 272 additions and 116 deletions
|
|
@ -57,23 +57,24 @@ m_declinedname(NULL)
|
|||
|
||||
Pet::~Pet()
|
||||
{
|
||||
if(m_uint32Values) // only for fully created Object
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
|
||||
delete m_declinedname;
|
||||
}
|
||||
|
||||
void Pet::AddToWorld()
|
||||
{
|
||||
///- Register the pet for guid lookup
|
||||
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
|
||||
if(!IsInWorld())
|
||||
GetMap()->GetObjectsStore().insert<Pet>(GetGUID(), (Pet*)this);
|
||||
|
||||
Unit::AddToWorld();
|
||||
}
|
||||
|
||||
void Pet::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the pet from the accessor
|
||||
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
|
||||
if(IsInWorld())
|
||||
GetMap()->GetObjectsStore().erase<Pet>(GetGUID(), (Pet*)NULL);
|
||||
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue