summaryrefslogtreecommitdiff
path: root/modules/enet/networked_multiplayer_enet.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-08-14 18:49:50 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-08-14 18:49:50 -0300
commit3db36684b183adbec93cce9fe91182186e389e06 (patch)
treea324f3a336d1a77e7e3bd3d3bfc7258ccf8b06b5 /modules/enet/networked_multiplayer_enet.cpp
parent01bdfe1ff6033c012d0833ee165f6055fed69724 (diff)
Added high level networked multiplayer to Godot.
It's complete, but absolutely and completely untested, undocumented and NSFW. Have fun :-)
Diffstat (limited to 'modules/enet/networked_multiplayer_enet.cpp')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 64f08a90ef..aebdfe03a5 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -81,6 +81,8 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip,int p_port,
//technically safe to ignore the peer or anything else.
connection_status=CONNECTION_CONNECTING;
+ active=true;
+ server=false;
return OK;
}
@@ -144,7 +146,13 @@ void NetworkedMultiplayerENet::poll(){
}
}
-void NetworkedMultiplayerENet::disconnect() {
+bool NetworkedMultiplayerENet::is_server() const {
+ ERR_FAIL_COND_V(!active,false);
+
+ return server;
+}
+
+void NetworkedMultiplayerENet::close_connection() {
ERR_FAIL_COND(!active);
@@ -258,6 +266,6 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet(){
NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
if (active) {
- disconnect();
+ close_connection();
}
}