Exemple #1
0
// annotation etc.. only use first cell. multiple cells exist only for grid display.
spAspCell_t  AspFrame::getFirstCell() {
     if(cellList->getCellMap()->size() < 1) {
	if(specFlag == 0) setDefaultFOV();
	else setCellFOV(1,1); 
     }
     AspCellMap::iterator itr;
     return getCellList()->getFirstCell(itr);
}
//================================================================================
//
//the cells send an updated permission  to the specified player
//
void BuildingObject::updateCellPermissions(PlayerObject* player, bool access)
{
	//gLogger->logMsg("BuildingObject::updateCellPermissions: Permission set to %u",access);
	//iterate through all the cells - do they need to be deleted ?
	//place players inside a cell in the world
	CellObjectList*				cellList	= getCellList();
	CellObjectList::iterator	cellIt		= cellList->begin();

	while(cellIt != cellList->end())
	{
		CellObject* cell = (*cellIt);
					
		gMessageLib->sendUpdateCellPermissionMessage(cell,access,player);	

		++cellIt;
	}

}
Exemple #3
0
void BuildingObject::prepareDestruction() 
{
    //iterate through all the registered watchers
    //place players inside into the world and unregister the content
    //add an option to delete those players we send to ...

    gContainerManager->sendToRegisteredPlayers(this, [=] (PlayerObject* player) {

        gSpatialIndexManager->removeStructureItemsForPlayer(player,this);

        //is the player inside ??? or was he merely still watching??
        CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId()));
        if (!cell) {
			//we have no interest in bystanders
            return;
        }

        BuildingObject* building = dynamic_cast<BuildingObject*>(gWorldManager->getObjectById(cell->getParentId()));
        if (!building || building->getId() != this->getId()) {
            return;
        }

        //No need to update the SI here as we only leave the cell
        player->updatePosition(0, player->getWorldPosition());
        player->setParentIdIncDB(0);

        cell->RemoveObject(this, player);

        gMessageLib->broadcastContainmentMessage(player, 0, 0xffffffff);
    });

    //remove items in the building from the world
    CellObjectList* cell_list = getCellList();
    std::for_each(cell_list->begin(), cell_list->end(), [] (CellObject* cell) {
        cell->prepareDestruction();
    });
}