当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectList::begin方法代码示例

本文整理汇总了C++中ObjectList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectList::begin方法的具体用法?C++ ObjectList::begin怎么用?C++ ObjectList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectList的用法示例。


在下文中一共展示了ObjectList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: propagate_argument_rec

 void propagate_argument_rec( Node* current, RenameVisitor* v )
 {
     if( !current->is_visited( ) )
     {
         current->set_visited( true );
         
         if( current->is_entry_node( ) || current->is_exit_node( ) )
             return;
         
         if( current->is_graph_node( ) )
         {
             propagate_argument_rec( current->get_graph_entry_node( ), v );
         }
         else
         {
             ObjectList<Nodecl::NodeclBase> stmts = current->get_statements( );
             ObjectList<Nodecl::NodeclBase> new_stmts;
             for( ObjectList<Nodecl::NodeclBase>::iterator it = stmts.begin( ); it != stmts.end( ); ++it )
             {
                 Nodecl::NodeclBase it_copy = Nodecl::Utils::deep_copy( *it, *it );
                 v->walk( *it );
                 new_stmts.insert( it_copy );
             }
             current->set_statements( new_stmts );
         }
             
         ObjectList<Node*> children = current->get_children( );
         for( ObjectList<Node*>::iterator it = children.begin( ); it != children.end( ); ++it )
         {
             propagate_argument_rec( *it, v );
         }
     }
 }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: mergeObjectList

void Player::mergeObjectList(ObjectList &orig, const ObjectList &newobjs, SelectionFlags_t flags)
{
	if(flags == SelectionFlags::SET)
	{
		orig = newobjs;
	}
	else if(flags == SelectionFlags::ADD)
	{
		for(ObjectList::const_iterator it = newobjs.begin(); it != newobjs.end(); ++it)
		{
			ObjectList::const_iterator it2 = std::find(orig.begin(), orig.end(), *it);
			if(it2 == orig.end())
				orig.addObject(*it);
		}
	} /* else if(flags == SelectionFlags::ADD) */
	else if(flags == SelectionFlags::REMOVE)
	{
		for(ObjectList::const_iterator it = newobjs.begin(); it != newobjs.end(); ++it)
		{
			ObjectList::iterator it2 = std::find(orig.begin(), orig.end(), *it);
			if(it2 != orig.end())
				orig.erase(it2);
		}
	} /* else if(flags == SelectionFlags::REMOVE) */
}
开发者ID:pjm0616,项目名称:juchecraft,代码行数:25,代码来源:Player.cpp

示例3: IsEscortInvokerInRange

bool SmartAI::IsEscortInvokerInRange()
{
    ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
    if (targets)
    {
        if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
        {
            Player* player = (*targets->begin())->ToPlayer();
            if (me->GetDistance(player) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;

            if (Group* group = player->GetGroup())
            {
                for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
                {
                    Player* groupGuy = groupRef->getSource();

                    if (me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;
                }
            }
        }else
        {
            for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); iter++)
            {
                if (GetScript()->IsPlayer((*iter)))
                {
                    if (me->GetDistance((*iter)->ToPlayer()) <= SMART_ESCORT_MAX_PLAYER_DIST)
                        return true;
                }
            }
        }
    }
    return true;//escort targets were not set, ignore range check
}
开发者ID:Hacker0771,项目名称:al335,代码行数:35,代码来源:SmartAI.cpp

示例4: EndPath

