Move GetSpellTargetList to only get called when necessary to reduce overhead

This commit is contained in:
nytmyr
2025-02-01 09:11:50 -06:00
parent 498b64fea2
commit 46a1b26529
2 changed files with 21 additions and 16 deletions
+15 -10
View File
@@ -114,8 +114,8 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
GenerateBaseStats();
bot_timers.clear();
bot_blocked_buffs.clear();
_spellTargetList.clear();
_groupSpellTargetList.clear();
_spell_target_list.clear();
_group_spell_target_list.clear();
SetStoredRaid(nullptr);
SetVerifiedRaid(false);
p_raid_instance = nullptr;
@@ -269,8 +269,8 @@ Bot::Bot(
database.botdb.LoadBotBlockedBuffs(this);
}
_spellTargetList.clear();
_groupSpellTargetList.clear();
_spell_target_list.clear();
_group_spell_target_list.clear();
SetStoredRaid(nullptr);
SetVerifiedRaid(false);
p_raid_instance = nullptr;
@@ -2197,10 +2197,8 @@ void Bot::AI_Process()
return;
}
std::vector<Mob*> spell_target_list = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing));
SetSpellTargetList(spell_target_list);
std::vector<Mob*> group_spell_target_list = GatherSpellTargets();
SetGroupSpellTargetList(group_spell_target_list);
_spell_target_list.clear();
_group_spell_target_list.clear();
SetTempSpellType(UINT16_MAX);
// HEAL ROTATION CASTING CHECKS
@@ -2216,8 +2214,6 @@ void Bot::AI_Process()
//ALT COMBAT (ACQUIRE HATE)
glm::vec3 Goal(0, 0, 0);
// We have aggro to choose from
if (IsEngaged()) {
if (rest_timer.Enabled()) {
@@ -13312,3 +13308,12 @@ bool Bot::IsImmuneToBotSpell(uint16 spell_id, Mob* caster) {
return false;
}
std::vector<Mob*> Bot::GetSpellTargetList() {
if (_spell_target_list.empty()) {
std::vector<Mob*> spell_target_list = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing));
SetSpellTargetList(spell_target_list);
}
return _spell_target_list;
}