mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 06:25:59 -07:00
use timeGetTime() for random seed instead of time() on windows
This commit is contained in:
parent
2c413b2353
commit
65f71f82b8
1 changed files with 6 additions and 2 deletions
8
host.c
8
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;
|
||||
|
|
Loading…
Reference in a new issue