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


C++ ObjectManager::Destroy方法代码示例

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


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

示例1: PlayGameServer


//.........这里部分代码省略.........
  gCollectionsManager.Init( 0, 1 );

  r3dOutToLog( "NavMesh.Load...\n" );
  gAutodeskNavMesh.Init();

  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dOutToLog("Spawning Vehicles... Count:%d\n",GameWorld().spawncar);
  gServerLogic.SpawnNewCar();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS
    
    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
    gMasterServerLogic.Tick();
    
    if(gMasterServerLogic.IsMasterDisconnected()) {
      r3dOutToLog("Master Server disconnected, exiting\n");
      gKeepAliveReporter.SetStarted(false);
      return;
    }

    GameWorld().StartFrame();
    GameWorld().Update();
    // fire few ticks of temporary world update, just for safety (physics init and stuff)
    static int TempWorldUpdateN = 0;
    if(TempWorldUpdateN < 20) {
      TempWorldUpdateN++;
      ServerDummyWorld.Update();
    }

    // start physics after game world update right now, as gameworld will move some objects around if necessary
    g_pPhysicsWorld->StartSimulation();
    g_pPhysicsWorld->EndSimulation();

#if ENABLE_AUTODESK_NAVIGATION
    const float t1 = r3dGetTime();
    gAutodeskNavMesh.Update();
    const float t2 = r3dGetTime() - t1;

    bool showSpd = (GetAsyncKeyState('Q') & 0x8000) && (GetAsyncKeyState('E') & 0x8000);
    bool showKys = false; //(GetAsyncKeyState('Q') & 0x8000) && (GetAsyncKeyState('R') & 0x8000);

    extern int _zstat_NumZombies;
    extern int _zstat_NavFails;
    extern int _zstat_Disabled;
    if(showKys) {
      gAutodeskNavMesh.perfBridge.Dump();
      r3dOutToLog("NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
    }
    if(showSpd) {
      r3dOutToLog("NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
    }
#ifndef _DEBUG    
    if((t2 > (1.0f / 60.0f))) {
      r3dOutToLog("!!!! NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
      //gAutodeskNavMesh.perfBridge.Dump();
      //r3dOutToLog("!!!! NavMeshUpdate %f sec, z:%d, bad:%d, f:%d, navPend:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails, _zstat_UnderProcess);
    }
#endif
#endif // ENABLE_AUTODESK_NAVIGATION

    GameWorld().EndFrame();
    
    if(gServerLogic.gameFinished_)
      break;
  }

  // set that we're finished
  gKeepAliveReporter.SetStarted(false);

  gMasterServerLogic.FinishGame();
  
  gServerLogic.DumpPacketStatistics();
  
  gCollectionsManager.Destroy();

  GameWorld_Destroy();
  ServerDummyWorld.Destroy();
  
  return;
}
开发者ID:Mateuus,项目名称:devsrc,代码行数:101,代码来源:ServerGame.cpp

示例2: PlayGameServer


//.........这里部分代码省略.........
  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
 // _beginthreadex ( NULL, 0, NetworkThread, NULL, 0, NULL );
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS

	char text[64] ={0};
	sprintf(text,"WarZ Game Server [Running..] id:%d curPeer:%d players:%d/%d",gServerLogic.ginfo_.gameServerId,gServerLogic.curPeersConnected,gServerLogic.curPlayers_,gServerLogic.ginfo_.maxPlayers);
	SetConsoleTitle(text);

	gServerLogic.net_->Update();

    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
	gServerLogic.UpdateNetId();
    gMasterServerLogic.Tick();
    
    if(gMasterServerLogic.IsMasterDisconnected()) {
      r3dOutToLog("Master Server disconnected, exiting\n");
      gKeepAliveReporter.SetStarted(false);
      return;
    }

    GameWorld().StartFrame();
    GameWorld().Update();
    // fire few ticks of temporary world update, just for safety (physics init and stuff)
    static int TempWorldUpdateN = 0;
    if(TempWorldUpdateN < 20) {
      TempWorldUpdateN++;
      ServerDummyWorld.Update();
    }

    // start physics after game world update right now, as gameworld will move some objects around if necessary
    g_pPhysicsWorld->StartSimulation();
    g_pPhysicsWorld->EndSimulation();

#if ENABLE_AUTODESK_NAVIGATION
    const float t1 = r3dGetTime();
    gAutodeskNavMesh.Update();
    const float t2 = r3dGetTime() - t1;

    bool showSpd = (GetAsyncKeyState('Q') & 0x8000) && (GetAsyncKeyState('E') & 0x8000);
    bool showKys = false; //(GetAsyncKeyState('Q') & 0x8000) && (GetAsyncKeyState('R') & 0x8000);

    extern int _zstat_NumZombies;
    extern int _zstat_NavFails;
    extern int _zstat_Disabled;
    if(showKys) {
      gAutodeskNavMesh.perfBridge.Dump();
      r3dOutToLog("NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
    }
    if(showSpd) {
      r3dOutToLog("NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
    }
#ifndef _DEBUG    
    if((t2 > (1.0f / 60.0f))) {
      r3dOutToLog("!!!! NavMeshUpdate %f sec, z:%d, bad:%d, f:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails);
      //gAutodeskNavMesh.perfBridge.Dump();
      //r3dOutToLog("!!!! NavMeshUpdate %f sec, z:%d, bad:%d, f:%d, navPend:%d\n", t2, _zstat_NumZombies, _zstat_Disabled, _zstat_NavFails, _zstat_UnderProcess);
    }
#endif
#endif // ENABLE_AUTODESK_NAVIGATION

    GameWorld().EndFrame();
    
    if(gServerLogic.gameFinished_)
      break;
  }

  // set that we're finished
  gKeepAliveReporter.SetStarted(false);

  gMasterServerLogic.FinishGame();
  
  gServerLogic.DumpPacketStatistics();
  
  gCollectionsManager.Destroy();

  GameWorld_Destroy();
  ServerDummyWorld.Destroy();
  
  return;
}
开发者ID:hotza0012345,项目名称:devwarzth,代码行数:101,代码来源:ServerGame.cpp


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