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


C++ Task::GetTaskId方法代码示例

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


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

示例1: StateInit

 //
 // Initial state
 //
 void SquadAttack::StateInit()
 {
   // Attack that target already
   for (SquadObj::UnitList::Iterator i(&subject->GetList()); *i; ++i)
   {
     if (UnitObj *u = (*i)->GetPointer())
     {
       // If the unit can damage the target then make it attack
       if 
       (
         !u->ForceAttacking(target) && u->CanDamageNow(target) && 
         u->FlushTasks(Tasks::UnitAttack::GetConfigBlockingPriority())
       )
       {
         Task *task = new UnitAttack(u, target);
         u->PrependTask(task, GetFlags());
         (*i)->task = task->GetTaskId();
         (*i)->completed = FALSE;
       }
       else 
       {
         (*i)->task = 0;
         (*i)->completed = TRUE;
       }
     }
   }
   NextState(0xA8FEF90A); // "Attack"
 }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:31,代码来源:tasks_squadattack.cpp

示例2: SaveTask

  //
  // Save
  //
  // Save a task
  //
  void SaveTask(FScope *fScope, const char *name, Task &task)
  {
    // Write the name given
    fScope = fScope->AddFunction(name);

    // Add the task configuration (type)
    fScope->AddArgString(task.GetName());

    // Add the task id
    fScope->AddArgInteger(task.GetTaskId());

    // Let the task do the rest
    task.Save(fScope);
  }
开发者ID:ZhouWeikuan,项目名称:darkreign2,代码行数:19,代码来源:taskctrl.cpp

示例3: StateInit

  //
  // StateInit
  //
  void SquadBoard::StateInit()
  {
    // Get each of the units in the squad to board transports
    SquadObj::UnitList::Iterator u(&subject->GetList());

    // We could enhance this to use units which are closest to transports etc.

    // Clear the squad's completed flags
    for (!u; *u; u++)
    {
      (*u)->completed = FALSE;
      (*u)->task = 0;
    }

    // Reset squad iterator
    !u;

    for (TransportObjList::Iterator t(&transports); *t; t++)
    {
      if ((*t)->Alive())
      {
        TransportObj *transport = **t;
        U32 slots = transport->TransportType()->GetSpaces();
        U32 added = 0;

        while (slots--)
        {
          UnitObjPtr *unitPtr = *u;

          if (unitPtr)
          {
            ASSERT(unitPtr->Alive())
            UnitObj *unit = *unitPtr;

            if (unit->CanEverMove())
            {
              // Tell the unit to board
              unit->FlushTasks(Tasks::UnitBoard::GetConfigBlockingPriority());

              Task *task;

              // Is this a telepad
              if (TaskCtrl::PromoteIdle<Tasks::TransportPad>(transport))
              {
                unit->PrependTask(task = new Tasks::UnitMove(unit, transport), GetFlags());
              }
              else
              {
                unit->PrependTask(task = new Tasks::UnitBoard(unit, transport), GetFlags());
              }

              (*u)->task = task->GetTaskId();

              added++;
            }
            else
            {
              // This unit can't move so complete it
              (*u)->completed = TRUE;
            }
          }
          else
          {
            break;
          }

          // Increment iterator
          u++;
        }

        if (!added)
        {
          // No units were added
          break;
        }
      }
    }

    // Complete those units which missed out
    for (; *u; u++)
    {
      (*u)->completed = TRUE;
    }

    NextState(0x09E5F977); // "Boarding"
  }
开发者ID:ZhouWeikuan,项目名称:darkreign2,代码行数:89,代码来源:tasks_squadboard.cpp


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