summaryrefslogtreecommitdiff
path: root/scene/multiplayer/scene_rpc_interface.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-07-20 21:18:58 +0200
committerGitHub <noreply@github.com>2022-07-20 21:18:58 +0200
commit1cf7ebda501a1e0fe15d610bded7772324168b6e (patch)
tree102ff5f099b0e2ec99214849fe6c2f5ae96a1aa7 /scene/multiplayer/scene_rpc_interface.cpp
parente1c50152a034e9a6605d113ff6956206caad3a26 (diff)
parentddee5f605018c77e92378b525bd23ba32fb1263a (diff)
Merge pull request #62961 from Faless/mp/4.x_interest
Add peer visibility to MultiplayerSynchronizer.
Diffstat (limited to 'scene/multiplayer/scene_rpc_interface.cpp')
-rw-r--r--scene/multiplayer/scene_rpc_interface.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/scene/multiplayer/scene_rpc_interface.cpp b/scene/multiplayer/scene_rpc_interface.cpp
index 84700a82f3..144a10c665 100644
--- a/scene/multiplayer/scene_rpc_interface.cpp
+++ b/scene/multiplayer/scene_rpc_interface.cpp
@@ -302,12 +302,9 @@ void SceneRPCInterface::_send_rpc(Node *p_from, int p_to, uint16_t p_rpc_id, con
ERR_FAIL_MSG("Attempt to call RPC with unknown peer ID: " + itos(p_to) + ".");
}
- NodePath from_path = multiplayer->get_root_path().rel_path_to(p_from->get_path());
- ERR_FAIL_COND_MSG(from_path.is_empty(), "Unable to send RPC. Relative path is empty. THIS IS LIKELY A BUG IN THE ENGINE!");
-
// See if all peers have cached path (if so, call can be fast).
int psc_id;
- const bool has_all_peers = multiplayer->send_object_cache(p_from, from_path, p_to, psc_id);
+ const bool has_all_peers = multiplayer->send_object_cache(p_from, p_to, psc_id);
// Create base packet, lots of hardcode because it must be tight.
@@ -414,6 +411,7 @@ void SceneRPCInterface::_send_rpc(Node *p_from, int p_to, uint16_t p_rpc_id, con
// Not all verified path, so send one by one.
// Append path at the end, since we will need it for some packets.
+ NodePath from_path = multiplayer->get_root_path().rel_path_to(p_from->get_path());
CharString pname = String(from_path).utf8();
int path_len = encode_cstring(pname.get_data(), nullptr);
MAKE_ROOM(ofs + path_len);