Performance improvement for running turns by reducing the number of lookups for the hitdata.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-25 20:20:30 +02:00
parent f602ea9358
commit 94d9d4f3d2
2 changed files with 11 additions and 1 deletions

View File

@@ -130,6 +130,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
auto library = user->GetBattle()->GetLibrary();
AssertNotNull(library)
auto dmgLibrary = library->GetDamageLibrary();
auto hitIterator = attack->GetTargetIteratorBegin(target);
for (uint8_t hitIndex = 0; hitIndex < numberOfHits; hitIndex++) {
if (user->IsFainted()) {
break;
@@ -137,7 +138,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
if (target->IsFainted()) {
break;
}
auto& hit = attack->GetHitData(target, hitIndex);
auto& hit = *(hitIterator++);
auto hitType = hit.GetType();
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);
auto effectiveness = library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes());