From f6e8579569ed1d92199be2853606195c1077d4ca Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Tue, 25 Sep 2018 17:43:18 +0200 Subject: [PATCH] Skip RPC/RSET when MASTERSYNC and we are master. --- core/io/multiplayer_api.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index 5503b8d59cc..923d0e42f39 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -38,20 +38,23 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas switch (mode) { case MultiplayerAPI::RPC_MODE_DISABLED: { - //do nothing + // Do nothing. } break; case MultiplayerAPI::RPC_MODE_REMOTE: { - //do nothing also, no need to call local + // Do nothing also. Remote cannot produce a local call. } break; + case MultiplayerAPI::RPC_MODE_MASTERSYNC: { + if (is_master) + r_skip_rpc = true; // I am the master, so skip remote call. + } // Do not break, fall over to other sync. case MultiplayerAPI::RPC_MODE_REMOTESYNC: - case MultiplayerAPI::RPC_MODE_MASTERSYNC: case MultiplayerAPI::RPC_MODE_PUPPETSYNC: { - //call it, sync always results in call + // Call it, sync always results in a local call. return true; } break; case MultiplayerAPI::RPC_MODE_MASTER: { if (is_master) - r_skip_rpc = true; //no other master so.. + r_skip_rpc = true; // I am the master, so skip remote call. return is_master; } break; case MultiplayerAPI::RPC_MODE_PUPPET: {