本文整理汇总了C++中std::list::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ list::clear方法的具体用法?C++ list::clear怎么用?C++ list::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::list
的用法示例。
在下文中一共展示了list::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JustStartedEscort
void JustStartedEscort()
{
m_uiEventTimer = 5000;
m_uiEventCount = 0;
m_lResearchersList.clear();
float x, y, z;
me->GetPosition(x, y, z);
CellPair pair(Trinity::ComputeCellPair(x, y));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::AllCreaturesOfEntryInRange check(me, NPC_RESEARCHER, 25);
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me,m_lResearchersList, check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
cell.Visit(pair, cSearcher, *(me->GetMap()));
if (!m_lResearchersList.empty())
SetFormation();
}
示例2: Reset
void Reset()
{
m_uiFreezeSlashTimer = 15*IN_MILLISECONDS;
m_uiPenetratingColdTimer = 20*IN_MILLISECONDS;
m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS;
m_uiSummonNerubianTimer = 10*IN_MILLISECONDS;
m_uiSubmergeTimer = 80*IN_MILLISECONDS;
m_uiPursuingSpikeTimer = 2*IN_MILLISECONDS;
m_uiSummonScarabTimer = 2*IN_MILLISECONDS;
m_uiSummonFrostSphereTimer = 20*IN_MILLISECONDS;
m_uiBerserkTimer = 15*MINUTE*IN_MILLISECONDS;
m_uiStage = 0;
m_uiScarabSummoned = 0;
m_bIntro = true;
m_bReachedPhase3 = false;
m_uiTargetGUID = 0;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
Summons.DespawnAll();
m_vBurrowGUID.clear();
}
示例3: Reset
void Reset()
{
Intro = true;
Next = true;
Wave = 0;
IntroTimer = 45000;
NextTimer = 51000;
SandBreath_Timer = urand(6400, 10300);
ImpendingDeath_Timer = urand(25000, 30000);
WingBuffet_Timer = urand(12400, 20300);
Mda_Timer = urand(1100, 8800);
attackers.clear();
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Map* tmpMap = me->GetMap();
if (!tmpMap)
return;
if (Creature* Thrall = tmpMap->GetCreature(tmpMap->GetCreatureGUID(NPC_THRALL)))
ThrallGUID = Thrall->GetGUID();
}
示例4: FilterTargets
void FilterTargets (std::list<Unit*>& unitList)
{
Unit* unit_to_add = NULL;
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_UNIT && (*itr)->GetOwnerGUID() == GetCaster()->GetGUID() && (*itr)->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD)
{
unit_to_add = (*itr);
break;
}
}
unitList.clear();
if (unit_to_add)
unitList.push_back(unit_to_add);
else
{
// Pet not found - remove cooldown
if (Player* modOwner = GetCaster()->GetSpellModOwner())
modOwner->RemoveSpellCooldown(GetSpellInfo()->Id, true);
FinishCast(SPELL_FAILED_NO_PET);
}
}
示例5: mapDetails
bool mapDetails( std::list<object> & objects, uint32_t &x, uint32_t & y, uint32_t &w, uint32_t &h )
{
if ( oz::maps_iter == oz::maps.end())
return false;
objects.clear();
rectangle group = *oz::maps_iter;
//std::cout << "oz::mapDetails: " << group.x << "x" << group.x << " " << group.w<< "x" << group.h << std::endl;
for( uint8_t _x = 0; _x < group.w; _x++)
{
for( uint8_t _y = 0; _y < group.h; _y++)
{
ParseLND(objects, group.x+_x, group.y+_y, _x, _y);
}
}
x = group.x;
y = group.y;
w = group.w;
h = group.h;
oz::maps_iter++;
return true;
}
示例6: clearZipFS
result_t fs_base::clearZipFS(exlib::string fname)
{
if (fname.empty()) {
s_cachelock.lock();
s_cache.clear();
s_cachelock.unlock();
} else {
std::list<obj_ptr<cache_node>>::iterator it;
exlib::string safe_name;
path_base::normalize(fname, safe_name);
s_cachelock.lock();
for (it = s_cache.begin(); it != s_cache.end(); ++it)
if ((*it)->m_name == safe_name) {
s_cache.erase(it);
break;
}
s_cachelock.unlock();
}
return 0;
}
示例7: MakePolyPoly
static void MakePolyPoly( const CArea& area, TPolyPolygon &pp, bool reverse = true ){
pp.clear();
for(std::list<CCurve>::const_iterator It = area.m_curves.begin(); It != area.m_curves.end(); It++)
{
pts_for_AddVertex.clear();
const CCurve& curve = *It;
const CVertex* prev_vertex = NULL;
for(std::list<CVertex>::const_iterator It2 = curve.m_vertices.begin(); It2 != curve.m_vertices.end(); It2++)
{
const CVertex& vertex = *It2;
if(prev_vertex)AddVertex(vertex, prev_vertex);
prev_vertex = &vertex;
}
TPolygon p;
p.resize(pts_for_AddVertex.size());
if(reverse)
{
std::size_t i = pts_for_AddVertex.size() - 1;// clipper wants them the opposite way to CArea
for(std::list<DoubleAreaPoint>::iterator It = pts_for_AddVertex.begin(); It != pts_for_AddVertex.end(); It++, i--)
{
p[i] = It->int_point();
}
}
else
{
unsigned int i = 0;
for(std::list<DoubleAreaPoint>::iterator It = pts_for_AddVertex.begin(); It != pts_for_AddVertex.end(); It++, i++)
{
p[i] = It->int_point();
}
}
pp.push_back(p);
}
}
示例8: GetSortedAttributes
void nuiObject::GetSortedAttributes(std::list<nuiAttribBase>& rListToFill) const
{
CheckValid();
rListToFill.clear();
// Add classes attributes
int32 c = mClassNameIndex;
while (c >= 0)
{
std::map<nglString,nuiAttributeBase*>::const_iterator it = mClassAttributes[c].begin();
std::map<nglString,nuiAttributeBase*>::const_iterator end = mClassAttributes[c].end();
while (it != end)
{
nuiAttributeBase* pBase = it->second;
rListToFill.push_back(nuiAttribBase(const_cast<nuiObject*>(this), pBase));
++it;
}
c = mInheritanceMap[c];
}
// Add instance attributes
{
std::map<nglString,nuiAttributeBase*>::const_iterator it = mInstanceAttributes.begin();
std::map<nglString,nuiAttributeBase*>::const_iterator end = mInstanceAttributes.end();
while (it != end)
{
nuiAttributeBase* pBase = it->second;
rListToFill.push_back(nuiAttribBase(const_cast<nuiObject*>(this), pBase));
++it;
}
}
rListToFill.sort(NUIATTRIBUTES_COMPARE);
}
示例9: GetClosestWaypoint
void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, float m_x, float m_y, float m_z)
{
wp_list.clear();
if(Waypoints.size() <= count)
{
for(int i = 0; i < Waypoints.size(); ++i)
{
wp_list.push_back(Waypoints[i]);
}
return;
}
std::list<wp_distance> distances;
for(int i = 0; i < Waypoints.size(); ++i)
{
float cur_x = (Waypoints[i].x - m_x);
cur_x *= cur_x;
float cur_y = (Waypoints[i].y - m_y);
cur_y *= cur_y;
float cur_z = (Waypoints[i].z - m_z);
cur_z *= cur_z;
float cur_dist = cur_x + cur_y + cur_z;
wp_distance w_dist;
w_dist.dist = cur_dist;
w_dist.index = i;
distances.push_back(w_dist);
}
distances.sort(wp_distance_pred);
std::list<wp_distance>::iterator iter = distances.begin();
for(int i = 0; i < count; ++i)
{
wp_list.push_back(Waypoints[(*iter).index]);
++iter;
}
}
示例10: FilterTargets
void FilterTargets(std::list<WorldObject*>& targets)
{
// Shards of torment seems to target tanks if no other targets are available as of Warlords of Draenor
if (targets.size() <= 1)
{
_hasTarget = !targets.empty();
return;
}
Creature* caster = GetCaster()->ToCreature();
if (!caster || !caster->IsAIEnabled)
return;
if (WorldObject* tank = caster->AI()->SelectTarget(SELECT_TARGET_TOPAGGRO))
targets.remove(tank);
std::list<WorldObject*> melee, ranged;
for (WorldObject* target : targets)
{
if (caster->IsWithinMeleeRange(target->ToUnit()))
melee.push_back(target);
else
ranged.push_back(target);
}
targets.clear();
if (caster->GetMap()->Is25ManRaid())
if (WorldObject* target = GetRandomContainerElement(ranged, melee))
targets.push_back(target);
if (WorldObject* target = GetRandomContainerElement(melee, ranged))
targets.push_back(target);
_hasTarget = !targets.empty();
}
示例11: DamageTaken
void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage)
{
if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage))
{
uiDamage = 0;
EnterEvadeMode();
m_uiPhase = PHASE_COMPLETE;
m_uiEventTimer = 2000;
if (!lCreatureList.empty())
{
uint16 N = -1;
for (std::list<Creature*>::iterator itr = lCreatureList.begin(); itr != lCreatureList.end(); ++itr)
{
if ((*itr)->IsAlive())
{
N = N + 1;
(*itr)->RestoreFaction();
EnterEvadeMode();
(*itr)->SetWalk(false);
(*itr)->GetMotionMaster()->MovePoint(0, m_afEventMoveTo[N].m_fX, m_afEventMoveTo[N].m_fY, m_afEventMoveTo[N].m_fZ);
(*itr)->ForcedDespawn(5000);
}
}
}
lCreatureList.clear();
me->ForcedDespawn(60000);
me->SummonCreature(NPC_TERVOSH, -2876.66f, -3346.96f, 35.6029f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_JAINA, -2876.95f, -3342.78f, 35.6244f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_PAINED, -2877.67f, -3338.63f, 35.2548f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
}
示例12: GetTilesForBoundingBox
/**
* Return all tile necessary for covering the given boundingbox using the given magnification.
*/
void DataTileCache::GetTilesForBoundingBox(const Magnification& magnification,
const GeoBox& boundingBox,
std::list<TileRef>& tiles) const
{
tiles.clear();
//log.Debug() << "Creating tile data for level " << level << " and bounding box " << boundingBox.GetDisplayText();
uint32_t level=magnification.GetLevel();
uint32_t cx1=(uint32_t)floor((boundingBox.GetMinLon()+180.0)/cellDimension[level].width);
uint32_t cy1=(uint32_t)floor((boundingBox.GetMinLat()+90.0)/cellDimension[level].height);
uint32_t cx2=(uint32_t)floor((boundingBox.GetMaxLon()+180.0)/cellDimension[level].width);
uint32_t cy2=(uint32_t)floor((boundingBox.GetMaxLat()+90.0)/cellDimension[level].height);
//std::cout << "Tile bounding box: " << cx1 << "," << cy1 << " - " << cx2 << "," << cy2 << std::endl;
for (size_t y=cy1; y<=cy2; y++) {
for (size_t x=cx1; x<=cx2; x++) {
tiles.push_back(GetTile(TileId(magnification,x,y)));
}
}
}
示例13: updateFilterCache
void ShareManager::updateFilterCache(const std::string& strSetting, const std::string& strExtraPattern, bool escapeDot, std::list<StringMatch>& lst)
{
lst.clear();
auto tokens = StringTokenizer<string>(strSetting, ';').getTokens();
for(auto& pattern: tokens)
{
if(pattern.empty())
{
continue;
}
if(escapeDot)
{
Util::replace(".", "\\.", pattern);
}
StringMatch matcher;
matcher.pattern = pattern + strExtraPattern;
matcher.setMethod(StringMatch::REGEX);
matcher.prepare();
lst.push_back(matcher);
}
}
示例14: dump_shellcode
/**
* Callback function that is executed every time an instruction identified as
* potential shellcode is executed.
**/
void dump_shellcode(std::string* instructionString)
{
if (dumped.find(instructionString) != dumped.end())
{
// This check makes sure that an instruction is not dumped twice.
// For a complete run trace it would make sense to dump an instruction
// every time it is executed. However, imagine the shellcode has a
// tight loop that is executed a million times. The resulting log file
// is much easier to read if every instruction is only dumped once.
return;
}
if (!legitInstructions.empty())
{
// If legit instructions have been logged before the shellcode is
// executed, it is now a good time to dump them to the file. This
// information then shows when control flow was transferred from
// legit code to shellcode.
traceFile << "Executed before" << endl;
for (std::list<std::string>::iterator Iter = legitInstructions.begin(); Iter != legitInstructions.end(); ++Iter)
{
traceFile << *Iter << endl;
}
traceFile << endl << "Shellcode:" << endl;
legitInstructions.clear();
}
traceFile << *instructionString << std::endl;
dumped.insert(instructionString);
}
示例15: Reset
void Reset()
{
m_pInstance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); // Remove
DoCast(me, SPELL_NO_REGEN);
summons.clear();
me->SetPower(POWER_ENERGY, 0);
me->SetMaxPower(POWER_ENERGY, 100);
m_uiWitherTimer = 5000;
m_uiSeedlingTimer = 10000;
m_uiRampantTimer = 15000;
m_uiLife_Drain_Timer = 6000;
m_uiLife_Drain2_Timer = 10000;
m_uiLife_Drain3_Timer = 14000;
m_uiLife_Drain4_Timer = 19000;
m_uiLife_Drain5_Timer = 25000;
m_uiSporeTimer = 7500;
i = 0;
for(uint8 p=0; p<10; p++)
{
seedling[p] = NULL;
blossom[p] = NULL;
}
}