本文整理汇总了C++中CellCoord类的典型用法代码示例。如果您正苦于以下问题:C++ CellCoord类的具体用法?C++ CellCoord怎么用?C++ CellCoord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CellCoord类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void ObjectAccessor::RemoveCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
/// @todo more works need to be done for corpse and other world object
if (Map* map = corpse->FindMap())
{
corpse->DestroyForNearbyPlayers();
if (corpse->IsInGrid())
map->RemoveFromMap(corpse, false);
else
{
corpse->RemoveFromWorld();
corpse->ResetMap();
}
}
else
corpse->RemoveFromWorld();
// Critical section
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
if (iter == i_player2corpse.end()) /// @todo Fix this
return;
// build mapid*cellid -> guid_set map
CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY());
sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID()));
i_player2corpse.erase(iter);
}
}
示例2: TC_LOG_ERROR
template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/)
{
T* obj = HashMapHolder<T>::Find(guid);
if (!obj || obj->GetMapId() != mapid)
return NULL;
CellCoord p = Trinity::ComputeCellCoord(x, y);
if (!p.IsCoordValid())
{
TC_LOG_ERROR("misc", "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!q.IsCoordValid())
{
TC_LOG_ERROR("misc", "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
int32 dx = int32(p.x_coord) - int32(q.x_coord);
int32 dy = int32(p.y_coord) - int32(q.y_coord);
if (dx > -2 && dx < 2 && dy > -2 && dy < 2)
return obj;
else
return NULL;
}
示例3: Visit
void ObjectWorldLoader::Visit(CorpseMapType &m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
// corpses are always added to spawn mode 0 and they are spawned by their instance id
CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), 0, cellCoord.GetId());
LoadHelper(cell_guids.corpses, cellCoord, m, i_corpses, i_map);
}
示例4: ASSERT
void ObjectAccessor::AddCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
// Critical section
{
boost::unique_lock<boost::shared_mutex> lock(_corpseLock);
ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
i_player2corpse[corpse->GetOwnerGUID()] = corpse;
// build mapid*cellid -> guid_set map
CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY());
sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), corpse->GetOwnerGUID().GetCounter(), corpse->GetInstanceId());
}
}
示例5: Visit
void ObjectWorldLoader::Visit(CorpseMapType& /*m*/)
{
CellCoord cellCoord = i_cell.GetCellCoord();
if (std::unordered_set<Corpse*> const* corpses = i_map->GetCorpsesInCell(cellCoord.GetId()))
{
for (Corpse* corpse : *corpses)
{
corpse->AddToWorld();
GridType& cell = i_grid.GetGridType(i_cell.CellX(), i_cell.CellY());
if (corpse->IsWorldObject())
cell.AddWorldObject(corpse);
else
cell.AddGridObject(corpse);
++i_corpses;
}
}
}
示例6: Visit
void ObjectGridLoader::Visit(GameObjectMapType& m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map);
}