本文整理汇总了C++中Squad::addMember方法的典型用法代码示例。如果您正苦于以下问题:C++ Squad::addMember方法的具体用法?C++ Squad::addMember怎么用?C++ Squad::addMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Squad
的用法示例。
在下文中一共展示了Squad::addMember方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBunkerSquad
int Commander::addBunkerSquad()
{
Squad* bSquad = new Squad(100 + AgentManager::getInstance()->countNoUnits(UnitTypes::Terran_Bunker), Squad::BUNKER, "BunkerSquad", 5);
bSquad->addSetup(UnitTypes::Terran_Marine, 4);
squads.push_back(bSquad);
//Try to fill from other squads.
int added = 0;
for (int i = 0; i < (int)squads.size(); i++)
{
Squad* sq = squads.at(i);
if (sq->isOffensive() || sq->isDefensive())
{
for (int i = 0; i < 4 - added; i++)
{
if (sq->hasUnits(UnitTypes::Terran_Marine, 1))
{
if (added < 4)
{
BaseAgent* ma = sq->removeMember(UnitTypes::Terran_Marine);
if (ma != NULL)
{
added++;
bSquad->addMember(ma);
ma->clearGoal();
}
}
}
}
}
}
return bSquad->getID();
}
示例2: assignUnit
void Commander::assignUnit(BaseAgent* agent)
{
//Broodwar->printf("%s (%s) is not assigned to a squad", agent->getUnitType().getName().c_str(), agent->getTypeName().c_str());
for (int i = 0; i < (int)squads.size(); i++)
{
Squad* sq = squads.at(i);
if (sq->needUnit(agent->getUnitType()))
{
sq->addMember(agent);
//Broodwar->printf("%s is assigned to SQ %d", agent->getUnitType().getName().c_str(), sq->getID());
return;
}
}
}