本文整理汇总了C++中UNORDERED_MAP::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ UNORDERED_MAP::clear方法的具体用法?C++ UNORDERED_MAP::clear怎么用?C++ UNORDERED_MAP::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UNORDERED_MAP
的用法示例。
在下文中一共展示了UNORDERED_MAP::clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Reset()
{
//One random wisper every 90 - 300 seconds
WisperTimer = 90000;
//Phase information
PhaseTimer = 10000; //Emerge in 10 seconds
//No hold player for transition
HoldPlayer = 0;
//Body Phase
EyeTentacleTimer = 30000;
FleshTentaclesKilled = 0;
GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat)
GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat)
StomachAcidTimer = 4000; //Every 4 seconds
StomachEnterTimer = 10000; //Every 10 seconds
StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer
StomachEnterTarget = 0; //Target to be teleported to stomach
//Clear players in stomach and outside
Stomach_Map.clear();
//Reset flags
me->RemoveAurasDueToSpell(SPELL_TRANSFORM);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetVisible(false);
if (pInst)
pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED);
}
示例2: updateAliases
void CNodeDefManager::updateAliases(IItemDefManager *idef)
{
std::set<std::string> all = idef->getAll();
m_name_id_mapping_with_aliases.clear();
for (std::set<std::string>::iterator
i = all.begin(); i != all.end(); ++i) {
std::string name = *i;
std::string convert_to = idef->getAlias(name);
content_t id;
if (m_name_id_mapping.getId(convert_to, id)) {
m_name_id_mapping_with_aliases.insert(
std::make_pair(name, id));
}
}
}
示例3: UpdateAI
void UpdateAI(const uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
{
//No target so we'll use this section to do our random wispers instance wide
//WisperTimer
if (WisperTimer <= diff)
{
Map* map = me->GetMap();
if (!map->IsDungeon()) return;
//Play random sound to the zone
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
{
if (Player* pPlr = itr->getSource())
pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr);
}
}
//One random wisper every 90 - 300 seconds
WisperTimer = urand(90000, 300000);
} else WisperTimer -= diff;
return;
}
me->SetTarget(0);
//No instance
if (!pInst)
return;
uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE);
if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK)
{
// EyeTentacleTimer
if (EyeTentacleTimer <= diff)
{
//Spawn the 8 Eye Tentacles in the corret spots
SpawnEyeTentacle(0, 20); //south
SpawnEyeTentacle(10, 10); //south west
SpawnEyeTentacle(20, 0); //west
SpawnEyeTentacle(10, -10); //north west
SpawnEyeTentacle(0, -20); //north
SpawnEyeTentacle(-10, -10); //north east
SpawnEyeTentacle(-20, 0); // east
SpawnEyeTentacle(-10, 10); // south east
EyeTentacleTimer = 30000; // every 30sec in phase 2
} else EyeTentacleTimer -= diff;
}
switch (currentPhase)
{
//Transition phase
case PHASE_CTHUN_TRANSITION:
//PhaseTimer
if (PhaseTimer <= diff)
{
//Switch
pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH);
//Switch to c'thun model
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_TRANSFORM, false);
me->SetFullHealth();
me->SetVisible(true);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Emerging phase
//AttackStart(Unit::GetUnit(*me, HoldpPlayer));
DoZoneInCombat();
//Place all units in threat list on outside of stomach
Stomach_Map.clear();
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
//Outside stomach
Stomach_Map[(*i)->getUnitGuid()] = false;
}
//Spawn 2 flesh tentacles
FleshTentaclesKilled = 0;
//Spawn flesh tentacle
for (uint8 i = 0; i < 2; i++)
{
Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN);
if (!spawned)
++FleshTentaclesKilled;
}
//.........这里部分代码省略.........
示例4: UpdateAI
void UpdateAI(const uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
{
//No target so we'll use this section to do our random wispers instance wide
//WisperTimer
if (WisperTimer <= diff)
{
Map *map = me->GetMap();
if (!map->IsDungeon()) return;
Map::PlayerList const &PlayerList = map->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (Player* i_pl = i->getSource())
{
//Play random sound to the zone
i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true);
}
}
//One random wisper every 90 - 300 seconds
WisperTimer = 90000 + (rand()% 210000);
} else WisperTimer -= diff;
return;
}
me->SetUInt64Value(UNIT_FIELD_TARGET, 0);
//No instance
if (!pInst)
return;
switch (pInst->GetData(DATA_CTHUN_PHASE))
{
//Transition phase
case 2:
{
//PhaseTimer
if (PhaseTimer <= diff)
{
//Switch
pInst->SetData(DATA_CTHUN_PHASE, 3);
//Switch to c'thun model
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_TRANSFORM, false);
me->SetHealth(me->GetMaxHealth());
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Emerging phase
//AttackStart(Unit::GetUnit(*me, HoldPlayer));
DoZoneInCombat();
//Place all units in threat list on outside of stomach
Stomach_Map.clear();
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
//Outside stomach
Stomach_Map[(*i)->getUnitGuid()] = false;
}
//Spawn 2 flesh tentacles
FleshTentaclesKilled = 0;
Creature* Spawned;
//Spawn flesh tentacle
Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID());
//Spawn flesh tentacle
Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID());
PhaseTimer = 0;
} else PhaseTimer -= diff;
}break;
//Body Phase
case 3:
{
//Remove Target field
me->SetUInt64Value(UNIT_FIELD_TARGET, 0);
//Weaken
//.........这里部分代码省略.........
示例5: Free
void WaypointStore::Free()
{
waypoint_map.clear();
}
示例6: clear
void CNodeDefManager::clear()
{
m_content_features.clear();
m_name_id_mapping.clear();
m_name_id_mapping_with_aliases.clear();
m_group_to_items.clear();
m_next_id = 0;
resetNodeResolveState();
u32 initial_length = 0;
initial_length = MYMAX(initial_length, CONTENT_UNKNOWN + 1);
initial_length = MYMAX(initial_length, CONTENT_AIR + 1);
initial_length = MYMAX(initial_length, CONTENT_IGNORE + 1);
m_content_features.resize(initial_length);
// Set CONTENT_UNKNOWN
{
ContentFeatures f;
f.name = "unknown";
// Insert directly into containers
content_t c = CONTENT_UNKNOWN;
m_content_features[c] = f;
addNameIdMapping(c, f.name);
}
// Set CONTENT_AIR
{
ContentFeatures f;
f.name = "air";
f.drawtype = NDT_AIRLIKE;
f.param_type = CPT_LIGHT;
f.light_propagates = true;
f.sunlight_propagates = true;
f.walkable = false;
f.pointable = false;
f.diggable = false;
f.buildable_to = true;
f.floodable = true;
f.is_ground_content = true;
// Insert directly into containers
content_t c = CONTENT_AIR;
m_content_features[c] = f;
addNameIdMapping(c, f.name);
}
// Set CONTENT_IGNORE
{
ContentFeatures f;
f.name = "ignore";
f.drawtype = NDT_AIRLIKE;
f.param_type = CPT_NONE;
f.light_propagates = false;
f.sunlight_propagates = false;
f.walkable = false;
f.pointable = false;
f.diggable = false;
f.buildable_to = true; // A way to remove accidental CONTENT_IGNOREs
f.is_ground_content = true;
// Insert directly into containers
content_t c = CONTENT_IGNORE;
m_content_features[c] = f;
addNameIdMapping(c, f.name);
}
}