bool GameObjectManager::GetGameObjectsWithAttribute(const noRTTI &type,dbCompositionList &list)
{
	uint32 count = m_allEntities.size();
	GameObject *pkGameObject;

	std::map<int, GameObject*>::iterator b = m_allEntities.begin();
	std::map<int, GameObject*>::iterator e = m_allEntities.end();
	for ( ; b != e; b++)
	{		
		pkGameObject = (*b).second;
		if( pkGameObject->GetAttributeOfType(type) )
			list.push_back( pkGameObject );
	}

	if( list.size()>0 )
		return true;

	return false;
}
示例#2
0
文件: database.cpp 项目: unni07/AI
/*---------------------------------------------------------------------------*
  Name:         ComposeList

  Description:  Compose a list of objects given certain type.

  Arguments:    list   : the list to fill with the result of the operation
                type   : the type of object to add to the list (optional)

  Returns:      None. (The result is stored in the list argument.)
 *---------------------------------------------------------------------------*/
void Database::ComposeList( dbCompositionList & list, unsigned int type )
{
	//Find all objects of "type"
	for( dbContainer::iterator i=m_database.begin(); i!=m_database.end(); ++i )
	{
		if( type == OBJECT_Ignore_Type || (*i)->GetType() & type )
		{	//Type matches
			list.push_back(*i);
		}
	}
}
/*---------------------------------------------------------------------------*
  Name:         ComposeList

  Description:  Compose a list of objects given certain type.

  Arguments:    list   : the list to fill with the result of the operation
                type   : the type of object to add to the list (optional)

  Returns:      None. (The result is stored in the list argument.)
 *---------------------------------------------------------------------------*/
void GameObjectManager::ComposeList( dbCompositionList & list, unsigned int type /*= 0 */ )
{
	GameObject* pkGameObject;
	std::map<int, GameObject*>::iterator b = m_allEntities.begin();
	std::map<int, GameObject*>::iterator e = m_allEntities.end();
	for ( ; b != e; b++)
	{		
		pkGameObject = (*b).second;
		if( type == OBJECT_Ignore_Type || pkGameObject->GetType() & type )
		{	//Type matches
			list.push_back(pkGameObject);
		}
	}
}