本文整理汇总了C++中CFactory::QueueBuild方法的典型用法代码示例。如果您正苦于以下问题:C++ CFactory::QueueBuild方法的具体用法?C++ CFactory::QueueBuild怎么用?C++ CFactory::QueueBuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::QueueBuild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SlowUpdate
void CFactoryCAI::SlowUpdate()
{
// Commands issued may invoke SlowUpdate when paused
if (gs->paused)
return;
if (commandQue.empty() || owner->beingBuilt)
return;
CFactory* fac = static_cast<CFactory*>(owner);
while (!commandQue.empty()) {
Command& c = commandQue.front();
const size_t oldQueueSize = commandQue.size();
const std::map<int, BuildOption>::iterator buildOptIt = buildOptions.find(c.GetID());
if (buildOptIt != buildOptions.end()) {
// build-order
switch (fac->QueueBuild(unitDefHandler->GetUnitDefByID(-c.GetID()), c, &FactoryFinishBuildCallBack)) {
case CFactory::FACTORY_SKIP_BUILD_ORDER: {
// order rejected and we want to skip it permanently
DecreaseQueueCount(c, buildOptions[c.GetID()], false);
} break;
}
} else {
// regular order (move/wait/etc)
switch (c.GetID()) {
case CMD_STOP: {
ExecuteStop(c);
} break;
default: {
CCommandAI::SlowUpdate();
break;
}
}
}
// exit if no command was consumed
if (oldQueueSize == commandQue.size())
break;
}
}