本文整理汇总了C++中MapCell::SetActivity方法的典型用法代码示例。如果您正苦于以下问题:C++ MapCell::SetActivity方法的具体用法?C++ MapCell::SetActivity怎么用?C++ MapCell::SetActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapCell
的用法示例。
在下文中一共展示了MapCell::SetActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAllCells
void MapMgr::LoadAllCells()
{
// eek
MapCell * cellInfo;
CellSpawns * spawns;
for( uint32 x = 0 ; x < _sizeX ; x ++ )
{
for( uint32 y = 0 ; y < _sizeY ; y ++ )
{
cellInfo = GetCell( x , y );
if( !cellInfo )
{
// Cell doesn't exist, create it.
// There is no spoon. Err... cell.
cellInfo = Create( x , y );
cellInfo->Init( x , y , _mapId , this );
sLog.outDetail( "Created cell [%u,%u] on map %d (instance %d)." , x , y , _mapId , m_instanceID );
cellInfo->SetActivity( true );
_map->CellGoneActive( x , y );
ASSERT( !cellInfo->IsLoaded() );
spawns = _map->GetSpawnsList( x , y );
if( spawns )
cellInfo->LoadObjects( spawns );
}
else
{
// Cell exists, but is inactive
if ( !cellInfo->IsActive() )
{
sLog.outDetail("Activated cell [%u,%u] on map %d (instance %d).", x, y, _mapId, m_instanceID );
_map->CellGoneActive( x , y );
cellInfo->SetActivity( true );
if (!cellInfo->IsLoaded())
{
//sLog.outDetail("Loading objects for Cell [%d][%d] on map %d (instance %d)...",
// posX, posY, this->_mapId, m_instanceID);
spawns = _map->GetSpawnsList( x , y );
if( spawns )
cellInfo->LoadObjects( spawns );
}
}
}
}
}
}
示例2: UpdateCellActivity
void MapMgr::UpdateCellActivity(uint32 x, uint32 y, int radius)
{
CellSpawns * sp;
uint32 endX = (x + radius) <= _sizeX ? x + radius : (_sizeX-1);
uint32 endY = (y + radius) <= _sizeY ? y + radius : (_sizeY-1);
uint32 startX = x - radius > 0 ? x - radius : 0;
uint32 startY = y - radius > 0 ? y - radius : 0;
uint32 posX, posY;
MapCell *objCell;
for (posX = startX; posX <= endX; posX++ )
{
for (posY = startY; posY <= endY; posY++ )
{
objCell = GetCell(posX, posY);
if (!objCell)
{
if (_CellActive(posX, posY))
{
objCell = Create(posX, posY);
objCell->Init(posX, posY, _mapId, this);
sLog.outDetail("Cell [%d,%d] on map %d (instance %d) is now active.",
posX, posY, this->_mapId, m_instanceID);
objCell->SetActivity(true);
_map->CellGoneActive(posX, posY);
ASSERT(!objCell->IsLoaded());
sLog.outDetail("Loading objects for Cell [%d][%d] on map %d (instance %d)...",
posX, posY, this->_mapId, m_instanceID);
sp = _map->GetSpawnsList(posX, posY);
if(sp) objCell->LoadObjects(sp);
}
}
else
{
//Cell is now active
if (_CellActive(posX, posY) && !objCell->IsActive())
{
sLog.outDetail("Cell [%d,%d] on map %d (instance %d) is now active.",
posX, posY, this->_mapId, m_instanceID);
_map->CellGoneActive(posX, posY);
objCell->SetActivity(true);
if (!objCell->IsLoaded())
{
sLog.outDetail("Loading objects for Cell [%d][%d] on map %d (instance %d)...",
posX, posY, this->_mapId, m_instanceID);
sp = _map->GetSpawnsList(posX, posY);
if(sp) objCell->LoadObjects(sp);
}
}
//Cell is no longer active
else if (!_CellActive(posX, posY) && objCell->IsActive())
{
sLog.outDetail("Cell [%d,%d] on map %d (instance %d) is now idle.",
posX, posY, this->_mapId, m_instanceID);
_map->CellGoneIdle(posX, posY);
objCell->SetActivity(false);
}
}
}
}
}
示例3: UpdateCellActivity
void MapMgr::UpdateCellActivity(uint32 x, uint32 y, uint32 radius)
{
CellSpawns* sp;
uint32 endX = (x + radius) <= _sizeX ? x + radius : (_sizeX - 1);
uint32 endY = (y + radius) <= _sizeY ? y + radius : (_sizeY - 1);
uint32 startX = x > radius ? x - radius : 0;
uint32 startY = y > radius ? y - radius : 0;
uint32 posX, posY;
MapCell* objCell;
for(posX = startX; posX <= endX; posX++)
{
for(posY = startY; posY <= endY; posY++)
{
objCell = GetCell(posX, posY);
if(!objCell)
{
if(_CellActive(posX, posY))
{
objCell = Create(posX, posY);
objCell->Init(posX, posY, this);
LOG_DETAIL("Cell [%u,%u] on map %u (instance %u) is now active.",
posX, posY, this->_mapId, m_instanceID);
objCell->SetActivity(true);
_map->CellGoneActive(posX, posY);
_terrain->LoadTile((int32)posX / 8, (int32)posY / 8);
ARCEMU_ASSERT(!objCell->IsLoaded());
LOG_DETAIL("Loading objects for Cell [%u][%u] on map %u (instance %u)...",
posX, posY, this->_mapId, m_instanceID);
sp = _map->GetSpawnsList(posX, posY);
if(sp) objCell->LoadObjects(sp);
}
}
else
{
//Cell is now active
if(_CellActive(posX, posY) && !objCell->IsActive())
{
LOG_DETAIL("Cell [%u,%u] on map %u (instance %u) is now active.",
posX, posY, this->_mapId, m_instanceID);
_map->CellGoneActive(posX, posY);
_terrain->LoadTile((int32)posX / 8, (int32)posY / 8);
objCell->SetActivity(true);
if(!objCell->IsLoaded())
{
LOG_DETAIL("Loading objects for Cell [%u][%u] on map %u (instance %u)...",
posX, posY, this->_mapId, m_instanceID);
sp = _map->GetSpawnsList(posX, posY);
if(sp) objCell->LoadObjects(sp);
}
}
//Cell is no longer active
else if(!_CellActive(posX, posY) && objCell->IsActive())
{
LOG_DETAIL("Cell [%u,%u] on map %u (instance %u) is now idle.", posX, posY, _mapId, m_instanceID);
_map->CellGoneIdle(posX, posY);
objCell->SetActivity(false);
_terrain->UnloadTile((int32)posX / 8, (int32)posY / 8);
}
}
}
}
}