summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-08-14 14:06:51 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-08-14 14:07:23 -0300
commit01bdfe1ff6033c012d0833ee165f6055fed69724 (patch)
treec1a1d0125b2d1bec2f14e21b0fe58508b3aa0bcd /core/io
parentc21aae65b6bd85cecfa0efa484016787fc82f799 (diff)
Missing some bits, and added connection status.
Diffstat (limited to 'core/io')
-rw-r--r--core/io/networked_multiplayer_peer.cpp5
-rw-r--r--core/io/networked_multiplayer_peer.h10
2 files changed, 14 insertions, 1 deletions
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index f172fef570..851064b6e8 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -12,11 +12,16 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll );
+ ObjectTypeDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status );
BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE );
BIND_CONSTANT( TRANSFER_MODE_RELIABLE );
BIND_CONSTANT( TRANSFER_MODE_ORDERED );
+ BIND_CONSTANT( CONNECTION_DISCONNECTED );
+ BIND_CONSTANT( CONNECTION_CONNECTING );
+ BIND_CONSTANT( CONNECTION_CONNECTED );
+
ADD_SIGNAL( MethodInfo("peer_connected",PropertyInfo(Variant::STRING,"id")));
ADD_SIGNAL( MethodInfo("peer_disconnected",PropertyInfo(Variant::STRING,"id")));
}
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index 535f20f199..d8143b02c0 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -17,6 +17,12 @@ public:
TRANSFER_MODE_ORDERED
};
+ enum ConnectionStatus {
+ CONNECTION_DISCONNECTED,
+ CONNECTION_CONNECTING,
+ CONNECTION_CONNECTED,
+ };
+
virtual void set_transfer_mode(TransferMode p_mode)=0;
virtual void set_target_peer(const StringName& p_peer_id)=0;
@@ -26,12 +32,14 @@ public:
virtual StringName get_packet_peer() const=0;
virtual int get_packet_channel() const=0;
-
virtual void poll()=0;
+ virtual ConnectionStatus get_connection_status() const=0;
+
NetworkedMultiplayerPeer();
};
VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::TransferMode )
+VARIANT_ENUM_CAST( NetworkedMultiplayerPeer::ConnectionStatus )
#endif // NetworkedMultiplayerPeer_H