From 01afc442c73661df677c2b93f4037a21992ee45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Feb 2020 18:28:45 +0100 Subject: Signals: Port connect calls to use callable_mp Remove now unnecessary bindings of signal callbacks in the public API. There might be some false positives that need rebinding if they were meant to be public. No regular expressions were harmed in the making of this commit. (Nah, just kidding.) --- scene/main/http_request.cpp | 4 +--- scene/main/scene_tree.cpp | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'scene/main') diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 85bde92851..fee2ada76d 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -539,8 +539,6 @@ void HTTPRequest::_bind_methods() { ClassDB::bind_method(D_METHOD("set_download_chunk_size"), &HTTPRequest::set_download_chunk_size); ClassDB::bind_method(D_METHOD("get_download_chunk_size"), &HTTPRequest::get_download_chunk_size); - ClassDB::bind_method(D_METHOD("_timeout"), &HTTPRequest::_timeout); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file"); ADD_PROPERTY(PropertyInfo(Variant::INT, "download_chunk_size", PROPERTY_HINT_RANGE, "256,16777216"), "set_download_chunk_size", "get_download_chunk_size"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads"); @@ -589,7 +587,7 @@ HTTPRequest::HTTPRequest() { timer = memnew(Timer); timer->set_one_shot(true); - timer->connect_compat("timeout", this, "_timeout"); + timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout)); add_child(timer); timeout = 0; } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index ed89b70d65..8f07e85b73 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1393,21 +1393,21 @@ void SceneTree::set_multiplayer(Ref p_multiplayer) { ERR_FAIL_COND(!p_multiplayer.is_valid()); if (multiplayer.is_valid()) { - multiplayer->disconnect_compat("network_peer_connected", this, "_network_peer_connected"); - multiplayer->disconnect_compat("network_peer_disconnected", this, "_network_peer_disconnected"); - multiplayer->disconnect_compat("connected_to_server", this, "_connected_to_server"); - multiplayer->disconnect_compat("connection_failed", this, "_connection_failed"); - multiplayer->disconnect_compat("server_disconnected", this, "_server_disconnected"); + multiplayer->disconnect("network_peer_connected", callable_mp(this, &SceneTree::_network_peer_connected)); + multiplayer->disconnect("network_peer_disconnected", callable_mp(this, &SceneTree::_network_peer_disconnected)); + multiplayer->disconnect("connected_to_server", callable_mp(this, &SceneTree::_connected_to_server)); + multiplayer->disconnect("connection_failed", callable_mp(this, &SceneTree::_connection_failed)); + multiplayer->disconnect("server_disconnected", callable_mp(this, &SceneTree::_server_disconnected)); } multiplayer = p_multiplayer; multiplayer->set_root_node(root); - multiplayer->connect_compat("network_peer_connected", this, "_network_peer_connected"); - multiplayer->connect_compat("network_peer_disconnected", this, "_network_peer_disconnected"); - multiplayer->connect_compat("connected_to_server", this, "_connected_to_server"); - multiplayer->connect_compat("connection_failed", this, "_connection_failed"); - multiplayer->connect_compat("server_disconnected", this, "_server_disconnected"); + multiplayer->connect("network_peer_connected", callable_mp(this, &SceneTree::_network_peer_connected)); + multiplayer->connect("network_peer_disconnected", callable_mp(this, &SceneTree::_network_peer_disconnected)); + multiplayer->connect("connected_to_server", callable_mp(this, &SceneTree::_connected_to_server)); + multiplayer->connect("connection_failed", callable_mp(this, &SceneTree::_connection_failed)); + multiplayer->connect("server_disconnected", callable_mp(this, &SceneTree::_server_disconnected)); } void SceneTree::set_network_peer(const Ref &p_network_peer) { @@ -1528,11 +1528,6 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rpc_sender_id"), &SceneTree::get_rpc_sender_id); ClassDB::bind_method(D_METHOD("set_refuse_new_network_connections", "refuse"), &SceneTree::set_refuse_new_network_connections); ClassDB::bind_method(D_METHOD("is_refusing_new_network_connections"), &SceneTree::is_refusing_new_network_connections); - ClassDB::bind_method(D_METHOD("_network_peer_connected"), &SceneTree::_network_peer_connected); - ClassDB::bind_method(D_METHOD("_network_peer_disconnected"), &SceneTree::_network_peer_disconnected); - ClassDB::bind_method(D_METHOD("_connected_to_server"), &SceneTree::_connected_to_server); - ClassDB::bind_method(D_METHOD("_connection_failed"), &SceneTree::_connection_failed); - ClassDB::bind_method(D_METHOD("_server_disconnected"), &SceneTree::_server_disconnected); ClassDB::bind_method(D_METHOD("set_use_font_oversampling", "enable"), &SceneTree::set_use_font_oversampling); ClassDB::bind_method(D_METHOD("is_using_font_oversampling"), &SceneTree::is_using_font_oversampling); -- cgit v1.2.3