Merge pull request #583 from liyunfan1223/update_optimize

[Performance] Update optimize
This commit is contained in:
Yunfan Li
2024-10-06 23:03:48 +08:00
committed by GitHub

View File

@@ -314,6 +314,10 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
AllowActivity(); AllowActivity();
if (!CanUpdateAI())
return;
Spell* currentSpell = bot->GetCurrentSpell(CURRENT_GENERIC_SPELL); Spell* currentSpell = bot->GetCurrentSpell(CURRENT_GENERIC_SPELL);
if (!currentSpell) if (!currentSpell)
currentSpell = bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL); currentSpell = bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL);
@@ -356,6 +360,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
} }
// wait for spell cast // wait for spell cast
YieldThread(GetReactDelay());
return; return;
} }
@@ -382,9 +387,6 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
bot->StopMovingOnCurrentPos(); bot->StopMovingOnCurrentPos();
} }
} }
if (!CanUpdateAI())
return;
if (!bot->InBattleground() && !bot->inRandomLfgDungeon() && bot->GetGroup()) if (!bot->InBattleground() && !bot->inRandomLfgDungeon() && bot->GetGroup())
{ {