summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-05-09 01:41:01 +0200
committerGitHub <noreply@github.com>2018-05-09 01:41:01 +0200
commite744d12e568c22d2f260eee15fc9b2cade3dcdd8 (patch)
tree06c480ec011f817af8733a1208f20b7aa1fd391b /core
parent9a22a835f6527af3f2165ee048c875cd2ce6b2cf (diff)
parentdd546dc5b86e0bb9c397919fd8bfcf8e8460bc38 (diff)
Merge pull request #18709 from Faless/multiplayer_docs
Rename multiplayer_api to multiplayer, add docs
Diffstat (limited to 'core')
-rw-r--r--core/io/multiplayer_api.cpp40
-rw-r--r--core/io/multiplayer_api.h10
2 files changed, 25 insertions, 25 deletions
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index cbe7f87d92..0ede7e87cb 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -47,11 +47,11 @@ void MultiplayerAPI::set_root_node(Node *p_node) {
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
if (network_peer.is_valid()) {
- network_peer->disconnect("peer_connected", this, "add_peer");
- network_peer->disconnect("peer_disconnected", this, "del_peer");
- network_peer->disconnect("connection_succeeded", this, "connected_to_server");
- network_peer->disconnect("connection_failed", this, "connection_failed");
- network_peer->disconnect("server_disconnected", this, "server_disconnected");
+ network_peer->disconnect("peer_connected", this, "_add_peer");
+ network_peer->disconnect("peer_disconnected", this, "_del_peer");
+ network_peer->disconnect("connection_succeeded", this, "_connected_to_server");
+ network_peer->disconnect("connection_failed", this, "_connection_failed");
+ network_peer->disconnect("server_disconnected", this, "_server_disconnected");
clear();
}
@@ -61,11 +61,11 @@ void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_pee
ERR_FAIL_COND(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED);
if (network_peer.is_valid()) {
- network_peer->connect("peer_connected", this, "add_peer");
- network_peer->connect("peer_disconnected", this, "del_peer");
- network_peer->connect("connection_succeeded", this, "connected_to_server");
- network_peer->connect("connection_failed", this, "connection_failed");
- network_peer->connect("server_disconnected", this, "server_disconnected");
+ network_peer->connect("peer_connected", this, "_add_peer");
+ network_peer->connect("peer_disconnected", this, "_del_peer");
+ network_peer->connect("connection_succeeded", this, "_connected_to_server");
+ network_peer->connect("connection_failed", this, "_connection_failed");
+ network_peer->connect("server_disconnected", this, "_server_disconnected");
}
}
@@ -458,29 +458,29 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
}
}
-void MultiplayerAPI::add_peer(int p_id) {
+void MultiplayerAPI::_add_peer(int p_id) {
connected_peers.insert(p_id);
path_get_cache.insert(p_id, PathGetCache());
emit_signal("network_peer_connected", p_id);
}
-void MultiplayerAPI::del_peer(int p_id) {
+void MultiplayerAPI::_del_peer(int p_id) {
connected_peers.erase(p_id);
path_get_cache.erase(p_id); //I no longer need your cache, sorry
emit_signal("network_peer_disconnected", p_id);
}
-void MultiplayerAPI::connected_to_server() {
+void MultiplayerAPI::_connected_to_server() {
emit_signal("connected_to_server");
}
-void MultiplayerAPI::connection_failed() {
+void MultiplayerAPI::_connection_failed() {
emit_signal("connection_failed");
}
-void MultiplayerAPI::server_disconnected() {
+void MultiplayerAPI::_server_disconnected() {
emit_signal("server_disconnected");
}
@@ -691,15 +691,15 @@ void MultiplayerAPI::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_network_unique_id"), &MultiplayerAPI::get_network_unique_id);
ClassDB::bind_method(D_METHOD("is_network_server"), &MultiplayerAPI::is_network_server);
ClassDB::bind_method(D_METHOD("get_rpc_sender_id"), &MultiplayerAPI::get_rpc_sender_id);
- ClassDB::bind_method(D_METHOD("add_peer", "id"), &MultiplayerAPI::add_peer);
- ClassDB::bind_method(D_METHOD("del_peer", "id"), &MultiplayerAPI::del_peer);
+ ClassDB::bind_method(D_METHOD("_add_peer", "id"), &MultiplayerAPI::_add_peer);
+ ClassDB::bind_method(D_METHOD("_del_peer", "id"), &MultiplayerAPI::_del_peer);
ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &MultiplayerAPI::set_network_peer);
ClassDB::bind_method(D_METHOD("poll"), &MultiplayerAPI::poll);
ClassDB::bind_method(D_METHOD("clear"), &MultiplayerAPI::clear);
- ClassDB::bind_method(D_METHOD("connected_to_server"), &MultiplayerAPI::connected_to_server);
- ClassDB::bind_method(D_METHOD("connection_failed"), &MultiplayerAPI::connection_failed);
- ClassDB::bind_method(D_METHOD("server_disconnected"), &MultiplayerAPI::server_disconnected);
+ ClassDB::bind_method(D_METHOD("_connected_to_server"), &MultiplayerAPI::_connected_to_server);
+ ClassDB::bind_method(D_METHOD("_connection_failed"), &MultiplayerAPI::_connection_failed);
+ ClassDB::bind_method(D_METHOD("_server_disconnected"), &MultiplayerAPI::_server_disconnected);
ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &MultiplayerAPI::get_network_connected_peers);
ClassDB::bind_method(D_METHOD("set_refuse_new_network_connections", "refuse"), &MultiplayerAPI::set_refuse_new_network_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_network_connections"), &MultiplayerAPI::is_refusing_new_network_connections);
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index e7c6ffbea6..cc60890ced 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -66,11 +66,11 @@ public:
// Called by Node.rset
void rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value);
- void add_peer(int p_id);
- void del_peer(int p_id);
- void connected_to_server();
- void connection_failed();
- void server_disconnected();
+ void _add_peer(int p_id);
+ void _del_peer(int p_id);
+ void _connected_to_server();
+ void _connection_failed();
+ void _server_disconnected();
bool has_network_peer() const { return network_peer.is_valid(); }
Vector<int> get_network_connected_peers() const;