diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-09-05 19:15:47 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-09-11 15:19:17 +1000 |
commit | 37f3178d33ab77de064bcbf10b4b03ddb47cc979 (patch) | |
tree | 76e3b3ce2d8716577af98e2bbbc4a41021db5107 /source/game/StarPlayer.cpp | |
parent | 90db1e0fbadaeb625691d3d0d13f5ae6ef057109 (diff) |
Network compatibility changes
Diffstat (limited to 'source/game/StarPlayer.cpp')
-rw-r--r-- | source/game/StarPlayer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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<String>()); @@ -1618,12 +1619,12 @@ Direction Player::facingDirection() const { return m_movementController->facingDirection(); } -pair<ByteArray, uint64_t> Player::writeNetState(uint64_t fromVersion) { - return m_netGroup.writeNetState(fromVersion); +pair<ByteArray, uint64_t> 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); |