aboutsummaryrefslogtreecommitdiffhomepage
path: root/host.c
diff options
context:
space:
mode:
authorLee Salzman <[email protected]>2012-12-14 05:10:13 +0200
committerLee Salzman <[email protected]>2012-12-14 05:10:13 +0200
commit65f71f82b80d3614d4ffb09bb73f6d2b57ac7eec (patch)
tree5eb1ecdcb195a9b3ae8f60149958cb28b3f14f91 /host.c
parent2c413b2353aa253dab55744f2594a2d13030c775 (diff)
downloadenet-65f71f82b80d3614d4ffb09bb73f6d2b57ac7eec.tar.gz
enet-65f71f82b80d3614d4ffb09bb73f6d2b57ac7eec.zip
use timeGetTime() for random seed instead of time() on windows
Diffstat (limited to 'host.c')
-rw-r--r--host.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/host.c b/host.c
index a3317c3..d0ee595 100644
--- a/host.c
+++ b/host.c
@@ -3,7 +3,6 @@
@brief ENet host management functions
*/
#define ENET_BUILDING_LIB 1
-#define __MINGW_USE_VC2005_COMPAT 1
#include <string.h>
#include <time.h>
#include "enet/enet.h"
@@ -76,7 +75,12 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT)
channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT;
- host -> randomSeed = (enet_uint32) time(NULL) + (enet_uint32) (size_t) host;
+ host -> randomSeed = (enet_uint32) (size_t) host;
+#ifdef WIN32
+ host -> randomSeed += (enet_uint32) timeGetTime();
+#else
+ host -> randomSeed += (enet_uint32) time(NULL);
+#endif
host -> randomSeed = (host -> randomSeed << 16) | (host -> randomSeed >> 16);
host -> channelLimit = channelLimit;
host -> incomingBandwidth = incomingBandwidth;