diff --git a/src/ballistica/scene_v1/support/client_session_replay.cc b/src/ballistica/scene_v1/support/client_session_replay.cc index 6fe35bd5..528054d3 100644 --- a/src/ballistica/scene_v1/support/client_session_replay.cc +++ b/src/ballistica/scene_v1/support/client_session_replay.cc @@ -139,6 +139,9 @@ void ClientSessionReplay::FetchMessages() { SessionStream out(nullptr, false); DumpFullState(&out); + current_state_.correction_messages_.clear(); + GetCorrectionMessages(false, ¤t_state_.correction_messages_); + fflush(file_); current_state_.file_position_ = ftell(file_); current_state_.message_ = out.GetOutMessage(); @@ -301,6 +304,9 @@ void ClientSessionReplay::RestoreFromCurrentState() { Reset(true); fseek(file_, current_state_.file_position_, SEEK_SET); HandleSessionMessage(current_state_.message_); + for (const auto& msg : current_state_.correction_messages_) { + HandleSessionMessage(msg); + } } } // namespace ballistica::scene_v1 diff --git a/src/ballistica/scene_v1/support/client_session_replay.h b/src/ballistica/scene_v1/support/client_session_replay.h index 446b70f3..35db9483 100644 --- a/src/ballistica/scene_v1/support/client_session_replay.h +++ b/src/ballistica/scene_v1/support/client_session_replay.h @@ -35,6 +35,7 @@ class ClientSessionReplay : public ClientSession, struct IntermediateState { // Message containing full scene state at the moment. std::vector message_; + std::vector> correction_messages_; // A position in replay file where we should continue from. long file_position_;