summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-09-25 17:43:18 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-09-25 17:45:28 +0200
commitf6e8579569ed1d92199be2853606195c1077d4ca (patch)
tree1c36e22a9e5002330ec2a0f073e6d47ba9535c99 /core/io
parent5adf7aa6b75d1ab566f4bd68c4dec3ca7c188306 (diff)
Skip RPC/RSET when MASTERSYNC and we are master.
Diffstat (limited to 'core/io')
-rw-r--r--core/io/multiplayer_api.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 5503b8d59c..923d0e42f3 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: {