void SmartAI::EndPath(bool fail)
{
    GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mLastWP->id, GetScript()->GetPathId());

    RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
    mWayPoints = NULL;
    mCurrentWPID = 0;
    mWPPauseTimer = 0;
    mLastWP = NULL;
    
    if (mCanRepeatPath)
        StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath);
    else
        GetScript()->SetPathId(0);


    ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
    if (targets && mEscortQuestID)
    {
        if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
        {
            Player* plr = (*targets->begin())->ToPlayer();
            if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                plr->GroupEventHappens(mEscortQuestID, me);

            if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                plr->FailQuest(mEscortQuestID);

            if (Group *pGroup = plr->GetGroup())
            {
                for (GroupReference *gr = pGroup->GetFirstMember(); gr != NULL; gr = gr->next())
                {
                    Player *pGroupGuy = gr->getSource();

                    if(!fail && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse())
                        pGroupGuy->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && pGroupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        pGroupGuy->FailQuest(mEscortQuestID);
                }
            }
        }else
        {
            for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); iter++)
            {
                if (GetScript()->IsPlayer((*iter)))
                {
                    Player* plr = (*iter)->ToPlayer();
                    if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                        plr->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        plr->FailQuest(mEscortQuestID);
                }
            }
        }
    }
    if (mDespawnState == 1)
        StartDespawn();
}
开发者ID:ice74,项目名称:blizzwow,代码行数:58,代码来源:SmartAI.cpp

示例5: filterCurSelectedObjects

void Player::filterCurSelectedObjects(ObjectList &selected_objs, int select_cnt_limit) const
{
	int stats[ObjectType::SIZE] = {0, };
	int my_unit_cnt = 0;
	for(ObjectList::const_iterator it = selected_objs.begin(); 
		it != selected_objs.end(); ++it)
	{
		const ObjectPtr &obj = *it;
		stats[obj->getObjectType()]++;
		if(obj->getOwner() == this)
			my_unit_cnt++;
	}

	for(ObjectList::iterator it = selected_objs.begin(); 
		it != selected_objs.end(); )
	{
		const ObjectPtr &obj = *it;
		
		// if there are at least one selected unit, deselect non-unit objects.
		if(stats[ObjectType::Unit] > 0)
		{
			if(obj->getObjectType() != ObjectType::Unit)
				selected_objs.erase(it++);
			else
				++it;
		}
		else if(my_unit_cnt != 0)
		{
			if(obj->getOwner() != this)
				selected_objs.erase(it++);
			else
				++it;
		}
		else
		{
			++it;
		}
	} /* for(ObjectList::iterator it = selected_objs.begin(); */
	
	if(select_cnt_limit > 0)
	{
		ObjectList::iterator end = selected_objs.end();
		ObjectList::iterator it = selected_objs.begin();
		
		// skip first nth object
		for(int i = 0; i < select_cnt_limit && it != end; i++)
			++it;
		
		// erase everything else
		while(it != end)
			selected_objs.erase(it++);
	}
}
开发者ID:pjm0616,项目名称:juchecraft,代码行数:53,代码来源:Player.cpp

示例6: getAllInstanceEquivalent

SFUtils::ObjectSet SFUtils::getAllInstanceEquivalent( Udm::Object object ) {

    Udm::Object archetype = getTopArchetype( object );
    if ( archetype == Udm::null ) return ObjectSet();

    ObjectList objectList;
    objectList.push_back( archetype );
    for( ObjectList::iterator oblItr = objectList.begin() ; oblItr != objectList.end() ; (void)++oblItr ) {
        ObjectSet objectSet = oblItr->instances();
        objectList.insert( objectList.end(), objectSet.begin(), objectSet.end() );
    }
    return ObjectSet( objectList.begin(), objectList.end() );
}
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:13,代码来源:utils.cpp

示例7: MultiSelByRefObject

void __fastcall TfraGroup::MultiSelByRefObject ( bool clear_prev )
{
    ObjectList 	objlist;
    LPU32Vec 	sellist;
    if (Scene->GetQueryObjects(objlist,OBJCLASS_GROUP,1,1,-1)){
    	for (ObjectIt it=objlist.begin(); it!=objlist.end(); it++){
	        LPCSTR N = ((CGroupObject*)*it)->RefName();
            ObjectIt _F = Scene->FirstObj(OBJCLASS_GROUP);
            ObjectIt _E = Scene->LastObj(OBJCLASS_GROUP);
            for(;_F!=_E;_F++){
	            CGroupObject *_O = (CGroupObject *)(*_F);
                if((*_F)->Visible()&&_O->RefCompare(N)){
                	if (clear_prev){
                    	_O->Select( false );
	                    sellist.push_back((u32*)_O);
                    }else{
                    	if (!_O->Selected())
                        	sellist.push_back((u32*)_O);
                    }
                }
            }
        }
        std::sort			(sellist.begin(),sellist.end());
        sellist.erase		(std::unique(sellist.begin(),sellist.end()),sellist.end());
        std::random_shuffle	(sellist.begin(),sellist.end());
        int max_k		= iFloor(float(sellist.size())/100.f*float(seSelPercent->Value)+0.5f);
        int k			= 0;
        for (LPU32It o_it=sellist.begin(); k<max_k; o_it++,k++){
            CGroupObject *_O = (CGroupObject *)(*o_it);
            _O->Select( true );
        }
    }
}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:FrameGroup.cpp

