]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
MSG_Read functions are never used inside if's anymore (this fixes some problems with...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 5 Apr 2002 09:34:39 +0000 (09:34 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 5 Apr 2002 09:34:39 +0000 (09:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1713 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
net_dgrm.c

index 3a821a2ce7e42f0e665311e2eeb68d12e264f3c9..a4ec9d37aa4b34bc4e6675bbf7b8a85ad66bd2eb 100644 (file)
@@ -182,7 +182,7 @@ void CL_ParseStartSoundPacket(int largesoundindex)
                pos[i] = MSG_ReadCoord ();
 
     S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
-}       
+}
 
 /*
 ==================
@@ -197,6 +197,7 @@ void CL_KeepaliveMessage (void)
        float   time;
        static float lastmsg;
        int             ret;
+       int             c;
        sizebuf_t       old;
        qbyte           olddata[8192];
        
@@ -222,7 +223,8 @@ void CL_KeepaliveMessage (void)
                        Host_Error ("CL_KeepaliveMessage: received a message");
                        break;
                case 2:
-                       if (MSG_ReadByte() != svc_nop)
+                       c = MSG_ReadByte();
+                       if (c != svc_nop)
                                Host_Error ("CL_KeepaliveMessage: datagram wasn't a nop");
                        break;
                }
@@ -615,7 +617,8 @@ void CL_ParseUpdate (int bits)
                int j = MSG_ReadFloat() * 255.0f;
                if (i == 2)
                {
-                       if (MSG_ReadFloat())
+                       i = MSG_ReadFloat();
+                       if (i)
                                new.effects |= EF_FULLBRIGHT;
                }
                if (j < 0)
index e1963ae70d26e8792f29ae940b2c34832dd0e865..e609b552188c3816e566825e3b6ecb26ef2762dc 100644 (file)
@@ -529,6 +529,7 @@ static void Test_Poll(void)
        int             frags;
        int             connectTime;
        qbyte   playerNumber;
+       int             c;
 
        net_landriverlevel = testDriver;
 
@@ -550,7 +551,8 @@ static void Test_Poll(void)
                if ((control & NETFLAG_LENGTH_MASK) != len)
                        break;
 
-               if (MSG_ReadByte() != CCREP_PLAYER_INFO)
+               c = MSG_ReadByte();
+               if (c != CCREP_PLAYER_INFO)
                        Sys_Error("Unexpected repsonse to Player Info request\n");
 
                playerNumber = MSG_ReadByte();
@@ -651,6 +653,7 @@ static void Test2_Poll(void)
        struct qsockaddr clientaddr;
        int             control;
        int             len;
+       int             c;
        char    name[256];
        char    value[256];
 
@@ -673,7 +676,8 @@ static void Test2_Poll(void)
        if ((control & NETFLAG_LENGTH_MASK) != len)
                goto Error;
 
-       if (MSG_ReadByte() != CCREP_RULE_INFO)
+       c = MSG_ReadByte();
+       if (c != CCREP_RULE_INFO)
                goto Error;
 
        strcpy(name, MSG_ReadString());
@@ -839,6 +843,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
        int                     command;
        int                     control;
        int                     ret;
+       int                     c;
 
        acceptsock = dfunc.CheckNewConnections();
        if (acceptsock == -1)
@@ -971,7 +976,8 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
        if (strcmp(MSG_ReadString(), "QUAKE") != 0)
                return NULL;
 
-       if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
+       c = MSG_ReadByte();
+       if (c != NET_PROTOCOL_VERSION)
        {
                SZ_Clear(&net_message);
                // save space for the header, filled in later
@@ -1108,6 +1114,7 @@ static void _Datagram_SearchForHosts (qboolean xmit)
        struct qsockaddr readaddr;
        struct qsockaddr myaddr;
        int             control;
+       int             c;
 
        dfunc.GetSocketAddr (dfunc.controlSock, &myaddr);
        if (xmit)
@@ -1147,7 +1154,8 @@ static void _Datagram_SearchForHosts (qboolean xmit)
                if ((control & NETFLAG_LENGTH_MASK) != ret)
                        continue;
 
-               if (MSG_ReadByte() != CCREP_SERVER_INFO)
+               c = MSG_ReadByte();
+               if (c != CCREP_SERVER_INFO)
                        continue;
 
                dfunc.GetAddrFromName(MSG_ReadString(), &readaddr);
@@ -1166,7 +1174,8 @@ static void _Datagram_SearchForHosts (qboolean xmit)
                strcpy(hostcache[n].map, MSG_ReadString());
                hostcache[n].users = MSG_ReadByte();
                hostcache[n].maxusers = MSG_ReadByte();
-               if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
+               c = MSG_ReadByte();
+               if (c != NET_PROTOCOL_VERSION)
                {
                        strcpy(hostcache[n].cname, hostcache[n].name);
                        hostcache[n].cname[14] = 0;