summaryrefslogtreecommitdiff
path: root/scene/main/scene_tree.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-05-08 10:51:04 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-05-08 10:51:04 +0200
commit234914c42ceebfb3c8d05b9071248cdd993b673b (patch)
treedb5ad3ab6e7681935b8582d995e15134d8ec70b9 /scene/main/scene_tree.cpp
parentde9683b6059ed709441f28c42757de311cb409bb (diff)
Rename multiplayer_api to just multiplayer.
Only the class name retain the MultiplayerAPI name
Diffstat (limited to 'scene/main/scene_tree.cpp')
-rw-r--r--scene/main/scene_tree.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 011087b487..607dbebf6c 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -485,7 +485,7 @@ bool SceneTree::idle(float p_time) {
idle_process_time = p_time;
- multiplayer_api->poll();
+ multiplayer->poll();
emit_signal("idle_frame");
@@ -1668,70 +1668,70 @@ void SceneTree::_server_disconnected() {
emit_signal("server_disconnected");
}
-Ref<MultiplayerAPI> SceneTree::get_multiplayer_api() const {
- return multiplayer_api;
+Ref<MultiplayerAPI> SceneTree::get_multiplayer() const {
+ return multiplayer;
}
-void SceneTree::set_multiplayer_api(Ref<MultiplayerAPI> p_multiplayer_api) {
- ERR_FAIL_COND(!p_multiplayer_api.is_valid());
+void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
+ ERR_FAIL_COND(!p_multiplayer.is_valid());
- if (multiplayer_api.is_valid()) {
- multiplayer_api->disconnect("network_peer_connected", this, "_network_peer_connected");
- multiplayer_api->disconnect("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer_api->disconnect("connected_to_server", this, "_connected_to_server");
- multiplayer_api->disconnect("connection_failed", this, "_connection_failed");
- multiplayer_api->disconnect("server_disconnected", this, "_server_disconnected");
+ if (multiplayer.is_valid()) {
+ multiplayer->disconnect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->disconnect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->disconnect("connected_to_server", this, "_connected_to_server");
+ multiplayer->disconnect("connection_failed", this, "_connection_failed");
+ multiplayer->disconnect("server_disconnected", this, "_server_disconnected");
}
- multiplayer_api = p_multiplayer_api;
- multiplayer_api->set_root_node(root);
+ multiplayer = p_multiplayer;
+ multiplayer->set_root_node(root);
- multiplayer_api->connect("network_peer_connected", this, "_network_peer_connected");
- multiplayer_api->connect("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer_api->connect("connected_to_server", this, "_connected_to_server");
- multiplayer_api->connect("connection_failed", this, "_connection_failed");
- multiplayer_api->connect("server_disconnected", this, "_server_disconnected");
+ multiplayer->connect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->connect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->connect("connected_to_server", this, "_connected_to_server");
+ multiplayer->connect("connection_failed", this, "_connection_failed");
+ multiplayer->connect("server_disconnected", this, "_server_disconnected");
}
void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) {
- multiplayer_api->set_network_peer(p_network_peer);
+ multiplayer->set_network_peer(p_network_peer);
}
Ref<NetworkedMultiplayerPeer> SceneTree::get_network_peer() const {
- return multiplayer_api->get_network_peer();
+ return multiplayer->get_network_peer();
}
bool SceneTree::is_network_server() const {
- return multiplayer_api->is_network_server();
+ return multiplayer->is_network_server();
}
bool SceneTree::has_network_peer() const {
- return multiplayer_api->has_network_peer();
+ return multiplayer->has_network_peer();
}
int SceneTree::get_network_unique_id() const {
- return multiplayer_api->get_network_unique_id();
+ return multiplayer->get_network_unique_id();
}
Vector<int> SceneTree::get_network_connected_peers() const {
- return multiplayer_api->get_network_connected_peers();
+ return multiplayer->get_network_connected_peers();
}
int SceneTree::get_rpc_sender_id() const {
- return multiplayer_api->get_rpc_sender_id();
+ return multiplayer->get_rpc_sender_id();
}
void SceneTree::set_refuse_new_network_connections(bool p_refuse) {
- multiplayer_api->set_refuse_new_network_connections(p_refuse);
+ multiplayer->set_refuse_new_network_connections(p_refuse);
}
bool SceneTree::is_refusing_new_network_connections() const {
- return multiplayer_api->is_refusing_new_network_connections();
+ return multiplayer->is_refusing_new_network_connections();
}
void SceneTree::_bind_methods() {
@@ -1800,8 +1800,8 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene);
- ClassDB::bind_method(D_METHOD("set_multiplayer_api", "multiplayer_api"), &SceneTree::set_multiplayer_api);
- ClassDB::bind_method(D_METHOD("get_multiplayer_api"), &SceneTree::get_multiplayer_api);
+ ClassDB::bind_method(D_METHOD("set_multiplayer", "multiplayer"), &SceneTree::set_multiplayer);
+ ClassDB::bind_method(D_METHOD("get_multiplayer"), &SceneTree::get_multiplayer);
ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer);
ClassDB::bind_method(D_METHOD("get_network_peer"), &SceneTree::get_network_peer);
ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server);
@@ -1829,7 +1829,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer_api", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_multiplayer_api", "get_multiplayer_api");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_multiplayer", "get_multiplayer");
ADD_SIGNAL(MethodInfo("tree_changed"));
ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node")));
@@ -1934,7 +1934,7 @@ SceneTree::SceneTree() {
root->set_world(Ref<World>(memnew(World)));
// Initialize network state
- set_multiplayer_api(Ref<MultiplayerAPI>(memnew(MultiplayerAPI)));
+ set_multiplayer(Ref<MultiplayerAPI>(memnew(MultiplayerAPI)));
//root->set_world_2d( Ref<World2D>( memnew( World2D )));
root->set_as_audio_listener(true);