本文整理汇总了C++中CFactory::StopBuild方法的典型用法代码示例。如果您正苦于以下问题:C++ CFactory::StopBuild方法的具体用法?C++ CFactory::StopBuild怎么用?C++ CFactory::StopBuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::StopBuild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteStop
void CFactoryCAI::ExecuteStop(Command& c)
{
CFactory* fac = static_cast<CFactory*>(owner);
fac->StopBuild();
commandQue.pop_front();
}
示例2: InsertBuildCommand
void CFactoryCAI::InsertBuildCommand(CCommandQueue::iterator& it,
const Command& newCmd)
{
map<int, BuildOption>::iterator boi = buildOptions.find(newCmd.GetID());
if (boi != buildOptions.end()) {
boi->second.numQued++;
UpdateIconName(newCmd.GetID(), boi->second);
}
if (!commandQue.empty() && (it == commandQue.begin())) {
// ExecuteStop(), without the pop_front()
CFactory* fac = static_cast<CFactory*>(owner);
fac->StopBuild();
}
commandQue.insert(it, newCmd);
}
示例3: GiveCommandReal
//.........这里部分代码省略.........
waitCommandsAI.RemoveWaitCommand(owner, c);
}
newUnitCommands.pop_back();
} else {
newUnitCommands.push_back(c);
}
}
else {
bool dummy;
if (CancelCommands(c, newUnitCommands, dummy) > 0) {
return;
} else {
if (GetOverlapQueued(c, newUnitCommands).empty()) {
newUnitCommands.push_back(c);
} else {
return;
}
}
}
}
// the first new-unit build order can not be WAIT or SELFD
while (!newUnitCommands.empty()) {
const int id = newUnitCommands.front().id;
if ((id == CMD_WAIT) || (id == CMD_SELFD)) {
if (c.id == CMD_WAIT) {
waitCommandsAI.RemoveWaitCommand(owner, c);
}
newUnitCommands.pop_front();
} else {
break;
}
}
return;
}
BuildOption &bo = boi->second;
int numItems = 1;
if (c.options & SHIFT_KEY) { numItems *= 5; }
if (c.options & CONTROL_KEY) { numItems *= 20; }
if (c.options & RIGHT_MOUSE_KEY) {
bo.numQued -= numItems;
if (bo.numQued < 0) {
bo.numQued = 0;
}
int numToErase = numItems;
if (c.options & ALT_KEY) {
for (unsigned int cmdNum = 0; cmdNum < commandQue.size() && numToErase; ++cmdNum) {
if (commandQue[cmdNum].id == c.id) {
commandQue[cmdNum].id = CMD_STOP;
numToErase--;
}
}
}
else {
for (int cmdNum = commandQue.size() - 1; cmdNum != -1 && numToErase; --cmdNum) {
if (commandQue[cmdNum].id == c.id) {
commandQue[cmdNum].id = CMD_STOP;
numToErase--;
}
}
}
UpdateIconName(c.id,bo);
SlowUpdate();
}
else {
if (c.options & ALT_KEY) {
for (int a = 0; a < numItems; ++a) {
if (repeatOrders) {
Command nc(c);
nc.options |= DONT_REPEAT;
if (commandQue.empty()) {
commandQue.push_front(nc);
} else {
commandQue.insert(commandQue.begin()+1, nc);
}
} else {
commandQue.push_front(c);
}
}
if (!repeatOrders) {
building=false;
CFactory* fac = (CFactory*)owner;
fac->StopBuild();
}
} else {
for (int a = 0; a < numItems; ++a) {
commandQue.push_back(c);
}
}
bo.numQued += numItems;
UpdateIconName(c.id, bo);
SlowUpdate();
}
}
示例4: GiveCommandReal
//.........这里部分代码省略.........
if (cmdID != CMD_STOP) {
if ((cmdID == CMD_WAIT) || (cmdID == CMD_SELFD)) {
if (!newUnitCommands.empty() && (newUnitCommands.back().GetID() == cmdID)) {
if (cmdID == CMD_WAIT) {
waitCommandsAI.RemoveWaitCommand(owner, c);
}
newUnitCommands.pop_back();
} else {
newUnitCommands.push_back(c);
}
} else {
bool dummy;
if (CancelCommands(c, newUnitCommands, dummy) > 0) {
return;
} else {
if (GetOverlapQueued(c, newUnitCommands).empty()) {
newUnitCommands.push_back(c);
} else {
return;
}
}
}
}
// the first new-unit build order can not be WAIT or SELFD
while (!newUnitCommands.empty()) {
const Command& newUnitCommand = newUnitCommands.front();
const int id = newUnitCommand.GetID();
if ((id == CMD_WAIT) || (id == CMD_SELFD)) {
if (cmdID == CMD_WAIT) {
waitCommandsAI.RemoveWaitCommand(owner, c);
}
newUnitCommands.pop_front();
} else {
break;
}
}
return;
}
BuildOption& bo = boi->second;
int numItems = 1;
if (c.options & SHIFT_KEY) { numItems *= 5; }
if (c.options & CONTROL_KEY) { numItems *= 20; }
if (c.options & RIGHT_MOUSE_KEY) {
bo.numQued -= numItems;
bo.numQued = std::max(bo.numQued, 0);
int numToErase = numItems;
if (c.options & ALT_KEY) {
for (unsigned int cmdNum = 0; cmdNum < commandQue.size() && numToErase; ++cmdNum) {
if (commandQue[cmdNum].GetID() == cmdID) {
commandQue[cmdNum] = Command(CMD_STOP);
numToErase--;
}
}
} else {
for (int cmdNum = commandQue.size() - 1; cmdNum != -1 && numToErase; --cmdNum) {
if (commandQue[cmdNum].GetID() == cmdID) {
commandQue[cmdNum] = Command(CMD_STOP);
numToErase--;
}
}
}
UpdateIconName(cmdID, bo);
SlowUpdate();
} else {
if (c.options & ALT_KEY) {
for (int a = 0; a < numItems; ++a) {
if (repeatOrders) {
Command nc(c);
nc.options |= INTERNAL_ORDER;
if (commandQue.empty()) {
commandQue.push_front(nc);
} else {
commandQue.insert(commandQue.begin()+1, nc);
}
} else {
commandQue.push_front(c);
}
}
if (!repeatOrders) {
CFactory* fac = static_cast<CFactory*>(owner);
fac->StopBuild();
}
} else {
for (int a = 0; a < numItems; ++a) {
commandQue.push_back(c);
}
}
bo.numQued += numItems;
UpdateIconName(cmdID, bo);
SlowUpdate();
}
}