Przeglądaj źródła

add enet_linked_version() for querying linked version

lsalzman 12 lat temu
rodzic
commit
27d41dd2ae
3 zmienionych plików z 17 dodań i 0 usunięć
  1. 2 0
      ChangeLog
  2. 6 0
      callbacks.c
  3. 9 0
      include/enet/enet.h

+ 2 - 0
ChangeLog

@@ -1,4 +1,6 @@
+* added enet_linked_version() for checking the linked version 
 * added enet_socket_get_address() for querying the local address of a socket
+* silenced some debugging prints unless ENET_DEBUG is defined during compilation
 
 ENet 1.3.7 (March 6, 2013):
 

+ 6 - 0
callbacks.c

@@ -27,6 +27,12 @@ enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits
 
    return enet_initialize ();
 }
+
+ENetVersion
+enet_linked_version (void)
+{
+    return ENET_VERSION;
+}
            
 void *
 enet_malloc (size_t size)

+ 9 - 0
include/enet/enet.h

@@ -27,6 +27,9 @@ extern "C"
 #define ENET_VERSION_MINOR 3
 #define ENET_VERSION_PATCH 7
 #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
+#define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF)
+#define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF)
+#define ENET_VERSION_GET_PATCH(version) ((version)&0xFF)
 #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
 
 typedef enet_uint32 ENetVersion;
@@ -452,6 +455,12 @@ ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCall
 */
 ENET_API void enet_deinitialize (void);
 
+/**
+  Gives the linked version of the ENet library.
+  @returns the version number 
+*/
+ENET_API ENetVersion enet_linked_version (void);
+
 /** @} */
 
 /** @defgroup private ENet private implementation functions */