本文整理汇总了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"
}
示例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);
}
示例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"
}