示例8: UngroupObjects

void ESceneGroupTool::UngroupObjects(bool bUndo)
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty())
    {
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
        {
            if ((*it)->Selected())
            {
            	sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); 
                VERIFY(obj);
                if (obj->CanUngroup(true))
                {
                    obj->UngroupObjects	();
                    Scene->RemoveObject	(obj,false,true);
                    xr_delete			(obj);
                    bModif				= true;
                }else
                    ELog.DlgMsg			(mtError,"Can't ungroup object: '%s'.",obj->Name);
            }
        }
        if (bUndo&&bModif) 
            Scene->UndoSave();
    }
    if (0==sel_cnt)
        ELog.Msg		(mtError,"Nothing selected.");
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:30,代码来源:ESceneGroupTools.cpp

示例9: fill_guard_tasks_basic

        void fill_guard_tasks_basic(Statement stmt) 
        {
			struct IsOmpTask : public Predicate<AST_t>
			{
				ScopeLink _sl;
				IsOmpTask(ScopeLink sl)
					:_sl(sl)
					{
					}

				bool do_(IsOmpTask::ArgType a) const
				{
					return is_pragma_custom_construct("omp", "task", a, _sl);
				}
			};

            ObjectList<AST_t> tasks = stmt.get_ast().depth_subtrees(IsOmpTask(stmt.get_scope_link()));

            for (ObjectList<AST_t>::iterator it = tasks.begin();
                    it != tasks.end();
                    it++)
            {
                PragmaCustomConstruct task_construct(*it, stmt.get_scope_link());

                GuardedTask guarded_task(task_construct);
                _guarded_task_list.append(guarded_task);
                _num_tasks++;
            }
        }
开发者ID:bsc-pm,项目名称:mcxx,代码行数:29,代码来源:hlt-task-aggregation-common.hpp

示例10: GroupObjects

