Core/Pools: Implemented pooling for instances

This commit is contained in:
Shauren
2022-06-11 14:04:56 +02:00
parent 4e2b4ada0b
commit 94d829c84f
11 changed files with 311 additions and 207 deletions

View File

@@ -365,6 +365,8 @@ i_scriptLock(false), _respawnCheckTimer(0)
GetGuidSequenceGenerator<HighGuid::Transport>().Set(sObjectMgr->GetGenerator<HighGuid::Transport>().GetNextAfterMaxUsed());
_poolData = sPoolMgr->InitPoolsForMap(this);
MMAP::MMapFactory::createOrGetMMapManager()->loadMapInstance(sWorld->GetDataPath(), GetId(), i_InstanceId);
sScriptMgr->OnCreateMap(this);
@@ -3392,7 +3394,7 @@ void Map::ProcessRespawns()
ASSERT_NOTNULL(GetRespawnMapForType(next->type))->erase(next->spawnId);
// step 2: tell pooling logic to do its thing
sPoolMgr->UpdatePool(poolId, next->type, next->spawnId);
sPoolMgr->UpdatePool(GetPoolData(), poolId, next->type, next->spawnId);
// step 3: get rid of the actual entry
RemoveRespawnTime(next->type, next->spawnId, nullptr, true);
@@ -3485,6 +3487,10 @@ bool Map::ShouldBeSpawnedOnGridLoad(SpawnObjectType type, ObjectGuid::LowType sp
if (!IsSpawnGroupActive(spawnGroup->groupId))
return false;
if (spawnData->ToSpawnData()->poolId)
if (!GetPoolData().IsSpawnedObject(type, spawnId))
return false;
return true;
}