Skip to content

Commit

Permalink
Fix positioning of multitarget struct in pipelineresult unpack (#1181)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
theVerySharpFlat authored Jan 22, 2024
1 parent 43338a4 commit 939283d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<int8_t>(result.targets.size());

// Encode the information of each target.
for (auto& target : result.targets) packet << target;

packet << result.multitagResult;
// Return the packet
return packet;
}
Expand All @@ -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();
Expand All @@ -62,6 +63,8 @@ Packet& operator>>(Packet& packet, PhotonPipelineResult& result) {
packet >> target;
result.targets.push_back(target);
}

packet >> result.multitagResult;
return packet;
}
} // namespace photon

0 comments on commit 939283d

Please sign in to comment.