From 07229a884554fdbf9511dc487e28c617ea0e4473 Mon Sep 17 00:00:00 2001 From: DennisManaa Date: Tue, 12 Sep 2023 20:41:17 +0200 Subject: [PATCH] Switch order of delta-state-check and call to _verify_synchronizer --- modules/multiplayer/scene_replication_interface.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index 7f12fea4bf3b..933599753d05 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -709,10 +709,7 @@ void SceneReplicationInterface::_send_delta(int p_peer, const HashSet for (const ObjectID &oid : p_synchronizers) { MultiplayerSynchronizer *sync = get_id_as(oid); ERR_CONTINUE(!sync || !sync->get_replication_config().is_valid() || !sync->is_multiplayer_authority()); - uint32_t net_id; - if (!_verify_synchronizer(p_peer, sync, net_id)) { - continue; - } + uint64_t last_usec = p_last_watch_usecs.has(oid) ? p_last_watch_usecs[oid] : 0; uint64_t indexes; List delta = sync->get_delta_state(p_usec, last_usec, indexes); @@ -721,6 +718,11 @@ void SceneReplicationInterface::_send_delta(int p_peer, const HashSet continue; // Nothing to update. } + uint32_t net_id; + if (!_verify_synchronizer(p_peer, sync, net_id)) { + continue; + } + Vector varp; varp.resize(delta.size()); const Variant **vptr = varp.ptrw();