void CGroupObject::GroupObjects(ObjectList& lst)
{
	R_ASSERT(lst.size());
	for (ObjectIt it=lst.begin(); it!=lst.end(); it++)
    	LL_AppendObject(*it,true);
    UpdatePivot(0,false);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:7,代码来源:GroupObject.cpp

示例11: isContainerEmpty

bool Tutorial::isContainerEmpty(uint64 containerId)
{
    bool empty = false;
    if (containerId == mContainerEventId)
    {
        Container* container = dynamic_cast<Container*>(gWorldManager->getObjectById(containerId));
        if (container)
        {
            uint32 objectCount = 0;
            ObjectList* objList = container->getObjects();
            ObjectList::iterator it = objList->begin();

            ObjectList::iterator cEnd = objList->end();

            while(it != cEnd)
            {
                if((*it)->getPrivateOwner() == this->getPlayer())
                    ++objectCount;

                ++it;
            }

            empty = (objectCount == 0);
        }
    }
    return empty;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例12: removeStructureItemsForPlayer

//=========================================================================================
//
// removes all structures items for a player
// call this when destroying a building
//
void SpatialIndexManager::removeStructureItemsForPlayer(PlayerObject* player, BuildingObject* building)
{
    DLOG(info) << "SpatialIndexManager::removeStructureItemsForPlayer:: : " << player->getId();

    ObjectList cellObjects		= building->getAllCellChilds();
    ObjectList::iterator objIt	= cellObjects.begin();

    while(objIt != cellObjects.end())	{
        Object* object = (*objIt);

        if(PlayerObject* otherPlayer = dynamic_cast<PlayerObject*>(object))	{
            //do nothing players and creatures are always in the grid
        }
        else if(CreatureObject* pet = dynamic_cast<CreatureObject*>(object))	{
            //do nothing players and creatures are always in the grid
        }
        else	{
            if((object) && (object->checkRegisteredWatchers(player)))	{
                gContainerManager->unRegisterPlayerFromContainer(object,player);
				gMessageLib->sendDestroyObject(object->getId(), player);
            }
        }
        objIt++;
    }


}
开发者ID:schizix,项目名称:mmoserver,代码行数:32,代码来源:SpatialIndexManager.cpp

示例13: sendEquippedItems

//======================================================================================================================
//
// send creates of the equipped items from player to player
// iterates all inventory items of the source and sends creates to the target
//
bool MessageLib::sendEquippedItems(PlayerObject* srcObject,PlayerObject* targetObject)
{
    if(!_checkPlayer(targetObject))
        return(false);

    ObjectList*				invObjects		= srcObject->getEquipManager()->getEquippedObjects();
    ObjectList::iterator	invObjectsIt	= invObjects->begin();

    while(invObjectsIt != invObjects->end())
    {
        // items
        if(Item* item = dynamic_cast<Item*>(*invObjectsIt))
        {
            if(item->getParentId() == srcObject->getId())
            {
                gMessageLib->sendCreateTangible(item,targetObject);
            }
            else
            {
                gLogger->log(LogManager::DEBUG,"MessageLib send equipped objects: Its not equipped ... %I64u",item->getId());
            }
        }

        ++invObjectsIt;
    }

    return(true);
}
开发者ID:jason83,项目名称:mmoserver,代码行数:33,代码来源:MessageLib.cpp

示例14: get_inout_decl

static void get_inout_decl(ObjectList<OutlineDataItem*>& data_items, std::string &in_type, std::string &out_type)
{
    in_type = "";
    out_type = "";
    for (ObjectList<OutlineDataItem*>::iterator it = data_items.begin();
            it != data_items.end();
            it++)
    {
        const ObjectList<OutlineDataItem::CopyItem> &copies = (*it)->get_copies();
        if (!copies.empty())
        {
            Scope scope = (*it)->get_symbol().get_scope();
            if (copies.front().directionality == OutlineDataItem::COPY_IN
                    && in_type == "")
            {
                in_type = (*it)->get_field_type().get_simple_declaration(scope, "");
            }
            else if  (copies.front().directionality == OutlineDataItem::COPY_OUT
                    && out_type == "")
            {
                out_type = (*it)->get_field_type().get_simple_declaration(scope, "");
            } else if (copies.front().directionality == OutlineDataItem::COPY_INOUT)
            {
                //If we find an inout, set both input and output types and return
                out_type = (*it)->get_field_type().get_simple_declaration(scope, "");
                in_type = out_type;
                return;
            }
        }
    }
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例15: initObjectsInRange

void SpatialIndexManager::initObjectsInRange(PlayerObject* player) {
    uint64_t player_id = player->getParentId();
    if (player_id == 0) {
        return;
    }

    Object* tmp = gWorldManager->getObjectById(player_id);
    if (tmp->getType() != ObjType_Cell) {
        return;
    }

    CellObject* cell = static_cast<CellObject*>(tmp);

    tmp = gWorldManager->getObjectById(cell->getParentId());
    if (tmp->getType() != ObjType_Building) {
        return;
    }

    BuildingObject* building = static_cast<BuildingObject*>(tmp);

    ObjectList children = building->getAllCellChilds();

    std::for_each(children.begin(), children.end(), [this, player] (Object* cell_child) {
        if (cell_child->getType() != ObjType_Tangible) {
            return;
        }

        sendCreateObject(cell_child, player, true);
    });
}
开发者ID:schizix,项目名称:mmoserver,代码行数:30,代码来源:SpatialIndexManager.cpp


注:本文中的ObjectList::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。