Browse Source

ENet code cleanup and changes from review.

Fabio Alessandrelli 8 years ago
parent
commit
0450e6539e

+ 0 - 7
modules/enet/networked_multiplayer_enet.cpp

@@ -163,13 +163,6 @@ void NetworkedMultiplayerENet::poll() {
 					break;
 					break;
 				}
 				}
 
 
-				IP_Address ip;
-#ifdef GODOT_ENET
-				ip.set_ipv6((uint8_t *)&(event.peer->address.host));
-#else
-				ip.set_ipv4((uint8_t *)&(event.peer->address.host));
-#endif
-
 				int *new_id = memnew(int);
 				int *new_id = memnew(int);
 				*new_id = event.data;
 				*new_id = event.data;
 
 

+ 3 - 1
thirdparty/README.md

@@ -22,8 +22,10 @@ Files extracted from upstream source:
 
 
 Important: enet.h, host.c, protocol.c have been slightly modified
 Important: enet.h, host.c, protocol.c have been slightly modified
 to be usable by godot socket implementation and allow IPv6.
 to be usable by godot socket implementation and allow IPv6.
-Two files (godot.cpp and enet/godot.h) has been added to provide
+Two files (godot.cpp and enet/godot.h) have been added to provide
 enet socket implementation using Godot classes.
 enet socket implementation using Godot classes.
+It is still possible to build against a system wide ENet but doing so
+will limit it's functionality to IPv4 only.
 Check the diff of enet.h, protocol.c, and host.c with the 1.3.13
 Check the diff of enet.h, protocol.c, and host.c with the 1.3.13
 tarball before the next update.
 tarball before the next update.
 
 

+ 29 - 0
thirdparty/enet/enet/godot.h

@@ -1,7 +1,36 @@
+/*************************************************************************/
+/*  godot.h                                                              */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
 /**
 /**
  @file  godot.h
  @file  godot.h
  @brief ENet Godot header
  @brief ENet Godot header
 */
 */
+
 #ifndef __ENET_GODOT_H__
 #ifndef __ENET_GODOT_H__
 #define __ENET_GODOT_H__
 #define __ENET_GODOT_H__
 
 

+ 29 - 1
thirdparty/enet/godot.cpp

@@ -1,5 +1,33 @@
+/*************************************************************************/
+/*  godot.cpp                                                            */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
 /**
 /**
- @file  godot.c
+ @file  godot.cpp
  @brief ENet Godot specific functions
  @brief ENet Godot specific functions
 */
 */