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


C++ SimSet类代码示例

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


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

示例1: 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

示例2: getName

bool Material::onAdd()
{
   if (Parent::onAdd() == false)
      return false;

   mCubemapData = dynamic_cast<CubemapData*>(Sim::findObject( mCubemapName ) );

   if( mTranslucentBlendOp >= NumBlendTypes || mTranslucentBlendOp < 0 )
   {
      Con::errorf( "Invalid blend op in material: %s", getName() );
      mTranslucentBlendOp = LerpAlpha;
   }

   SimSet *matSet = MATMGR->getMaterialSet();
   if( matSet )
      matSet->addObject( (SimObject*)this );

   // save the current script path for texture lookup later
   const String  scriptFile = Con::getVariable("$Con::File");  // current script file - local materials.cs

   String::SizeType  slash = scriptFile.find( '/', scriptFile.length(), String::Right );
   if ( slash != String::NPos )
      mPath = scriptFile.substr( 0, slash + 1 );

   _mapMaterial();

   return true;
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:28,代码来源:materialDefinition.cpp

示例3: if

SimObject* SimSet::findObjectByLineNumber(const char* fileName, S32 declarationLine, bool searchChildren)
{
   if (!fileName)
      return NULL;

   if (declarationLine < 0)
      return NULL;

   StringTableEntry fileEntry = StringTable->insert(fileName);

   for (iterator i = begin(); i != end(); i++)
   {
      SimObject *childObj = static_cast<SimObject*>(*i);

      if(childObj->getFilename() == fileEntry && childObj->getDeclarationLine() == declarationLine)
         return childObj;
      else if (searchChildren)
      {
         SimSet* childSet = dynamic_cast<SimSet*>(*i);

         if (childSet)
         {
            SimObject* found = childSet->findObjectByLineNumber(fileName, declarationLine, searchChildren);
            if (found)
               return found;
         }
      }
   }

   return NULL;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:31,代码来源:simSet.cpp

示例4: lockManager

bool SimTreeView::handleItemRemoveFromFolder( HTREEITEM hFolder, HTREEITEM hItem )
{
	lockManager();
   SimSet *parent = (SimSet*)getObject( hFolder );
   SimObject *obj = getObject(hItem);
   parent->removeObject( obj );
   state.set(STV_MODIFIED);
	unlockManager();
   return ( true );  // true indicates we want item removed from TreeList
}   
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:10,代码来源:simTreeView.cpp

示例5: 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

示例6: sizeRecursive

U32 SimSet::sizeRecursive()
{
   U32 count = 0;

   for ( iterator i = begin(); i != end(); i++ )
   {
      count++;

      SimSet* childSet = dynamic_cast<SimSet*>(*i);
      if ( childSet )
         count += childSet->sizeRecursive();
   }

   return count;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:15,代码来源:simSet.cpp

示例7: return

// 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

示例8: findOrCreate

TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
{
   SimSet *set = Sim::getTerrainMaterialSet();
   
   if ( !nameOrPath || !nameOrPath[0] )
      nameOrPath = "warning_material";

   // See if we can just find it.
   TerrainMaterial *mat = dynamic_cast<TerrainMaterial*>( set->findObjectByInternalName( StringTable->insert( nameOrPath ) ) );
   if ( mat )
      return mat;

   // We didn't find it... so see if its a path to a
   // file.  If it is lets assume its the texture.
   if ( GBitmap::sFindFiles( nameOrPath, NULL ) )
   {
      mat = new TerrainMaterial();
      mat->setInternalName( nameOrPath );
      mat->mDiffuseMap = nameOrPath;
      mat->registerObject();
      Sim::getRootGroup()->addObject( mat );
      return mat;
   }

   // Ok... return a debug material then.
   mat = dynamic_cast<TerrainMaterial*>( set->findObjectByInternalName( StringTable->insert( "warning_material" ) ) );
   if ( !mat )
   {
      // This shouldn't happen.... the warning_texture should
      // have already been defined in script, but we put this
      // fallback here just in case it gets "lost".
      mat = new TerrainMaterial();
      mat->setInternalName( "warning_material" );
      mat->mDiffuseMap = GFXTextureManager::getWarningTexturePath();
      mat->mDiffuseSize = 500;
      mat->mDetailMap = GFXTextureManager::getWarningTexturePath();
      mat->mDetailSize = 5;
	  mat->mMacroMap = GFXTextureManager::getWarningTexturePath();
	  mat->mMacroSize = 200;
      mat->registerObject();
      
      Sim::getRootGroup()->addObject( mat );
   }

   return mat;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:46,代码来源:terrMaterial.cpp

示例9:

SimObject* SimSetIterator::operator++()
{
	SimSet* set;
	if ((set = dynamic_cast<SimSet*>(*stack.last().itr)) != 0) {
		if (!set->empty()) {
		   stack.push_back(set);
			return *stack.last().itr;
		}
	}

	while (++stack.last().itr == stack.last().set->end()) {
		stack.pop_back();
		if (stack.empty())
			return 0;
	}
	return *stack.last().itr;
}	
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:17,代码来源:simSetIterator.cpp

示例10: addToSet

bool tripod::onAdd()
{
	if (!ObjParent::onAdd())
		return false;

	// Post by sending an event
   addToSet(SimTimerSetId);
   SimSet *grp;

   grp = (SimSet*)manager->findObject( SimCameraSetId );
  
   if ( grp )
      grp->addObject( this );

   setEventMap();      
      
    return true;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:18,代码来源:Tripod.cpp

示例11: clone

SimSet* SimSet::clone()
{
   // Clone the set object.
   
   SimObject* object = Parent::clone();
   SimSet* set = dynamic_cast< SimSet* >( object );
   if( !set )
   {
      object->deleteObject();
      return NULL;
   }
   
   // Add all object in the set.
   
   for( iterator iter = begin(); iter != end(); ++ iter )
      set->addObject( *iter );
   
   return set;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:19,代码来源:simSet.cpp

示例12: onAdd

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

   SimSet *set = Sim::getTerrainMaterialSet();

   // Make sure we have an internal name set.
   if ( !mInternalName || !mInternalName[0] )
      Con::warnf( "TerrainMaterial::onAdd() - No internal name set!" );
   else
   {
      SimObject *object = set->findObjectByInternalName( mInternalName );
      if ( object )
         Con::warnf( "TerrainMaterial::onAdd() - Internal name collision; '%s' already exists!", mInternalName );
   }

   set->addObject( this );

   return true;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:21,代码来源:terrMaterial.cpp

示例13: 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

示例14: 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

示例15: 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


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