Ejemplo n.º 1
0
void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapType &m, uint32 &count, Map* map)
{
    if (cell_corpses.empty())
        return;

    for (CellCorpseSet::const_iterator itr = cell_corpses.begin(); itr != cell_corpses.end(); ++itr)
    {
        if (itr->second != map->GetInstanceId())
            continue;

        ObjectGuid player_guid(HIGHGUID_PLAYER, itr->first);

        Corpse* obj = sObjectAccessor->GetCorpseForPlayerGUID(player_guid);
        if (!obj)
            continue;

        /// @todo this is a hack
        // corpse's map should be reset when the map is unloaded
        // but it may still exist when the grid is unloaded but map is not
        // in that case map == currMap
        obj->SetMap(map);

        if (obj->IsInGrid())
        {
            obj->AddToWorld();
            continue;
        }

        AddObjectHelper(cell, m, count, map, obj);
    }
}