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


C++ SimSet::end方法代码示例

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


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

示例1: atoi

Control *findControl(const char *name)
{
   SimManager *manager = SimGame::get()->getManager(SimGame::CLIENT);
   int tag = atoi(name);
   if(tag)
   {
      SimSet *s = (SimSet *) manager->findObject(TaggedGuiSetId);
      SimSet::iterator i;
      for(i = s->begin(); i != s->end(); i++)
      {
         Control *c = dynamic_cast<Control *>(*i);
         if(c && c->getTag() == DWORD(tag))
            return c;
      }
      return NULL;   
   }
   else
   {
      StringTableEntry n = stringTable.insert(name);
      SimSet *s = (SimSet *) manager->findObject(NamedGuiSetId);
      SimSet::iterator i;
      for(i = s->begin(); i != s->end(); i++)
      {
         Control *c = dynamic_cast<Control *>(*i);
         if(c && c->getName() == n)
            return c;
      }
      return NULL;   
   }
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:30,代码来源:simGuiPlugin.cpp

示例2: createOnClients

void SimFire::createOnClients(SimFire * fire, SimManager * mgr)
{
   SimSet * packetStreams = static_cast<SimSet*>(mgr->findObject(PacketStreamSetId));
   if (packetStreams)
   {
      for (SimSet::iterator itr = packetStreams->begin(); itr != packetStreams->end(); itr++)
      {
         Net::PacketStream * pStream = dynamic_cast<Net::PacketStream *>(*itr);
         if (pStream && pStream->getGhostManager()->getCurrentMode() ==
                        Net::GhostManager::GhostNormalMode)
         {
            Net::RemoteCreateEvent * addEvent = new Net::RemoteCreateEvent;
            SimFire *fireCopy = new SimFire(*fire);
            addEvent->newRemoteObject = fireCopy;
            // if attached to an object, see if it is in scope...
            if (fire->onObj)
            {
               int gidx = pStream->getGhostManager()->getGhostIndex(static_cast<SimNetObject*>(fire->onObj));
               if (gidx==-1)
                  continue; // object must be out of scope
            }
            pStream->getEventManager()->postRemoteEvent(addEvent);
         }
      }
   }
   if (!fire->manager)
      // this was a temporary object
      delete fire;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:29,代码来源:simFire.cpp

示例3: handleItemDroppedOnItem

bool SimTreeView::handleItemDroppedOnItem( HTREEITEM hTarget, HTREEITEM hDropItem )
{
   bool removeFromSource=false;
	lockManager();

   HTREEITEM hParent = getParent( hTarget );
   SimSet *pTarget = (SimSet*)getObject( hParent );
   SimObject *obj = getObject(hDragItem);
   SimObject *pParent = getObject( getParent(hDropItem) );

   if ( pTarget != obj )
   {
      state.set(STV_MODIFIED);
      if ( pTarget->find(pTarget->begin(), pTarget->end(), obj) != pTarget->end() )
      {
         if ( pTarget->reOrder( obj, getObject(hTarget) ) )
            refresh( hParent );
      }
      else
      {
         if ( !dynamic_cast<SimGroup*>(pTarget) )
         {
            if ( dynamic_cast<SimGroup*>(pParent) )
               removeFromSource = false;    // Group->Set, copy
            else if ( (GetKeyState( VK_SHIFT ) & 0x80000000) == 0 )
               removeFromSource = true;     // Set->Set, but pressing shift key, copy
            else
               removeFromSource = true;     // Set->Set, copying set by menu
         }
         else if ( !dynamic_cast<SimGroup*>(pParent) )
         {
         	unlockManager();
            return false;                    // set->Group is not allowed
         }
         else
         {
            state.clear(GWTV_COPYING);       // Group->Group, moving
            removeFromSource =  true;
         }
      	pTarget->addObject(obj);
         pTarget->reOrder( obj, getObject(hTarget) );
         WinParent::handleItemDroppedOnItem( hTarget, hDropItem );
      }
   }
	unlockManager();
   return removeFromSource;  // don't modify list after return
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:47,代码来源:simTreeView.cpp

示例4: getActiveTerrain

TerrainBlock* EditTSCtrl::getActiveTerrain()
{
   // Find a terrain block
   SimSet* scopeAlwaysSet = Sim::getGhostAlwaysSet();
   for(SimSet::iterator itr = scopeAlwaysSet->begin(); itr != scopeAlwaysSet->end(); itr++)
   {
      TerrainBlock* block = dynamic_cast<TerrainBlock*>(*itr);
      if( block )
         return block;
   }

   return NULL;
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:13,代码来源:editTSCtrl.cpp

示例5: lockObject

// lock/unlock object(s)
bool SimTreeView::lockObject( SimObject * obj, bool lock )
{
   if( !obj )
      return( false );
      
   SimSet   *ss;
   
   // recurse into children
   if( ( ss = dynamic_cast<SimSet*>( obj ) ) != NULL )
      for( SimSet::iterator itr = ss->begin(); itr != ss->end(); itr++ )
         lockObject( (*itr), lock );
   else
      obj->setLocked( lock );
   
   return( true );   
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:17,代码来源:simTreeView.cpp

示例6: handleItemExpansion

void SimTreeView::handleItemExpansion( HTREEITEM /*hParent*/, HTREEITEM hItem )
{
   SimSet *set;
	lockManager();
   TV_ITEM *tvi = treeList.getItemInfo( hItem );
   SimObject *obj = getObject( hItem );
   if ( (set = dynamic_cast<SimSet*>(obj)) != 0 )
   {
      TreeView_Expand( treeList.getHandle(), hItem, TVE_COLLAPSE|TVE_COLLAPSERESET );
      tvi->mask = TVIF_IMAGE;
      tvi->iImage = handleGetBitmapIndex( hItem, true );
      TreeView_SetItem( treeList.getHandle(), tvi );
      for ( SimObjectList::iterator iter=set->begin(); iter!=set->end(); iter++ )
         addSet( *iter, hItem );
   }
	unlockManager();
}   
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:17,代码来源:simTreeView.cpp

示例7: createOnClients

void SimExplosionCloud::createOnClients(SimExplosionCloud * cloud, SimManager * mgr)
{
   SimSet * packetStreams = static_cast<SimSet*>(mgr->findObject(PacketStreamSetId));
   if (packetStreams)
   {
      for (SimSet::iterator itr = packetStreams->begin(); itr != packetStreams->end(); itr++)
      {
         Net::PacketStream * pStream = dynamic_cast<Net::PacketStream *>(*itr);
         if (pStream && pStream->getGhostManager()->getCurrentMode() ==
                        Net::GhostManager::GhostNormalMode)
         {
            Net::RemoteCreateEvent * addEvent = new Net::RemoteCreateEvent;
            SimExplosionCloud *cloudCopy = new SimExplosionCloud(*cloud);
            addEvent->newRemoteObject = cloudCopy;
            pStream->getEventManager()->postRemoteEvent(addEvent);
         }
      }
   }
   if (!cloud->manager)
      // this was a temporary object
      delete cloud;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:22,代码来源:simExplosionCloud.cpp

示例8: onAdd

bool GhostManager::onAdd()
{
   if(!Parent::onAdd())
      return false;

	if (!getId())
		manager->assignId(this);

   // iterate through the ghost always objects and InScope them...
   SimSet *ghostAlwaysSet = (SimSet *) manager->findObject(SimGhostAlwaysSetId);

   SimSet::iterator i;
   for(i = ghostAlwaysSet->begin(); i != ghostAlwaysSet->end(); i++)
   {
      AssertFatal(dynamic_cast<SimNetObject *>(*i) != NULL, "Non SimNetObject in GhostAlwaysSet");
      SimNetObject *obj = (SimNetObject *)(*i);
      if(obj->netFlags.test(SimNetObject::Ghostable))
         objectInScope(obj);
   }
   // add to the ghostManager set
   addToSet(GhostManagerSetId);
   return true;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:23,代码来源:netGhostManager.cpp

示例9: shoot

void Turret::shoot (bool playerControlled, Player* targetPlayer)
{
   if (data && data->isSustained == false) {
	   if (data && data->projectile.type == -1)
	   	{
	   		if (!isGhost())
	   			if (const char* script = scriptName("onFire"))
	   				Console->executef(2, script, scriptThis());
	   	}
	   else
	   	{
	   		float energy = getEnergy();
	   		if (waitTime <= manager->getCurrentTime() && data && energy >= data->minGunEnergy && data->projectile.type != -1)
	   			{
                  TMat3F muzzleTransform;
	   				getMuzzleTransform(0, &muzzleTransform);
	   				Projectile* bullet = createProjectile(data->projectile);

	   				if (!playerControlled && data->deflection)
	   					{
	   						static Random random;
	   						EulerF angles;
	   					   muzzleTransform.angles (&angles);
	   						angles.x += (random.getFloat() - 0.5) * M_2PI * data->deflection;
	   						angles.z += (random.getFloat() - 0.5) * M_2PI * data->deflection;
	   						muzzleTransform.set (angles, muzzleTransform.p);
	   					}
	   				else
	   					if (playerControlled)
	   						{
	   							Point3F start = muzzleTransform.p;
	   							muzzleTransform = getEyeTransform ();
	   							aimedTransform (&muzzleTransform, start);
	   							muzzleTransform.p = start;
	   						}

	   				bullet->initProjectile (muzzleTransform, Point3F (0, 0, 0), getId());

	   	         if (bullet->isTargetable() == true) {
	   	            if (targetPlayer != NULL) {
	   						if (GameBase* mo = targetPlayer->getMountObject())
	   		               bullet->setTarget(static_cast<ShapeBase*>(mo));
	   						else
	   		               bullet->setTarget(targetPlayer);
                     } else if (playerControlled) {
                        ShapeBase* pClosest   = NULL;
                        Point3F    closeHisPos;
                        float      closestVal = -2.0f;
                        SimSet::iterator itr;
                     
                        Point3F lookDir;
                        getEyeTransform().getRow(1, &lookDir);
                        lookDir.normalize();

                        SimContainerQuery collisionQuery;
                        SimCollisionInfo  info;
                        collisionQuery.id     = getId();
                        collisionQuery.type   = -1;
                        collisionQuery.mask   = Projectile::csm_collisionMask;
                        collisionQuery.detail = SimContainerQuery::DefaultDetail;
                        collisionQuery.box.fMin = getEyeTransform().p;
                        SimContainer* pRoot = (SimContainer*)manager->findObject(SimRootContainerId);

                        SimSet* pSet = dynamic_cast<SimSet*>(manager->findObject(PlayerSetId));
                        AssertFatal(pSet != NULL, "No player set?");
                        for (itr = pSet->begin(); itr != pSet->end(); itr++) {
                           Player* pPlayer = dynamic_cast<Player*>(*itr);

                           if (!pPlayer || pPlayer->getVisibleToTeam(getTeam()) == false)
                              continue;

                           collisionQuery.box.fMax = pPlayer->getBoxCenter();
                           if (pRoot->findLOS(collisionQuery, &info, SimCollisionImageQuery::High) == true) {
                              if (info.object != (SimObject*)pPlayer)
                                 continue;
                           }

                           Point3F hisPos = pPlayer->getBoxCenter();
                           hisPos -= getLinearPosition();
                           hisPos.normalize();

                           float prod = m_dot(hisPos, lookDir);
                           if (prod > 0.0f && prod > closestVal) {
                              closestVal = prod;
                              pClosest   = pPlayer;
                              closeHisPos = hisPos;
                           }
                        }

                        pSet = dynamic_cast<SimSet*>(manager->findObject(MoveableSetId));
                        AssertFatal(pSet != NULL, "No moveable set?");
                        for (itr = pSet->begin(); itr != pSet->end(); itr++) {
                           if (((*itr)->getType() & VehicleObjectType) == 0)
                              continue;

                           ShapeBase* pObject = dynamic_cast<ShapeBase*>(*itr);
                           
                           if (pObject->getVisibleToTeam(getTeam()) == false)
                              continue;

//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:turret.cpp


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