From 9f15696acc69042400e18be55149ca96d1aecb3c Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Fri, 5 Apr 2002 09:34:39 +0000 Subject: [PATCH] MSG_Read functions are never used inside if's anymore (this fixes some problems with MSVC) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1713 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 9 ++++++--- net_dgrm.c | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 3a821a2c..a4ec9d37 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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) diff --git a/net_dgrm.c b/net_dgrm.c index e1963ae7..e609b552 100644 --- a/net_dgrm.c +++ b/net_dgrm.c @@ -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; -- 2.39.2