feat(Core/Optimization): Optimize build of units update object by leveraging cache (#18637)

* feat(Core/Optimization): Optimize build of units update object by leveraging cache.

* Remove whitespaces.

* Add alternative hooks to handle transmog and other similar things.

* Fix build on some compilers.

* Fix codestyle

* Fix build again.

* Take into account updateType.
This commit is contained in:
Anton Popovichenko
2024-04-05 08:03:11 +02:00
committed by GitHub
parent 94df67b1c2
commit 1f640c9872
15 changed files with 302 additions and 156 deletions

View File

@@ -22,6 +22,7 @@
enum ReputationRank : uint8;
class ByteBuffer;
struct BuildValuesCachePosPointers;
class UnitScript : public ScriptObject
{
@@ -69,7 +70,9 @@ public:
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
[[nodiscard]] virtual bool OnBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player* /*target*/, uint16 /*index*/) { return false; }
[[nodiscard]] virtual bool ShouldTrackValuesUpdatePosByIndex(Unit const* /*unit*/, uint8 /*updateType*/, uint16 /*index*/) { return false; }
virtual void OnPatchValuesUpdate(Unit const* /*unit*/, ByteBuffer& /*valuesUpdateBuf*/, BuildValuesCachePosPointers& /*posPointers*/, Player* /*target*/) { }
/**
* @brief This hook runs in Unit::Update