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


C++ SimObject::deleteObject方法代码示例

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


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

示例1: clear

void SimGroup::clear()
{
   lock();
   while( size() > 0 )
   {
      SimObject* object = objectList.last();
      object->onGroupRemove();
      
      objectList.pop_back();
      mNameDictionary.remove( object );
      object->mGroup = 0;

      getSetModificationSignal().trigger( SetObjectRemoved, this, object );
      if( object->isProperlyAdded() )
         onObjectRemoved_callback( object );

      if( engineAPI::gUseConsoleInterop )
         object->deleteObject();
      else
         object->decRefCount();      
   }
   unlock();

   getSetModificationSignal().trigger( SetCleared, this, NULL );
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:25,代码来源:simSet.cpp

示例2: run

 void run()
 {
    for( AbstractClassRep* classRep = AbstractClassRep::getClassList();
         classRep != NULL;
         classRep = classRep->getNextClass() )
    {
       // Create object.
       
       ConsoleObject* object = classRep->create();
       test( object, avar( "AbstractClassRep::create failed for class '%s'", classRep->getClassName() ) );
       if( !object )
          continue;
       
       // Make sure it's a SimObject.
       
       SimObject* simObject = dynamic_cast< SimObject* >( object );
       if( !simObject )
       {
          SAFE_DELETE( object );
          continue;
       }
       
       // Register the object.
       
       bool result = simObject->registerObject();
       test( result, avar( "registerObject failed for object of class '%s'", classRep->getClassName() ) );
       
       if( result )
          simObject->deleteObject();
       else
          SAFE_DELETE( simObject );
    }
 }
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:33,代码来源:testDefaultConstruction.cpp

示例3: unpack

void SimDataBlockEvent::unpack(NetConnection *cptr, BitStream *bstream)
{
   if(bstream->readFlag())
   {
      mProcess = true;
      id = bstream->readInt(DataBlockObjectIdBitSize) + DataBlockObjectIdFirst;
      S32 classId = bstream->readClassId(NetClassTypeDataBlock, cptr->getNetClassGroup());
      mIndex = bstream->readInt(DataBlockObjectIdBitSize);
      mTotal = bstream->readInt(DataBlockObjectIdBitSize + 1);
      
      SimObject* ptr;
      if( Sim::findObject( id, ptr ) )
      {
         // An object with the given ID already exists.  Make sure it has the right class.
         
         AbstractClassRep* classRep = AbstractClassRep::findClassRep( cptr->getNetClassGroup(), NetClassTypeDataBlock, classId );
         if( classRep && dStrcmp( classRep->getClassName(), ptr->getClassName() ) != 0 )
         {
            Con::warnf( "A '%s' datablock with id: %d already existed. "
                        "Clobbering it with new '%s' datablock from server.",
                        ptr->getClassName(), id, classRep->getClassName() );
            ptr->deleteObject();
            ptr = NULL;
         }
      }
      
      if( !ptr )
         ptr = ( SimObject* ) ConsoleObject::create( cptr->getNetClassGroup(), NetClassTypeDataBlock, classId );
         
      mObj = dynamic_cast< SimDataBlock* >( ptr );
      if( mObj != NULL )
      {
         #ifdef DEBUG_SPEW
         Con::printf(" - SimDataBlockEvent: unpacking event of type: %s", mObj->getClassName());
         #endif
         
         mObj->unpackData( bstream );
      }
      else
      {
         #ifdef DEBUG_SPEW
         Con::printf(" - SimDataBlockEvent: INVALID PACKET!  Could not create class with classID: %d", classId);
         #endif
         
         delete ptr;
         cptr->setLastError("Invalid packet in SimDataBlockEvent::unpack()");
      }

#ifdef TORQUE_DEBUG_NET
      U32 checksum = bstream->readInt(32);
      AssertISV( (checksum ^ DebugChecksum) == (U32)classId,
         avar("unpack did not match pack for event of class %s.",
            mObj->getClassName()) );
#endif

   }
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:57,代码来源:gameConnectionEvents.cpp

示例4: deleteAllObjects

//UNSAFE
void SimSet::deleteAllObjects()
{
   lock();
   while( !empty() )
   {
      SimObject* object = objectList.last();
      objectList.pop_back();

      object->deleteObject();
   }
   unlock();
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:13,代码来源:simSet.cpp

示例5: despawnTargets

//-----------------------------------------------------------------------------
// 
// VSpawnSphereSpawnTargetTrack::despawnTargets();
// 
// Despawn all of the objects spawned by this track.
// 
//-----------------------------------------------------------------------------
void VSpawnSphereSpawnTargetTrack::despawnTargets( void )
{
    while( mSpawnList.size() > 0 )
    {
        // Fetch the Last Object
        SimObject *object = mSpawnList.last();
        // Remove it.
        mSpawnList.popObject();

        // Delete the Object.
        object->deleteObject();
    }
}
开发者ID:7Sins,项目名称:Verve,代码行数:20,代码来源:VSpawnSphereSpawnTargetTrack.cpp

示例6: clone

SimGroup* SimGroup::clone()
{
   // Skip SimSet::clone since we do not want to steal the child objects
   // from this group.
   
   SimObject* object = SimObject::clone();
   SimGroup* group = dynamic_cast< SimGroup* >( object );
   if( !group )
   {
      object->deleteObject();
      return NULL;
   }
   
   return group;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:15,代码来源:simSet.cpp

示例7: deepClone

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

示例8: onCommand

void SimTreeView::onCommand( int id, HWND hwndCtl, UINT codeNotify )
{
   hwndCtl, codeNotify;
   SimObject   *obj;
   SimSet    *prnt;
	lockManager();

   switch( id )
   {
      case IDM_EXIT:
         destroyWindow();
         break;

      case IDM_CUT:
         if ( (obj = getSelectedObject()) !=  NULL )
         {
            // persist selected object
            obj->fileStore( "temp\\clip.tmp" );

            // remove it from parent
            obj->deleteObject();
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_COPY:
         if ( (obj = getSelectedObject()) !=  NULL )
            obj->fileStore( "temp\\clip.tmp" );
         break;

      case IDM_PASTE:
         {
            // unpersist object to get a duplicate
            Persistent::Base::Error err;
            obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
            if ( err != Ok )
               return;

            // add to simTree
            HTREEITEM hParent = getSelection();
            if ( !isItemFolder(hParent) )
               hParent = getParent( hParent );

            prnt = (SimSet*)getObject( hParent );
            prnt->getManager()->addObject( obj );
				prnt->addObject(obj);
            HTREEITEM hItem = addSet( obj, hParent );
            selectItem( hItem );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_DELETE:
         obj = getSelectedObject();
         if ( obj )
         {
            obj->deleteObject();
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_REMOVE:
         obj = getSelectedObject();
         if ( obj )
         {
            prnt = getSelectedParent();
				prnt->removeObject(obj);
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_DUPLICATE:
         {
            obj = getSelectedObject();
            
            // persist object to get a duplicate
            if ( obj->fileStore( "temp\\clip.tmp" ) != Ok )
            {
					unlockManager();
               return;
            }

            Persistent::Base::Error err;
            obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
            if ( err != Ok )
            {
					unlockManager();
               return;
            }
            // perhaps delete clip.tmp to clean up directory

            HTREEITEM hParent = getSelection();
            if ( !isItemFolder(hParent) )
               hParent = getParent( hParent );

            prnt = (SimSet*)getObject( hParent );
            prnt->getManager()->addObject( obj );
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:simTreeView.cpp

示例9: return

const char * FearMissionPlugin::consoleCallback( CMDConsole *, int id, int argc, const char * argv[] )
{
   SimManager * clientManager = SimGame::get()->getManager( SimGame::CLIENT );
   SimManager * serverManager = SimGame::get()->getManager( SimGame::SERVER );
   
   FearMissionEditor * me = NULL;
   
   // get the missioneditor
   if( SimObject * obj = clientManager->findObject( "MissionEditor" ) )
      me = dynamic_cast<FearMissionEditor *>( obj );
   
   // check for the editor object
   if(id != Create)
   {
      if(!me)
      {
         console->printf( "%s: Must call ME::Create first", argv[0] );
         return(ME_Failure);
      }
   }
   
   // look at the command
   switch( id )
   {
      case Create:
      {
         if( argc > 1 )
         {
            // check for the missioneditor
            if(me)
               me->deleteObject();
            
            // grab the canvas
            SimGui::Canvas * sc = dynamic_cast< SimGui::Canvas * >( manager->findObject( argv[1] ) );
            if(!sc)
            {
               console->printf( "%s: can't find parent canvas [%s]", argv[0], argv[1] );
               break;
            }
         
            me = new FearMissionEditor();
            clientManager->addObject(me, "MissionEditor");
            clientManager->assignId(me, SimMissionEditorId);
            
            // set the manager and canvas for the missioneditor
            me->setManager(serverManager);
            me->setCanvas(sc);

            // need to get rid of the missioneditor on deletion of server, so
            // add it to an object that is always in the server...
            SimObject * notifyObj = serverManager->findObject("ConsoleScheduler");
            if(notifyObj)
               me->deleteNotify(notifyObj);
            
            // init the missionEditor
            if(!me->init())
               console->printf( "%s: failed to initialize MissionEditor", argv[0] );
               
            return(ME_Success);
         }
         else
            console->printf( "%s: simCanvasName", argv[0] );
            
         break;
      }
      
      case RegisterType:
      {
         if( argc >= 3 )
         {
            // check for bitmap names
            if( !me->addTypeInfo( argv[1], atoi(argv[2]),
               ( argc > 3 ) ? argv[3] : NULL,
               ( argc > 4 ) ? argv[4] : NULL ) )
               console->printf( "%s: failed to add type [%s]", argv[0], argv[1] );
            else
               return(ME_Success);
         }
         else
            console->printf( "%s: ClassDescription, BitPos, <BmpSelected>, <BmpUnselected>", argv[0] );

         break;
      }
      
      case SetGrabMask:
      {
         if( argc == 2 )
         {
            me->setGrabMask( atoi( argv[1] ) );   
            return(ME_Success);
         }
         else
            console->printf( "%s: grab mask", argv[0] );
            
         break;
      }
      
      case SetPlaceMask:
      {
         if( argc >= 2 )
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:FearMissionPlugin.cpp


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