summaryrefslogtreecommitdiff
path: root/scene/multiplayer/scene_replication_interface.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-21 21:20:54 +0100
committerGitHub <noreply@github.com>2022-02-21 21:20:54 +0100
commit7e9047f37895de27ce7db55d40a2a2e7fe2fe331 (patch)
treecb335e6ccad453669b818cd33a485556e2d7fbba /scene/multiplayer/scene_replication_interface.cpp
parent773656e907f82c9f959d4ee1df62f3e9f62ebcd9 (diff)
parentf1dc6cc9e441e4dc5a6e0c9764d583a668679e5c (diff)
Merge pull request #58400 from Faless/mp/4.x_repl_path_stopgap
[Net] Fix multi-peer path-only replication, optimize single peer object cache.
Diffstat (limited to 'scene/multiplayer/scene_replication_interface.cpp')
-rw-r--r--scene/multiplayer/scene_replication_interface.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/multiplayer/scene_replication_interface.cpp b/scene/multiplayer/scene_replication_interface.cpp
index 25a704b37e..0764f136e4 100644
--- a/scene/multiplayer/scene_replication_interface.cpp
+++ b/scene/multiplayer/scene_replication_interface.cpp
@@ -350,11 +350,12 @@ void SceneReplicationInterface::_send_sync(int p_peer, uint64_t p_msec) {
}
if (size) {
uint32_t net_id = rep_state->get_net_id(oid);
- if (net_id == 0) {
+ if (net_id == 0 || (net_id & 0x80000000)) {
// First time path based ID.
NodePath rel_path = multiplayer->get_root_path().rel_path_to(sync->get_path());
int path_id = 0;
multiplayer->send_object_cache(sync, rel_path, p_peer, path_id);
+ ERR_CONTINUE_MSG(net_id && net_id != (uint32_t(path_id) | 0x80000000), "This should never happen!");
net_id = path_id;
rep_state->set_net_id(oid, net_id | 0x80000000);
}