本文整理汇总了C++中CreatureVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureVector::push_back方法的具体用法?C++ CreatureVector::push_back怎么用?C++ CreatureVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureVector
的用法示例。
在下文中一共展示了CreatureVector::push_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDeath
bool Creature::onDeath()
{
DeathList deathList = getKillers();
bool deny = false;
CreatureEventList prepareDeathEvents = getCreatureEvents(CREATURE_EVENT_PREPAREDEATH);
for(CreatureEventList::iterator it = prepareDeathEvents.begin(); it != prepareDeathEvents.end(); ++it)
{
if(!(*it)->executePrepareDeath(this, deathList) && !deny)
deny = true;
}
if(deny)
return false;
int32_t i = 0, size = deathList.size(), limit = g_config.getNumber(ConfigManager::DEATH_ASSISTS) + 1;
if(limit > 0 && size > limit)
size = limit;
Creature* tmp = NULL;
CreatureVector justifyVec;
for(DeathList::iterator it = deathList.begin(); it != deathList.end(); ++it, ++i)
{
if(it->isNameKill())
continue;
if(it == deathList.begin())
it->setLast();
if(i < size)
{
if(it->getKillerCreature()->getPlayer())
tmp = it->getKillerCreature();
else if(it->getKillerCreature()->getPlayerMaster())
tmp = it->getKillerCreature()->getMaster();
}
if(tmp)
{
if(std::find(justifyVec.begin(), justifyVec.end(), tmp) == justifyVec.end())
{
it->setJustify();
justifyVec.push_back(tmp);
}
tmp = NULL;
}
if(!it->getKillerCreature()->onKilledCreature(this, (*it)) && it->isLast())
return false;
}
for(CountMap::iterator it = damageMap.begin(); it != damageMap.end(); ++it)
{
if((tmp = g_game.getCreatureByID(it->first)))
tmp->onTargetKilled(this);
}
dropCorpse(deathList);
if(master)
master->removeSummon(this);
return true;
}