- Timestamp:
- 05/29/11 22:57:28 (14 years ago)
- Location:
- ps/trunk
- Files:
-
- 1 added
- 12 edited
-
build/premake/extern_libs.lua (modified) (2 diffs)
-
build/premake/premake.lua (modified) (1 diff)
-
build/workspaces/update-workspaces.sh (modified) (2 diffs)
-
libraries/enet/build.sh (added)
-
libraries/enet/include/enet/callbacks.h (modified) (2 diffs)
-
libraries/enet/include/enet/enet.h (modified) (17 diffs)
-
libraries/enet/include/enet/list.h (modified) (1 diff)
-
libraries/enet/include/enet/protocol.h (modified) (7 diffs)
-
libraries/enet/include/enet/unix.h (modified) (2 diffs)
-
libraries/enet/include/enet/win32.h (modified) (2 diffs)
-
source/lib/external_libraries/enet.h (modified) (2 diffs)
-
source/network/NetServer.cpp (modified) (2 diffs)
-
source/network/NetSession.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/build/premake/extern_libs.lua
r8941 r9574 20 20 extern_lib == "fcollada" or 21 21 extern_lib == "valgrind" or 22 (extern_lib == "enet" and not options["with-system-enet"]) or 22 23 (extern_lib == "nvtt" and not options["with-system-nvtt"]) 23 24 then … … 100 101 unix_names = { "dl" }, 101 102 }, 102 -- rationale: see libraries_dir..enet/lib/rationale.txt103 103 enet = { 104 add_func = function() 105 if OS == "windows" then 106 tinsert(package.includepaths, libraries_dir.."enet/include") 107 tinsert(package.config["Debug" ].libpaths, libraries_dir.."enet/lib/debug") 108 tinsert(package.config["Testing"].libpaths, libraries_dir.."enet/lib/debug") 109 tinsert(package.config["Release"].libpaths, libraries_dir.."enet/lib/release") 110 tinsert(package.config["Debug" ].links, "enet_dbg") 111 tinsert(package.config["Testing"].links, "enet_dbg") 112 tinsert(package.config["Release"].links, "enet") 113 else 114 -- We should be using pkgconfig, but (at least on ubuntu) that adds /usr/include/enet which contains a time.h that gets used before the system header... 115 tinsert(package.links, "enet") 116 end 117 end, 104 win_names = { "enet" }, 105 unix_names = { "enet" }, 118 106 }, 119 107 fcollada = { -
ps/trunk/build/premake/premake.lua
r9570 r9574 7 7 addoption("without-tests", "Disable generation of test projects") 8 8 addoption("without-pch", "Disable generation and usage of precompiled headers") 9 addoption("with-system-nvtt", "Search standard paths for nvidia-texture-tools library, instead of using bundled copy") 9 addoption("with-system-nvtt", "Search standard paths for the nvidia-texture-tools library, instead of using bundled copy") 10 addoption("with-system-enet", "Search standard paths for libenet, instead of using bundled copy") 10 11 addoption("bindir", "Directory for executables (typically '/usr/games'); default is to be relocatable") 11 12 addoption("datadir", "Directory for data files (typically '/usr/share/games/0ad'); default is ../data/ relative to executable") -
ps/trunk/build/workspaces/update-workspaces.sh
r9418 r9574 9 9 JOBS=${JOBS:="-j2"} 10 10 11 # Parse command-line options 11 12 with_system_nvtt=false 13 with_system_enet=false 12 14 for i in "$@" 13 15 do 14 16 case $i in 15 17 --with-system-nvtt ) with_system_nvtt=true ;; 18 --with-system-enet ) with_system_enet=true ;; 16 19 -j* ) JOBS=$i ;; 17 20 esac … … 33 36 fi 34 37 echo 38 if [ "$with_system_enet" = "false" ]; then 39 (cd ../../libraries/enet && JOBS=${JOBS} ./build.sh) || die "ENet build failed" 40 fi 41 echo 35 42 36 43 # Make sure workspaces/gcc exists. -
ps/trunk/libraries/enet/include/enet/callbacks.h
r6134 r9574 8 8 #include <stdlib.h> 9 9 10 typedef struct 10 typedef struct _ENetCallbacks 11 11 { 12 12 void * (ENET_CALLBACK * malloc) (size_t size); 13 13 void (ENET_CALLBACK * free) (void * memory); 14 int (ENET_CALLBACK * rand) (void);14 void (ENET_CALLBACK * no_memory) (void); 15 15 } ENetCallbacks; 16 16 … … 21 21 extern void * enet_malloc (size_t); 22 22 extern void enet_free (void *); 23 extern int enet_rand (void);24 23 25 24 /** @} */ -
ps/trunk/libraries/enet/include/enet/enet.h
r6146 r9574 13 13 #include <stdlib.h> 14 14 15 #ifdef _WIN3215 #ifdef WIN32 16 16 #include "enet/win32.h" 17 17 #else … … 24 24 #include "enet/callbacks.h" 25 25 26 typedef enum 27 { 28 ENET_VERSION = 1 29 } ENetVersion; 30 31 typedef enum 26 #define ENET_VERSION_MAJOR 1 27 #define ENET_VERSION_MINOR 3 28 #define ENET_VERSION_PATCH 1 29 #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) 30 #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) 31 32 typedef enet_uint32 ENetVersion; 33 34 typedef enum _ENetSocketType 32 35 { 33 36 ENET_SOCKET_TYPE_STREAM = 1, … … 35 38 } ENetSocketType; 36 39 37 typedef enum 40 typedef enum _ENetSocketWait 38 41 { 39 42 ENET_SOCKET_WAIT_NONE = 0, … … 42 45 } ENetSocketWait; 43 46 44 typedef enum 47 typedef enum _ENetSocketOption 45 48 { 46 49 ENET_SOCKOPT_NONBLOCK = 1, 47 50 ENET_SOCKOPT_BROADCAST = 2, 48 51 ENET_SOCKOPT_RCVBUF = 3, 49 ENET_SOCKOPT_SNDBUF = 4 52 ENET_SOCKOPT_SNDBUF = 4, 53 ENET_SOCKOPT_REUSEADDR = 5 50 54 } ENetSocketOption; 51 55 … … 83 87 @sa ENetPacket 84 88 */ 85 typedef enum 89 typedef enum _ENetPacketFlag 86 90 { 87 91 /** packet must be received by the target peer and resend attempts should be … … 161 165 } ENetIncomingCommand; 162 166 163 typedef enum 167 typedef enum _ENetPeerState 164 168 { 165 169 ENET_PEER_STATE_DISCONNECTED = 0, … … 226 230 typedef struct _ENetPeer 227 231 { 232 ENetListNode dispatchList; 228 233 struct _ENetHost * host; 229 234 enet_uint16 outgoingPeerID; 230 235 enet_uint16 incomingPeerID; 231 enet_uint32 sessionID; 236 enet_uint32 connectID; 237 enet_uint8 outgoingSessionID; 238 enet_uint8 incomingSessionID; 232 239 ENetAddress address; /**< Internet address of the peer */ 233 240 void * data; /**< Application private data, may be freely modified */ … … 263 270 enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */ 264 271 enet_uint32 roundTripTimeVariance; 265 enet_uint 16mtu;272 enet_uint32 mtu; 266 273 enet_uint32 windowSize; 267 274 enet_uint32 reliableDataInTransit; … … 272 279 ENetList outgoingReliableCommands; 273 280 ENetList outgoingUnreliableCommands; 281 ENetList dispatchedCommands; 282 int needsDispatch; 274 283 enet_uint16 incomingUnsequencedGroup; 275 284 enet_uint16 outgoingUnsequencedGroup; 276 285 enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; 277 enet_uint32 disconnectData;286 enet_uint32 eventData; 278 287 } ENetPeer; 279 288 289 /** An ENet packet compressor for compressing UDP packets before socket sends or receives. 290 */ 291 typedef struct _ENetCompressor 292 { 293 /** Context data for the compressor. Must be non-NULL. */ 294 void * context; 295 /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ 296 size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit); 297 /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ 298 size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); 299 /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */ 300 void (ENET_CALLBACK * destroy) (void * context); 301 } ENetCompressor; 302 303 /** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */ 304 typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount); 305 280 306 /** An ENet host for communicating with peers. 281 307 * 282 * No fields should be modified .308 * No fields should be modified unless otherwise stated. 283 309 284 310 @sa enet_host_create() … … 288 314 @sa enet_host_flush() 289 315 @sa enet_host_broadcast() 316 @sa enet_host_compress() 317 @sa enet_host_compress_with_range_coder() 318 @sa enet_host_channel_limit() 290 319 @sa enet_host_bandwidth_limit() 291 320 @sa enet_host_bandwidth_throttle() … … 293 322 typedef struct _ENetHost 294 323 { 295 ENetSocket socket; 296 ENetAddress address; /**< Internet address of the host */ 297 enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */ 298 enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */ 299 enet_uint32 bandwidthThrottleEpoch; 300 enet_uint32 mtu; 301 int recalculateBandwidthLimits; 302 ENetPeer * peers; /**< array of peers allocated for this host */ 303 size_t peerCount; /**< number of peers allocated for this host */ 304 enet_uint32 serviceTime; 305 ENetPeer * lastServicedPeer; 306 int continueSending; 307 size_t packetSize; 308 enet_uint16 headerFlags; 309 ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; 310 size_t commandCount; 311 ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; 312 size_t bufferCount; 313 ENetAddress receivedAddress; 314 enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU]; 315 size_t receivedDataLength; 324 ENetSocket socket; 325 ENetAddress address; /**< Internet address of the host */ 326 enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */ 327 enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */ 328 enet_uint32 bandwidthThrottleEpoch; 329 enet_uint32 mtu; 330 enet_uint32 randomSeed; 331 int recalculateBandwidthLimits; 332 ENetPeer * peers; /**< array of peers allocated for this host */ 333 size_t peerCount; /**< number of peers allocated for this host */ 334 size_t channelLimit; /**< maximum number of channels allowed for connected peers */ 335 enet_uint32 serviceTime; 336 ENetList dispatchQueue; 337 int continueSending; 338 size_t packetSize; 339 enet_uint16 headerFlags; 340 ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; 341 size_t commandCount; 342 ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; 343 size_t bufferCount; 344 ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */ 345 ENetCompressor compressor; 346 enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU]; 347 ENetAddress receivedAddress; 348 enet_uint8 * receivedData; 349 size_t receivedDataLength; 350 enet_uint32 totalSentData; /**< total data sent, user should reset to 0 as needed to prevent overflow */ 351 enet_uint32 totalSentPackets; /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */ 352 enet_uint32 totalReceivedData; /**< total data received, user should reset to 0 as needed to prevent overflow */ 353 enet_uint32 totalReceivedPackets; /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */ 316 354 } ENetHost; 317 355 … … 319 357 * An ENet event type, as specified in @ref ENetEvent. 320 358 */ 321 typedef enum 359 typedef enum _ENetEventType 322 360 { 323 361 /** no event occurred within the specified time limit */ … … 373 411 374 412 /** 375 Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. 413 Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored. 376 414 377 415 @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use … … 404 442 @{ 405 443 */ 406 ENET_API ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *); 444 ENET_API ENetSocket enet_socket_create (ENetSocketType); 445 ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); 446 ENET_API int enet_socket_listen (ENetSocket, int); 407 447 ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); 408 448 ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); … … 412 452 ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int); 413 453 ENET_API void enet_socket_destroy (ENetSocket); 454 ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32); 414 455 415 456 /** @} */ … … 455 496 extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t); 456 497 457 ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uint32, enet_uint32);498 ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32); 458 499 ENET_API void enet_host_destroy (ENetHost *); 459 ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t );500 ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32); 460 501 ENET_API int enet_host_check_events (ENetHost *, ENetEvent *); 461 502 ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32); 462 503 ENET_API void enet_host_flush (ENetHost *); 463 504 ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *); 505 ENET_API void enet_host_compress (ENetHost *, const ENetCompressor *); 506 ENET_API int enet_host_compress_with_range_coder (ENetHost * host); 507 ENET_API void enet_host_channel_limit (ENetHost *, size_t); 464 508 ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32); 465 509 extern void enet_host_bandwidth_throttle (ENetHost *); 466 510 467 511 ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *); 468 ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 );512 ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * channelID); 469 513 ENET_API void enet_peer_ping (ENetPeer *); 470 514 ENET_API void enet_peer_reset (ENetPeer *); … … 475 519 extern int enet_peer_throttle (ENetPeer *, enet_uint32); 476 520 extern void enet_peer_reset_queues (ENetPeer *); 521 extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *); 477 522 extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); 478 523 extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32); 479 524 extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16); 480 525 extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *); 526 extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *); 527 528 ENET_API void * enet_range_coder_create (void); 529 ENET_API void enet_range_coder_destroy (void *); 530 ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t); 531 ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t); 532 481 533 extern size_t enet_protocol_command_size (enet_uint8); 482 534 -
ps/trunk/libraries/enet/include/enet/list.h
r5603 r9574 25 25 extern ENetListIterator enet_list_insert (ENetListIterator, void *); 26 26 extern void * enet_list_remove (ENetListIterator); 27 extern ENetListIterator enet_list_move (ENetListIterator, void *, void *); 27 28 28 29 extern size_t enet_list_size (ENetList *); -
ps/trunk/libraries/enet/include/enet/protocol.h
r6134 r9574 17 17 ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1, 18 18 ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255, 19 ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x 7FFF19 ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xFFF 20 20 }; 21 21 22 typedef enum 22 typedef enum _ENetProtocolCommand 23 23 { 24 24 ENET_PROTOCOL_COMMAND_NONE = 0, … … 39 39 } ENetProtocolCommand; 40 40 41 typedef enum 41 typedef enum _ENetProtocolFlag 42 42 { 43 43 ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7), 44 44 ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6), 45 45 46 ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), 47 ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000 46 ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14), 47 ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), 48 ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME, 49 50 ENET_PROTOCOL_HEADER_SESSION_MASK = (3 << 12), 51 ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12 48 52 } ENetProtocolFlag; 49 53 50 typedef struct 54 #ifdef _MSC_VER_ 55 #pragma pack(push, 1) 56 #define ENET_PACKED 57 #elif defined(__GNUC__) 58 #define ENET_PACKED __attribute__ ((packed)) 59 #else 60 #define ENET_PACKED 61 #endif 62 63 typedef struct _ENetProtocolHeader 51 64 { 52 enet_uint32 checksum;53 65 enet_uint16 peerID; 54 66 enet_uint16 sentTime; 55 } EN etProtocolHeader;67 } ENET_PACKED ENetProtocolHeader; 56 68 57 typedef struct 69 typedef struct _ENetProtocolCommandHeader 58 70 { 59 71 enet_uint8 command; 60 72 enet_uint8 channelID; 61 73 enet_uint16 reliableSequenceNumber; 62 } EN etProtocolCommandHeader;74 } ENET_PACKED ENetProtocolCommandHeader; 63 75 64 typedef struct 76 typedef struct _ENetProtocolAcknowledge 65 77 { 66 78 ENetProtocolCommandHeader header; 67 79 enet_uint16 receivedReliableSequenceNumber; 68 80 enet_uint16 receivedSentTime; 69 } EN etProtocolAcknowledge;81 } ENET_PACKED ENetProtocolAcknowledge; 70 82 71 typedef struct 83 typedef struct _ENetProtocolConnect 72 84 { 73 85 ENetProtocolCommandHeader header; 74 86 enet_uint16 outgoingPeerID; 75 enet_uint16 mtu; 87 enet_uint8 incomingSessionID; 88 enet_uint8 outgoingSessionID; 89 enet_uint32 mtu; 76 90 enet_uint32 windowSize; 77 91 enet_uint32 channelCount; … … 81 95 enet_uint32 packetThrottleAcceleration; 82 96 enet_uint32 packetThrottleDeceleration; 83 enet_uint32 sessionID; 84 } ENetProtocolConnect; 97 enet_uint32 connectID; 98 enet_uint32 data; 99 } ENET_PACKED ENetProtocolConnect; 85 100 86 typedef struct 101 typedef struct _ENetProtocolVerifyConnect 87 102 { 88 103 ENetProtocolCommandHeader header; 89 104 enet_uint16 outgoingPeerID; 90 enet_uint16 mtu; 105 enet_uint8 incomingSessionID; 106 enet_uint8 outgoingSessionID; 107 enet_uint32 mtu; 91 108 enet_uint32 windowSize; 92 109 enet_uint32 channelCount; … … 96 113 enet_uint32 packetThrottleAcceleration; 97 114 enet_uint32 packetThrottleDeceleration; 98 } ENetProtocolVerifyConnect; 115 enet_uint32 connectID; 116 } ENET_PACKED ENetProtocolVerifyConnect; 99 117 100 typedef struct 118 typedef struct _ENetProtocolBandwidthLimit 101 119 { 102 120 ENetProtocolCommandHeader header; 103 121 enet_uint32 incomingBandwidth; 104 122 enet_uint32 outgoingBandwidth; 105 } EN etProtocolBandwidthLimit;123 } ENET_PACKED ENetProtocolBandwidthLimit; 106 124 107 typedef struct 125 typedef struct _ENetProtocolThrottleConfigure 108 126 { 109 127 ENetProtocolCommandHeader header; … … 111 129 enet_uint32 packetThrottleAcceleration; 112 130 enet_uint32 packetThrottleDeceleration; 113 } EN etProtocolThrottleConfigure;131 } ENET_PACKED ENetProtocolThrottleConfigure; 114 132 115 typedef struct 133 typedef struct _ENetProtocolDisconnect 116 134 { 117 135 ENetProtocolCommandHeader header; 118 136 enet_uint32 data; 119 } EN etProtocolDisconnect;137 } ENET_PACKED ENetProtocolDisconnect; 120 138 121 typedef struct 139 typedef struct _ENetProtocolPing 122 140 { 123 141 ENetProtocolCommandHeader header; 124 } EN etProtocolPing;142 } ENET_PACKED ENetProtocolPing; 125 143 126 typedef struct 144 typedef struct _ENetProtocolSendReliable 127 145 { 128 146 ENetProtocolCommandHeader header; 129 147 enet_uint16 dataLength; 130 } EN etProtocolSendReliable;148 } ENET_PACKED ENetProtocolSendReliable; 131 149 132 typedef struct 150 typedef struct _ENetProtocolSendUnreliable 133 151 { 134 152 ENetProtocolCommandHeader header; 135 153 enet_uint16 unreliableSequenceNumber; 136 154 enet_uint16 dataLength; 137 } EN etProtocolSendUnreliable;155 } ENET_PACKED ENetProtocolSendUnreliable; 138 156 139 typedef struct 157 typedef struct _ENetProtocolSendUnsequenced 140 158 { 141 159 ENetProtocolCommandHeader header; 142 160 enet_uint16 unsequencedGroup; 143 161 enet_uint16 dataLength; 144 } EN etProtocolSendUnsequenced;162 } ENET_PACKED ENetProtocolSendUnsequenced; 145 163 146 typedef struct 164 typedef struct _ENetProtocolSendFragment 147 165 { 148 166 ENetProtocolCommandHeader header; … … 153 171 enet_uint32 totalLength; 154 172 enet_uint32 fragmentOffset; 155 } EN etProtocolSendFragment;173 } ENET_PACKED ENetProtocolSendFragment; 156 174 157 typedef union 175 typedef union _ENetProtocol 158 176 { 159 177 ENetProtocolCommandHeader header; … … 169 187 ENetProtocolBandwidthLimit bandwidthLimit; 170 188 ENetProtocolThrottleConfigure throttleConfigure; 171 } ENetProtocol; 189 } ENET_PACKED ENetProtocol; 190 191 #ifdef _MSC_VER_ 192 #pragma pack(pop) 193 #endif 172 194 173 195 #endif /* __ENET_PROTOCOL_H__ */ -
ps/trunk/libraries/enet/include/enet/unix.h
r6134 r9574 7 7 8 8 #include <stdlib.h> 9 #include <sys/time.h> 9 10 #include <sys/types.h> 10 11 #include <netinet/in.h> 12 #include <unistd.h> 11 13 12 14 typedef int ENetSocket; … … 33 35 #define ENET_API extern 34 36 37 typedef fd_set ENetSocketSet; 38 39 #define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) 40 #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) 41 #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) 42 #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) 43 35 44 #endif /* __ENET_UNIX_H__ */ 36 45 -
ps/trunk/libraries/enet/include/enet/win32.h
r6146 r9574 14 14 15 15 #include <stdlib.h> 16 17 #if 018 16 #include <winsock2.h> 19 #else20 // When this header is included in Pyrogenesis, it needs to avoid pulling in the21 // standards Win32 headers (else there are conflicts), but we need to define a22 // couple of Win32-specific socket values so that ENet still compiles23 typedef uintptr_t SOCKET;24 #define INVALID_SOCKET (SOCKET)(~0)25 #endif26 17 27 18 typedef SOCKET ENetSocket; … … 56 47 #endif /* ENET_DLL */ 57 48 49 typedef fd_set ENetSocketSet; 50 51 #define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) 52 #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) 53 #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) 54 #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) 55 58 56 #endif /* __ENET_WIN32_H__ */ 59 57 -
ps/trunk/source/lib/external_libraries/enet.h
r7897 r9574 1 /* Copyright (c) 201 0Wildfire Games1 /* Copyright (c) 2011 Wildfire Games 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining … … 28 28 #define INCLUDED_ENET 29 29 30 #if OS_WIN 31 32 // enet/win32.h wants to include winsock2.h which causes conflicts. 33 // provide some required definitions from winsock.h, then pretend 34 // we already included winsock.h 35 36 typedef uintptr_t SOCKET; 37 #define INVALID_SOCKET (SOCKET)(~0) 38 struct fd_set; 39 40 #define _WINSOCK2API_ // winsock2.h include guard 41 42 #define WIN32 43 44 #endif // OS_WIN 45 30 46 #include <enet/enet.h> 31 47 32 #if defined(ENET_VERSION_MAJOR) && (ENET_VERSION_MAJOR > 1 || ENET_VERSION_MINOR > 2)33 #error The game currently requires ENet 1. 2.x. You are using a newer version, which\34 has an incompatible API and network protocol. Please switch to a n older version.48 #if defined(ENET_VERSION_MAJOR) && !(ENET_VERSION_MAJOR > 1 || ENET_VERSION_MINOR > 2) 49 #error The game currently requires ENet 1.3.x. You are using a newer older, which\ 50 has an incompatible API and network protocol. Please switch to a newer version. 35 51 #endif 36 52 -
ps/trunk/source/network/NetServer.cpp
r9362 r9574 35 35 #define MAX_CLIENTS 8 36 36 37 static const int CHANNEL_COUNT = 1; 38 37 39 /** 38 40 * enet_host_service timeout (msecs). … … 115 117 116 118 // Create ENet server 117 m_Host = enet_host_create(&addr, MAX_CLIENTS, 0, 0);119 m_Host = enet_host_create(&addr, MAX_CLIENTS, CHANNEL_COUNT, 0, 0); 118 120 if (!m_Host) 119 121 { -
ps/trunk/source/network/NetSession.cpp
r9362 r9574 54 54 55 55 // Create ENet host 56 ENetHost* host = enet_host_create(NULL, 1, 0, 0);56 ENetHost* host = enet_host_create(NULL, 1, CHANNEL_COUNT, 0, 0); 57 57 if (!host) 58 58 return false; … … 65 65 66 66 // Initiate connection to server 67 ENetPeer* peer = enet_host_connect(host, &addr, CHANNEL_COUNT );67 ENetPeer* peer = enet_host_connect(host, &addr, CHANNEL_COUNT, 0); 68 68 if (!peer) 69 69 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
