コード例 #1
0
ファイル: PoolMgr.cpp プロジェクト: Mathias-Nolam/wtfisthis
void PoolGroup<Creature>::Despawn1Object(uint64 guid)
{
    if (CreatureData const* data = sObjectMgr->GetCreatureData(guid))
    {
        sObjectMgr->RemoveCreatureFromGrid(guid, data);

        Map* map = sMapMgr->CreateBaseMap(data->mapid);
        if (!map->Instanceable())
        {
            auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(guid);
            for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
                itr->second->AddObjectToRemoveList();
        }
    }
}
コード例 #2
0
void PoolGroup<Creature>::Despawn1Object(ObjectGuid::LowType guid)
{
    if (CreatureData const* data = sObjectMgr->GetCreatureData(guid))
    {
        sObjectMgr->RemoveCreatureFromGrid(guid, data);

        Map* map = sMapMgr->CreateBaseMap(data->spawnPoint.GetMapId());
        if (!map->Instanceable())
        {
            auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(guid);
            for (auto itr = creatureBounds.first; itr != creatureBounds.second;)
            {
                Creature* creature = itr->second;
                ++itr;
                // For dynamic spawns, save respawn time here
                if (!creature->GetRespawnCompatibilityMode())
                    creature->SaveRespawnTime(0, false);
                creature->AddObjectToRemoveList();
            }
        }
    }
}