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


C++ Bot::DeleteSearchNodes方法代码示例

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


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

示例1: Execute


//.........这里部分代码省略.........
      break;

   case NETMSG_TEXTMSG:
      if (m_state == 1)
      {
         if (FStrEq (PTR_TO_STR (p), "#CTs_Win") ||
            FStrEq (PTR_TO_STR (p), "#Bomb_Defused") ||
            FStrEq (PTR_TO_STR (p), "#Terrorists_Win") ||
            FStrEq (PTR_TO_STR (p), "#Round_Draw") ||
            FStrEq (PTR_TO_STR (p), "#All_Hostages_Rescued") ||
            FStrEq (PTR_TO_STR (p), "#Target_Saved") ||
            FStrEq (PTR_TO_STR (p), "#Hostages_Not_Rescued") ||
            FStrEq (PTR_TO_STR (p), "#Terrorists_Not_Escaped") ||
            FStrEq (PTR_TO_STR (p), "#VIP_Not_Escaped") ||
            FStrEq (PTR_TO_STR (p), "#Escaping_Terrorists_Neutralized") ||
            FStrEq (PTR_TO_STR (p), "#VIP_Assassinated") ||
            FStrEq (PTR_TO_STR (p), "#VIP_Escaped") ||
            FStrEq (PTR_TO_STR (p), "#Terrorists_Escaped") ||
            FStrEq (PTR_TO_STR (p), "#CTs_PreventEscape") ||
            FStrEq (PTR_TO_STR (p), "#Target_Bombed") ||
            FStrEq (PTR_TO_STR (p), "#Game_Commencing") ||
            FStrEq (PTR_TO_STR (p), "#Game_will_restart_in"))
         {
            g_roundEnded = true;

            if (FStrEq (PTR_TO_STR (p), "#Game_Commencing"))
               g_isCommencing = true;

            if (FStrEq (PTR_TO_STR (p), "#CTs_Win"))
               g_botManager->SetLastWinner (TEAM_COUNTER); // update last winner for economics

            if (FStrEq (PTR_TO_STR (p), "#Terrorists_Win"))
               g_botManager->SetLastWinner (TEAM_TERRORIST); // update last winner for economics

            g_waypoint->SetBombPosition (true);
         }
         else if (!g_bombPlanted && FStrEq (PTR_TO_STR (p), "#Bomb_Planted"))
         {
            g_bombPlanted = true;
            g_bombSayString = true;
            g_timeBombPlanted = engine->GetTime ();

            for (int i = 0; i < engine->GetMaxClients (); i++)
            {
               Bot *bot = g_botManager->GetBot (i);

               if (bot != null && IsAlive (bot->GetEntity ()))
               {
                  bot->DeleteSearchNodes ();
                  bot->ResetTasks ();

                  if (engine->RandomInt (0, 100) < 85 && GetTeam (bot->GetEntity ()) == TEAM_COUNTER)
                     bot->ChatterMessage (Chatter_WhereIsTheBomb);
               }
            }
            g_waypoint->SetBombPosition ();
         }
         else if (m_bot != null && FStrEq (PTR_TO_STR (p), "#Switch_To_BurstFire"))
            m_bot->m_weaponBurstMode = BURST_ENABLED;
         else if (m_bot != null && FStrEq (PTR_TO_STR (p), "#Switch_To_SemiAuto"))
            m_bot->m_weaponBurstMode = BURST_DISABLED;
      }
      break;

   case NETMSG_SCOREINFO:
      switch (m_state)
      {
      case 0:
         playerIndex = PTR_TO_INT (p);
         break;

      case 4:
         if (playerIndex >= 0 && playerIndex <= engine->GetMaxClients ())
         {
            if (PTR_TO_INT (p) == 1)
               g_clients[playerIndex - 1].realTeam = TEAM_TERRORIST;
            else if (PTR_TO_INT (p) == 2)
               g_clients[playerIndex - 1].realTeam = TEAM_COUNTER;

               g_clients[playerIndex - 1].team = g_clients[playerIndex - 1].realTeam;
         }
         break;
      }
      break;

   case NETMSG_BARTIME:
      if (m_state == 0)
      {
         if (PTR_TO_INT (p) > 0)
            m_bot->m_hasProgressBar = true; // the progress bar on a hud
         else if (PTR_TO_INT (p) == 0)
            m_bot->m_hasProgressBar = false; // no progress bar or disappeared
      }
      break;

   default:
      AddLogEntry (true, LOG_FATAL, "Network message handler error. Call to unrecognized message id (%d).\n", m_message);
   }
   m_state++; // and finally update network message state
}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:101,代码来源:netmsg.cpp


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