From 1400f6fdc444650ebf37c83bb4164e25e641bab1 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sun, 13 May 2018 07:07:56 +0200 Subject: Refactor RPCMode enum and checks --- core/io/multiplayer_api.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/io/multiplayer_api.h') diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index 64f59d32d8..f9284a0bde 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -87,6 +87,15 @@ public: NETWORK_COMMAND_RAW, }; + enum RPCMode { + + RPC_MODE_DISABLED, // No rpc for this method, calls to this will be blocked (default) + RPC_MODE_REMOTE, // Using rpc() on it will call method / set property in all remote peers + RPC_MODE_SYNC, // Using rpc() on it will call method / set property in all remote peers and locally + RPC_MODE_MASTER, // Using rpc() on it will call method on wherever the master is, be it local or remote + RPC_MODE_SLAVE, // Using rpc() on it will call method for all slaves + }; + void poll(); void clear(); void set_root_node(Node *p_node); @@ -117,4 +126,6 @@ public: ~MultiplayerAPI(); }; +VARIANT_ENUM_CAST(MultiplayerAPI::RPCMode); + #endif // MULTIPLAYER_PROTOCOL_H -- cgit v1.2.3 From 4524153b6ece766e496d7b9c1a4f9216ea9e34cc Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sat, 26 May 2018 10:28:28 +0200 Subject: New sync RPC modes to match all combinations --- core/io/multiplayer_api.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/io/multiplayer_api.h') diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index f9284a0bde..ef56c4c7f2 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -94,6 +94,9 @@ public: RPC_MODE_SYNC, // Using rpc() on it will call method / set property in all remote peers and locally RPC_MODE_MASTER, // Using rpc() on it will call method on wherever the master is, be it local or remote RPC_MODE_SLAVE, // Using rpc() on it will call method for all slaves + RPC_MODE_REMOTESYNC, // Same as RPC_MODE_SYNC, compatibility + RPC_MODE_MASTERSYNC, // Using rpc() on it will call method / set property in the master peer and locally + RPC_MODE_SLAVESYNC, // Using rpc() on it will call method / set property in all slave peers and locally }; void poll(); -- cgit v1.2.3