summaryrefslogtreecommitdiff
path: root/modules/enet
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-10-26 14:32:51 +0200
committerGitHub <noreply@github.com>2016-10-26 14:32:51 +0200
commitc67e3a485dedae96b82c3356d5f45ab0509d7759 (patch)
tree748ab44c8ec645a8eee950991210bf6c620651d1 /modules/enet
parentc7f9d853e206c15981330af46cfd0a0fc43fc5ef (diff)
parent80e911647c5df21c5b6a06876f1d48e21cd1f5fc (diff)
Merge pull request #6925 from godotengine/ipv6
Adding IPv6 support
Diffstat (limited to 'modules/enet')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index b4dfa9c62e..a82283591d 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -77,6 +77,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port, int p_in_bandwidth, int p_out_bandwidth){
ERR_FAIL_COND_V(active,ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(p_ip.type != IP_Address::TYPE_IPV4, ERR_INVALID_PARAMETER);
host = enet_host_create (NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
@@ -90,7 +91,7 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip, int p_port
_setup_compressor();
ENetAddress address;
- address.host=p_ip.host;
+ address.host=p_ip.field32[0];
address.port=p_port;
//enet_address_set_host (& address, "localhost");
@@ -149,7 +150,8 @@ void NetworkedMultiplayerENet::poll(){
}
IP_Address ip;
- ip.host=event.peer -> address.host;
+ ip.type = IP_Address::TYPE_IPV4;
+ ip.field32[0]=event.peer -> address.host;
int *new_id = memnew( int );
*new_id = event.data;
@@ -683,5 +685,6 @@ NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
// sets IP for ENet to bind when using create_server
// if no IP is set, then ENet bind to ENET_HOST_ANY
void NetworkedMultiplayerENet::set_bind_ip(const IP_Address& p_ip){
- bind_ip=p_ip.host;
+ ERR_FAIL_COND(p_ip.type != IP_Address::TYPE_IPV4);
+ bind_ip=p_ip.field32[0];
}