Core/Packets: changed amount storage for aura update packets from vector to array to improve performance

This commit is contained in:
Ovahlord
2020-07-16 17:42:08 +02:00
parent 961144d82d
commit 2a8fe49a73
3 changed files with 5 additions and 4 deletions

View File

@@ -225,8 +225,9 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo cons
if (auraData.Remaining)
data << int32(*auraData.Remaining);
for (int32 amount : auraData.Points)
data << int32(amount);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (auraData.Points[i].is_initialized())
data << int32(*auraData.Points[i]);
return data;
}

View File

@@ -188,7 +188,7 @@ namespace WorldPackets
Optional<ObjectGuid> CastUnit;
Optional<int32> Duration;
Optional<int32> Remaining;
std::vector<int32> Points;
std::array<Optional<int32>, 3 /*MAX_SPELL_EFFECTS*/> Points;
};
struct AuraInfo

View File

@@ -221,7 +221,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (AuraEffect const* effect = aura->GetEffect(i))
if (HasEffect(i)) // Not all of aura's effects have to be applied on every target
auraData.Points.push_back(effect->GetAmount());
auraData.Points[i] = effect->GetAmount();
}
void AuraApplication::ClientUpdate(bool remove)