From 939283df0eba84e260902f8acee96fd95123b4e4 Mon Sep 17 00:00:00 2001 From: Aiden Lambert <74067227+theVerySharpFlat@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:05:30 -0600 Subject: [PATCH] Fix positioning of multitarget struct in pipelineresult unpack (#1181) fixed the unpacking order to match the current pipelineresult data layout. * fix positioning of multitarget struct in pipelineresult unpack * fix encode order in PhotonPipelineResult.cpp --- .../native/cpp/photon/targeting/PhotonPipelineResult.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/photon-targeting/src/main/native/cpp/photon/targeting/PhotonPipelineResult.cpp b/photon-targeting/src/main/native/cpp/photon/targeting/PhotonPipelineResult.cpp index 34740a40e..3de5bc074 100644 --- a/photon-targeting/src/main/native/cpp/photon/targeting/PhotonPipelineResult.cpp +++ b/photon-targeting/src/main/native/cpp/photon/targeting/PhotonPipelineResult.cpp @@ -37,12 +37,13 @@ bool PhotonPipelineResult::operator==(const PhotonPipelineResult& other) const { Packet& operator<<(Packet& packet, const PhotonPipelineResult& result) { // Encode latency and number of targets. - packet << result.latency.value() << result.multitagResult + packet << result.latency.value() << static_cast(result.targets.size()); // Encode the information of each target. for (auto& target : result.targets) packet << target; + packet << result.multitagResult; // Return the packet return packet; } @@ -51,7 +52,7 @@ Packet& operator>>(Packet& packet, PhotonPipelineResult& result) { // Decode latency, existence of targets, and number of targets. double latencyMillis = 0; int8_t targetCount = 0; - packet >> latencyMillis >> result.multitagResult >> targetCount; + packet >> latencyMillis >> targetCount; result.latency = units::millisecond_t(latencyMillis); result.targets.clear(); @@ -62,6 +63,8 @@ Packet& operator>>(Packet& packet, PhotonPipelineResult& result) { packet >> target; result.targets.push_back(target); } + + packet >> result.multitagResult; return packet; } } // namespace photon