mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
attackers value
This commit is contained in:
parent
ff29e04e81
commit
1f839d950e
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
GuidVector AttackersValue::Calculate()
|
GuidVector AttackersValue::Calculate()
|
||||||
{
|
{
|
||||||
std::set<Unit*> targets;
|
std::unordered_set<Unit*> targets;
|
||||||
|
|
||||||
GuidVector result;
|
GuidVector result;
|
||||||
if (!botAI->AllowActivity(ALL_ACTIVITY))
|
if (!botAI->AllowActivity(ALL_ACTIVITY))
|
||||||
@ -34,7 +34,7 @@ GuidVector AttackersValue::Calculate()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttackersValue::AddAttackersOf(Group* group, std::set<Unit*>& targets)
|
void AttackersValue::AddAttackersOf(Group* group, std::unordered_set<Unit*>& targets)
|
||||||
{
|
{
|
||||||
Group::MemberSlotList const& groupSlot = group->GetMemberSlots();
|
Group::MemberSlotList const& groupSlot = group->GetMemberSlots();
|
||||||
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
|
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
|
||||||
@ -59,7 +59,7 @@ struct AddGuardiansHelper
|
|||||||
std::vector<Unit*> &units;
|
std::vector<Unit*> &units;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AttackersValue::AddAttackersOf(Player* player, std::set<Unit*>& targets)
|
void AttackersValue::AddAttackersOf(Player* player, std::unordered_set<Unit*>& targets)
|
||||||
{
|
{
|
||||||
if (!player || !player->IsInWorld() || player->IsBeingTeleported())
|
if (!player || !player->IsInWorld() || player->IsBeingTeleported())
|
||||||
return;
|
return;
|
||||||
@ -82,14 +82,14 @@ void AttackersValue::AddAttackersOf(Player* player, std::set<Unit*>& targets)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttackersValue::RemoveNonThreating(std::set<Unit*>& targets)
|
void AttackersValue::RemoveNonThreating(std::unordered_set<Unit*>& targets)
|
||||||
{
|
{
|
||||||
for(std::set<Unit *>::iterator tIter = targets.begin(); tIter != targets.end();)
|
for(std::unordered_set<Unit *>::iterator tIter = targets.begin(); tIter != targets.end();)
|
||||||
{
|
{
|
||||||
Unit* unit = *tIter;
|
Unit* unit = *tIter;
|
||||||
if(bot->GetMapId() != unit->GetMapId() || !hasRealThreat(unit) || !IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit))
|
if(bot->GetMapId() != unit->GetMapId() || !hasRealThreat(unit) || !IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit))
|
||||||
{
|
{
|
||||||
std::set<Unit *>::iterator tIter2 = tIter;
|
std::unordered_set<Unit *>::iterator tIter2 = tIter;
|
||||||
++tIter;
|
++tIter;
|
||||||
targets.erase(tIter2);
|
targets.erase(tIter2);
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ void AttackersValue::RemoveNonThreating(std::set<Unit*>& targets)
|
|||||||
// Unit* unit = *tIter;
|
// Unit* unit = *tIter;
|
||||||
// if (!IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit))
|
// if (!IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit))
|
||||||
// {
|
// {
|
||||||
// std::set<Unit*>::iterator tIter2 = tIter;
|
// std::unordered_set<Unit*>::iterator tIter2 = tIter;
|
||||||
// ++tIter;
|
// ++tIter;
|
||||||
// targets.erase(tIter2);
|
// targets.erase(tIter2);
|
||||||
// }
|
// }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user