Just in case, make QW sequence numbers unsigned too.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2015 21:25:53 +0000 (21:25 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2015 21:25:53 +0000 (21:25 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12173 d7cf8633-e32d-0410-b094-e92efae38249

client.h
netconn.c
netconn.h

index c074d23..d9facec 100644 (file)
--- a/client.h
+++ b/client.h
@@ -863,8 +863,8 @@ typedef struct client_static_s
        // value of "qport" cvar at time of connection
        int qw_qport;
        // copied from cls.netcon->qw. variables every time they change, or set by demos (which have no cls.netcon)
-       int qw_incoming_sequence;
-       int qw_outgoing_sequence;
+       unsigned int qw_incoming_sequence;
+       unsigned int qw_outgoing_sequence;
 
        // current file download buffer (only saved when file is completed)
        char qw_downloadname[MAX_QPATH];
@@ -1416,9 +1416,9 @@ typedef struct client_state_s
 
        float qw_weaponkick;
 
-       int qw_validsequence;
+       unsigned int qw_validsequence;
 
-       int qw_deltasequence[QW_UPDATE_BACKUP];
+       unsigned int qw_deltasequence[QW_UPDATE_BACKUP];
 
        // csqc stuff:
        // server entity number corresponding to a clientside entity
index aa4d5ba..9db3a47 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -764,9 +764,9 @@ int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolvers
                        sendreliable = true;
                }
                // outgoing unreliable packet number, and outgoing reliable packet number (0 or 1)
-               StoreLittleLong(sendbuffer, (unsigned int)conn->outgoing_unreliable_sequence | ((unsigned int)sendreliable<<31));
+               StoreLittleLong(sendbuffer, conn->outgoing_unreliable_sequence | (((unsigned int)sendreliable)<<31));
                // last received unreliable packet number, and last received reliable packet number (0 or 1)
-               StoreLittleLong(sendbuffer + 4, (unsigned int)conn->qw.incoming_sequence | ((unsigned int)conn->qw.incoming_reliable_sequence<<31));
+               StoreLittleLong(sendbuffer + 4, conn->qw.incoming_sequence | (((unsigned int)conn->qw.incoming_reliable_sequence)<<31));
                packetLen = 8;
                conn->outgoing_unreliable_sequence++;
                // client sends qport in every packet
@@ -1212,7 +1212,7 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s
 
        if (protocol == PROTOCOL_QUAKEWORLD)
        {
-               int sequence, sequence_ack;
+               unsigned int sequence, sequence_ack;
                int reliable_ack, reliable_message;
                int count;
                //int qport;
index fc13054..44ea477 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -197,14 +197,14 @@ typedef struct netconn_s
                int                     qport;
 
        // sequencing variables
-               int                     incoming_sequence;
-               int                     incoming_acknowledged;
-               int                     incoming_reliable_acknowledged; ///< single bit
+               unsigned int            incoming_sequence;
+               unsigned int            incoming_acknowledged;
+               qboolean                incoming_reliable_acknowledged; ///< single bit
 
-               int                     incoming_reliable_sequence;             ///< single bit, maintained local
+               qboolean                incoming_reliable_sequence;             ///< single bit, maintained local
 
-               int                     reliable_sequence;                      ///< single bit
-               int                     last_reliable_sequence;         ///< sequence number of last send
+               qboolean                reliable_sequence;                      ///< single bit
+               unsigned int            last_reliable_sequence;         ///< sequence number of last send
        }
        qw;