From 37f3178d33ab77de064bcbf10b4b03ddb47cc979 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Thu, 5 Sep 2024 19:15:47 +1000 Subject: Network compatibility changes --- source/game/StarPlayer.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/game/StarPlayer.cpp') diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp index 9c9c482..8ee6d7a 100644 --- a/source/game/StarPlayer.cpp +++ b/source/game/StarPlayer.cpp @@ -187,8 +187,9 @@ Player::Player(PlayerConfigPtr config, Uuid uuid) { m_netGroup.setNeedsStoreCallback(bind(&Player::setNetStates, this)); } -Player::Player(PlayerConfigPtr config, ByteArray const& netStore) : Player(config) { +Player::Player(PlayerConfigPtr config, ByteArray const& netStore, NetCompatibilityRules rules) : Player(config) { DataStreamBuffer ds(netStore); + ds.setStreamCompatibilityVersion(rules); setUniqueId(ds.read()); @@ -1618,12 +1619,12 @@ Direction Player::facingDirection() const { return m_movementController->facingDirection(); } -pair Player::writeNetState(uint64_t fromVersion) { - return m_netGroup.writeNetState(fromVersion); +pair Player::writeNetState(uint64_t fromVersion, NetCompatibilityRules rules) { + return m_netGroup.writeNetState(fromVersion, rules); } -void Player::readNetState(ByteArray data, float interpolationTime) { - m_netGroup.readNetState(std::move(data), interpolationTime); +void Player::readNetState(ByteArray data, float interpolationTime, NetCompatibilityRules rules) { + m_netGroup.readNetState(data, interpolationTime, rules); } void Player::enableInterpolation(float) { @@ -2319,8 +2320,9 @@ Json Player::diskStore() { }; } -ByteArray Player::netStore() { +ByteArray Player::netStore(NetCompatibilityRules rules) { DataStreamBuffer ds; + ds.setStreamCompatibilityVersion(rules); ds.write(*uniqueId()); ds.write(m_description); -- cgit v1.2.3