本文整理汇总了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 );
}
}
}
示例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) */
}
示例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
}
示例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();
}
示例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++);
}
}
示例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() );
}
示例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 );
}
}
}
示例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.");
}
示例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++;
}
}
示例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);
}
示例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;
}
示例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++;
}
}
示例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);
}
示例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;
}
}
}
}
示例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);
});
}