本文整理汇总了C++中GuidVector::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ GuidVector::reserve方法的具体用法?C++ GuidVector::reserve怎么用?C++ GuidVector::reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuidVector
的用法示例。
在下文中一共展示了GuidVector::reserve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetChallengers
void SetChallengers()
{
m_vAffrayChallengerGuidsVector.reserve(MAX_CHALLENGERS);
for (uint8 i = 0; i < MAX_CHALLENGERS; ++i)
m_creature->SummonCreature(NPC_AFFRAY_CHALLENGER, aAffrayChallengerLoc[i][0], aAffrayChallengerLoc[i][1], aAffrayChallengerLoc[i][2], aAffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 600000);
}
示例2: DoSetupAdds
void DoSetupAdds()
{
m_uiSetupAddsTimer = 0;
if (!m_pInstance)
return;
GuidList lAddGuids;
m_pInstance->GetKelidanAddList(lAddGuids);
// Sort Adds to vector if not already done
if (!lAddGuids.empty())
{
m_vAddGuids.reserve(lAddGuids.size());
std::list<Creature*> lAdds;
for (GuidList::const_iterator itr = lAddGuids.begin(); itr != lAddGuids.end(); ++itr)
{
if (Creature* pAdd = m_pInstance->instance->GetCreature(*itr))
lAdds.push_back(pAdd);
}
// Sort them by angle
lAdds.sort(SortByAngle(m_creature));
for (std::list<Creature*>::const_iterator itr = lAdds.begin(); itr != lAdds.end(); ++itr)
m_vAddGuids.push_back((*itr)->GetObjectGuid());
}
// Respawn killed adds and reset counter
m_uiKilledAdds = 0;
for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr)
{
Creature* pAdd = m_pInstance->instance->GetCreature(*itr);
if (pAdd && !pAdd->isAlive())
pAdd->Respawn();
}
// Cast pentagram
uint8 s = m_vAddGuids.size();
for (uint8 i = 0; i < s; ++i)
{
Creature* pCaster = m_pInstance->instance->GetCreature(m_vAddGuids[i]);
Creature* pTarget = m_pInstance->instance->GetCreature(m_vAddGuids[(i + 2) % s]);
if (pCaster && pTarget)
pCaster->CastSpell(pTarget, SPELL_CHANNELING, TRIGGERED_NONE);
}
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
示例3: Reset
void Reset() override
{
m_uiArcaneMissilesTimer = 0;
m_uiWrathOfTheAstromancerTimer = urand(15000, 25000);
m_uiBlindingLightTimer = 20000;
m_uiFearTimer = 20000;
m_uiVoidBoltTimer = 10000;
m_uiSplitTimer = 50000;
m_uiSummonAgentsTimer = 0;
m_uiSummonPriestsTimer = 0;
m_uiDelayTimer = 0;
m_Phase = PHASE_NORMAL;
// The vector will store the summoned spotlights
m_vSpotLightsGuidVector.reserve(MAX_SPOTLIGHTS);
m_creature->SetArmor(m_uiDefaultArmor);
if (m_creature->GetVisibility() != VISIBILITY_ON)
m_creature->SetVisibility(VISIBILITY_ON);
SetCombatMovement(true);
}