This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9574 for ps


Ignore:
Timestamp:
05/29/11 22:57:28 (14 years ago)
Author:
philip
Message:

Upgrade game and build system to ENet 1.3

Location:
ps/trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/build/premake/extern_libs.lua

    r8941 r9574  
    2020        extern_lib == "fcollada" or
    2121        extern_lib == "valgrind" or
     22        (extern_lib == "enet" and not options["with-system-enet"]) or
    2223        (extern_lib == "nvtt" and not options["with-system-nvtt"])
    2324    then
     
    100101        unix_names = { "dl" },
    101102    },
    102     -- rationale: see libraries_dir..enet/lib/rationale.txt
    103103    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" },
    118106    },
    119107    fcollada = {
  • ps/trunk/build/premake/premake.lua

    r9570 r9574  
    77addoption("without-tests", "Disable generation of test projects")
    88addoption("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")
     9addoption("with-system-nvtt", "Search standard paths for the nvidia-texture-tools library, instead of using bundled copy")
     10addoption("with-system-enet", "Search standard paths for libenet, instead of using bundled copy")
    1011addoption("bindir", "Directory for executables (typically '/usr/games'); default is to be relocatable")
    1112addoption("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  
    99JOBS=${JOBS:="-j2"}
    1010
     11# Parse command-line options
    1112with_system_nvtt=false
     13with_system_enet=false
    1214for i in "$@"
    1315do
    1416  case $i in
    1517    --with-system-nvtt ) with_system_nvtt=true ;;
     18    --with-system-enet ) with_system_enet=true ;;
    1619    -j* ) JOBS=$i ;;
    1720  esac
     
    3336fi
    3437echo
     38if [ "$with_system_enet" = "false" ]; then
     39  (cd ../../libraries/enet && JOBS=${JOBS} ./build.sh) || die "ENet build failed"
     40fi
     41echo
    3542
    3643# Make sure workspaces/gcc exists.
  • ps/trunk/libraries/enet/include/enet/callbacks.h

    r6134 r9574  
    88#include <stdlib.h>
    99
    10 typedef struct
     10typedef struct _ENetCallbacks
    1111{
    1212    void * (ENET_CALLBACK * malloc) (size_t size);
    1313    void (ENET_CALLBACK * free) (void * memory);
    14     int (ENET_CALLBACK * rand) (void);
     14    void (ENET_CALLBACK * no_memory) (void);
    1515} ENetCallbacks;
    1616
     
    2121extern void * enet_malloc (size_t);
    2222extern void   enet_free (void *);
    23 extern int    enet_rand (void);
    2423
    2524/** @} */
  • ps/trunk/libraries/enet/include/enet/enet.h

    r6146 r9574  
    1313#include <stdlib.h>
    1414
    15 #ifdef _WIN32
     15#ifdef WIN32
    1616#include "enet/win32.h"
    1717#else
     
    2424#include "enet/callbacks.h"
    2525
    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
     32typedef enet_uint32 ENetVersion;
     33
     34typedef enum _ENetSocketType
    3235{
    3336   ENET_SOCKET_TYPE_STREAM   = 1,
     
    3538} ENetSocketType;
    3639
    37 typedef enum
     40typedef enum _ENetSocketWait
    3841{
    3942   ENET_SOCKET_WAIT_NONE    = 0,
     
    4245} ENetSocketWait;
    4346
    44 typedef enum
     47typedef enum _ENetSocketOption
    4548{
    4649   ENET_SOCKOPT_NONBLOCK  = 1,
    4750   ENET_SOCKOPT_BROADCAST = 2,
    4851   ENET_SOCKOPT_RCVBUF    = 3,
    49    ENET_SOCKOPT_SNDBUF    = 4
     52   ENET_SOCKOPT_SNDBUF    = 4,
     53   ENET_SOCKOPT_REUSEADDR = 5
    5054} ENetSocketOption;
    5155
     
    8387   @sa ENetPacket
    8488*/
    85 typedef enum
     89typedef enum _ENetPacketFlag
    8690{
    8791   /** packet must be received by the target peer and resend attempts should be
     
    161165} ENetIncomingCommand;
    162166
    163 typedef enum
     167typedef enum _ENetPeerState
    164168{
    165169   ENET_PEER_STATE_DISCONNECTED                = 0,
     
    226230typedef struct _ENetPeer
    227231{
     232   ENetListNode  dispatchList;
    228233   struct _ENetHost * host;
    229234   enet_uint16   outgoingPeerID;
    230235   enet_uint16   incomingPeerID;
    231    enet_uint32   sessionID;
     236   enet_uint32   connectID;
     237   enet_uint8    outgoingSessionID;
     238   enet_uint8    incomingSessionID;
    232239   ENetAddress   address;            /**< Internet address of the peer */
    233240   void *        data;               /**< Application private data, may be freely modified */
     
    263270   enet_uint32   roundTripTime;            /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
    264271   enet_uint32   roundTripTimeVariance;
    265    enet_uint16   mtu;
     272   enet_uint32   mtu;
    266273   enet_uint32   windowSize;
    267274   enet_uint32   reliableDataInTransit;
     
    272279   ENetList      outgoingReliableCommands;
    273280   ENetList      outgoingUnreliableCommands;
     281   ENetList      dispatchedCommands;
     282   int           needsDispatch;
    274283   enet_uint16   incomingUnsequencedGroup;
    275284   enet_uint16   outgoingUnsequencedGroup;
    276285   enet_uint32   unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32];
    277    enet_uint32   disconnectData;
     286   enet_uint32   eventData;
    278287} ENetPeer;
    279288
     289/** An ENet packet compressor for compressing UDP packets before socket sends or receives.
     290 */
     291typedef 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] */
     304typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount);
     305 
    280306/** An ENet host for communicating with peers.
    281307  *
    282   * No fields should be modified.
     308  * No fields should be modified unless otherwise stated.
    283309
    284310    @sa enet_host_create()
     
    288314    @sa enet_host_flush()
    289315    @sa enet_host_broadcast()
     316    @sa enet_host_compress()
     317    @sa enet_host_compress_with_range_coder()
     318    @sa enet_host_channel_limit()
    290319    @sa enet_host_bandwidth_limit()
    291320    @sa enet_host_bandwidth_throttle()
     
    293322typedef struct _ENetHost
    294323{
    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 */
    316354} ENetHost;
    317355
     
    319357 * An ENet event type, as specified in @ref ENetEvent.
    320358 */
    321 typedef enum
     359typedef enum _ENetEventType
    322360{
    323361   /** no event occurred within the specified time limit */
     
    373411
    374412/**
    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.
    376414
    377415  @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
     
    404442    @{
    405443*/
    406 ENET_API ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *);
     444ENET_API ENetSocket enet_socket_create (ENetSocketType);
     445ENET_API int        enet_socket_bind (ENetSocket, const ENetAddress *);
     446ENET_API int        enet_socket_listen (ENetSocket, int);
    407447ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
    408448ENET_API int        enet_socket_connect (ENetSocket, const ENetAddress *);
     
    412452ENET_API int        enet_socket_set_option (ENetSocket, ENetSocketOption, int);
    413453ENET_API void       enet_socket_destroy (ENetSocket);
     454ENET_API int        enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
    414455
    415456/** @} */
     
    455496extern enet_uint32    enet_crc32 (const ENetBuffer *, size_t);
    456497               
    457 ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uint32, enet_uint32);
     498ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32);
    458499ENET_API void       enet_host_destroy (ENetHost *);
    459 ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t);
     500ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32);
    460501ENET_API int        enet_host_check_events (ENetHost *, ENetEvent *);
    461502ENET_API int        enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
    462503ENET_API void       enet_host_flush (ENetHost *);
    463504ENET_API void       enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
     505ENET_API void       enet_host_compress (ENetHost *, const ENetCompressor *);
     506ENET_API int        enet_host_compress_with_range_coder (ENetHost * host);
     507ENET_API void       enet_host_channel_limit (ENetHost *, size_t);
    464508ENET_API void       enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
    465509extern   void       enet_host_bandwidth_throttle (ENetHost *);
    466510
    467511ENET_API int                 enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
    468 ENET_API ENetPacket *        enet_peer_receive (ENetPeer *, enet_uint8);
     512ENET_API ENetPacket *        enet_peer_receive (ENetPeer *, enet_uint8 * channelID);
    469513ENET_API void                enet_peer_ping (ENetPeer *);
    470514ENET_API void                enet_peer_reset (ENetPeer *);
     
    475519extern int                   enet_peer_throttle (ENetPeer *, enet_uint32);
    476520extern void                  enet_peer_reset_queues (ENetPeer *);
     521extern void                  enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *);
    477522extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
    478523extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
    479524extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16);
    480 
     525extern void                  enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *);
     526extern void                  enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *);
     527
     528ENET_API void * enet_range_coder_create (void);
     529ENET_API void   enet_range_coder_destroy (void *);
     530ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t);
     531ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t);
     532   
    481533extern size_t enet_protocol_command_size (enet_uint8);
    482534
  • ps/trunk/libraries/enet/include/enet/list.h

    r5603 r9574  
    2525extern ENetListIterator enet_list_insert (ENetListIterator, void *);
    2626extern void * enet_list_remove (ENetListIterator);
     27extern ENetListIterator enet_list_move (ENetListIterator, void *, void *);
    2728
    2829extern size_t enet_list_size (ENetList *);
  • ps/trunk/libraries/enet/include/enet/protocol.h

    r6134 r9574  
    1717   ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT   = 1,
    1818   ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT   = 255,
    19    ENET_PROTOCOL_MAXIMUM_PEER_ID         = 0x7FFF
     19   ENET_PROTOCOL_MAXIMUM_PEER_ID         = 0xFFF
    2020};
    2121
    22 typedef enum
     22typedef enum _ENetProtocolCommand
    2323{
    2424   ENET_PROTOCOL_COMMAND_NONE               = 0,
     
    3939} ENetProtocolCommand;
    4040
    41 typedef enum
     41typedef enum _ENetProtocolFlag
    4242{
    4343   ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
    4444   ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
    4545
    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
    4852} ENetProtocolFlag;
    4953
    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
     63typedef struct _ENetProtocolHeader
    5164{
    52    enet_uint32 checksum;
    5365   enet_uint16 peerID;
    5466   enet_uint16 sentTime;
    55 } ENetProtocolHeader;
     67} ENET_PACKED ENetProtocolHeader;
    5668
    57 typedef struct
     69typedef struct _ENetProtocolCommandHeader
    5870{
    5971   enet_uint8 command;
    6072   enet_uint8 channelID;
    6173   enet_uint16 reliableSequenceNumber;
    62 } ENetProtocolCommandHeader;
     74} ENET_PACKED ENetProtocolCommandHeader;
    6375
    64 typedef struct
     76typedef struct _ENetProtocolAcknowledge
    6577{
    6678   ENetProtocolCommandHeader header;
    6779   enet_uint16 receivedReliableSequenceNumber;
    6880   enet_uint16 receivedSentTime;
    69 } ENetProtocolAcknowledge;
     81} ENET_PACKED ENetProtocolAcknowledge;
    7082
    71 typedef struct
     83typedef struct _ENetProtocolConnect
    7284{
    7385   ENetProtocolCommandHeader header;
    7486   enet_uint16 outgoingPeerID;
    75    enet_uint16 mtu;
     87   enet_uint8  incomingSessionID;
     88   enet_uint8  outgoingSessionID;
     89   enet_uint32 mtu;
    7690   enet_uint32 windowSize;
    7791   enet_uint32 channelCount;
     
    8195   enet_uint32 packetThrottleAcceleration;
    8296   enet_uint32 packetThrottleDeceleration;
    83    enet_uint32 sessionID;
    84 } ENetProtocolConnect;
     97   enet_uint32 connectID;
     98   enet_uint32 data;
     99} ENET_PACKED ENetProtocolConnect;
    85100
    86 typedef struct
     101typedef struct _ENetProtocolVerifyConnect
    87102{
    88103   ENetProtocolCommandHeader header;
    89104   enet_uint16 outgoingPeerID;
    90    enet_uint16 mtu;
     105   enet_uint8  incomingSessionID;
     106   enet_uint8  outgoingSessionID;
     107   enet_uint32 mtu;
    91108   enet_uint32 windowSize;
    92109   enet_uint32 channelCount;
     
    96113   enet_uint32 packetThrottleAcceleration;
    97114   enet_uint32 packetThrottleDeceleration;
    98 } ENetProtocolVerifyConnect;
     115   enet_uint32 connectID;
     116} ENET_PACKED ENetProtocolVerifyConnect;
    99117
    100 typedef struct
     118typedef struct _ENetProtocolBandwidthLimit
    101119{
    102120   ENetProtocolCommandHeader header;
    103121   enet_uint32 incomingBandwidth;
    104122   enet_uint32 outgoingBandwidth;
    105 } ENetProtocolBandwidthLimit;
     123} ENET_PACKED ENetProtocolBandwidthLimit;
    106124
    107 typedef struct
     125typedef struct _ENetProtocolThrottleConfigure
    108126{
    109127   ENetProtocolCommandHeader header;
     
    111129   enet_uint32 packetThrottleAcceleration;
    112130   enet_uint32 packetThrottleDeceleration;
    113 } ENetProtocolThrottleConfigure;
     131} ENET_PACKED ENetProtocolThrottleConfigure;
    114132
    115 typedef struct
     133typedef struct _ENetProtocolDisconnect
    116134{
    117135   ENetProtocolCommandHeader header;
    118136   enet_uint32 data;
    119 } ENetProtocolDisconnect;
     137} ENET_PACKED ENetProtocolDisconnect;
    120138
    121 typedef struct
     139typedef struct _ENetProtocolPing
    122140{
    123141   ENetProtocolCommandHeader header;
    124 } ENetProtocolPing;
     142} ENET_PACKED ENetProtocolPing;
    125143
    126 typedef struct
     144typedef struct _ENetProtocolSendReliable
    127145{
    128146   ENetProtocolCommandHeader header;
    129147   enet_uint16 dataLength;
    130 } ENetProtocolSendReliable;
     148} ENET_PACKED ENetProtocolSendReliable;
    131149
    132 typedef struct
     150typedef struct _ENetProtocolSendUnreliable
    133151{
    134152   ENetProtocolCommandHeader header;
    135153   enet_uint16 unreliableSequenceNumber;
    136154   enet_uint16 dataLength;
    137 } ENetProtocolSendUnreliable;
     155} ENET_PACKED ENetProtocolSendUnreliable;
    138156
    139 typedef struct
     157typedef struct _ENetProtocolSendUnsequenced
    140158{
    141159   ENetProtocolCommandHeader header;
    142160   enet_uint16 unsequencedGroup;
    143161   enet_uint16 dataLength;
    144 } ENetProtocolSendUnsequenced;
     162} ENET_PACKED ENetProtocolSendUnsequenced;
    145163
    146 typedef struct
     164typedef struct _ENetProtocolSendFragment
    147165{
    148166   ENetProtocolCommandHeader header;
     
    153171   enet_uint32 totalLength;
    154172   enet_uint32 fragmentOffset;
    155 } ENetProtocolSendFragment;
     173} ENET_PACKED ENetProtocolSendFragment;
    156174
    157 typedef union
     175typedef union _ENetProtocol
    158176{
    159177   ENetProtocolCommandHeader header;
     
    169187   ENetProtocolBandwidthLimit bandwidthLimit;
    170188   ENetProtocolThrottleConfigure throttleConfigure;
    171 } ENetProtocol;
     189} ENET_PACKED ENetProtocol;
     190
     191#ifdef _MSC_VER_
     192#pragma pack(pop)
     193#endif
    172194
    173195#endif /* __ENET_PROTOCOL_H__ */
  • ps/trunk/libraries/enet/include/enet/unix.h

    r6134 r9574  
    77
    88#include <stdlib.h>
     9#include <sys/time.h>
    910#include <sys/types.h>
    1011#include <netinet/in.h>
     12#include <unistd.h>
    1113
    1214typedef int ENetSocket;
     
    3335#define ENET_API extern
    3436
     37typedef 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   
    3544#endif /* __ENET_UNIX_H__ */
    3645
  • ps/trunk/libraries/enet/include/enet/win32.h

    r6146 r9574  
    1414
    1515#include <stdlib.h>
    16 
    17 #if 0
    1816#include <winsock2.h>
    19 #else
    20 // When this header is included in Pyrogenesis, it needs to avoid pulling in the
    21 // standards Win32 headers (else there are conflicts), but we need to define a
    22 // couple of Win32-specific socket values so that ENet still compiles
    23 typedef uintptr_t        SOCKET;
    24 #define INVALID_SOCKET  (SOCKET)(~0)
    25 #endif
    2617
    2718typedef SOCKET ENetSocket;
     
    5647#endif /* ENET_DLL */
    5748
     49typedef 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
    5856#endif /* __ENET_WIN32_H__ */
    5957
  • ps/trunk/source/lib/external_libraries/enet.h

    r7897 r9574  
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2011 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
     
    2828#define INCLUDED_ENET
    2929
     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
     36typedef uintptr_t SOCKET;
     37#define INVALID_SOCKET (SOCKET)(~0)
     38struct fd_set;
     39
     40#define _WINSOCK2API_   // winsock2.h include guard
     41
     42#define WIN32
     43
     44#endif  // OS_WIN
     45
    3046#include <enet/enet.h>
    3147
    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 an 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.
    3551#endif
    3652
  • ps/trunk/source/network/NetServer.cpp

    r9362 r9574  
    3535#define MAX_CLIENTS                 8
    3636
     37static const int CHANNEL_COUNT = 1;
     38
    3739/**
    3840 * enet_host_service timeout (msecs).
     
    115117
    116118    // 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);
    118120    if (!m_Host)
    119121    {
  • ps/trunk/source/network/NetSession.cpp

    r9362 r9574  
    5454
    5555    // 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);
    5757    if (!host)
    5858        return false;
     
    6565
    6666    // 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);
    6868    if (!peer)
    6969        return false;
Note: See TracChangeset for help on using the changeset viewer.