From 1381af62b1e013c447a92fc1ef2a79e77443bce5 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 22 Jun 2003 10:31:36 +0000 Subject: [PATCH] initialize the various server properties when parsing an infoResponse incase some are not set git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3095 d7cf8633-e32d-0410-b094-e92efae38249 --- netconn.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/netconn.c b/netconn.c index 75677c4f..439aa7ce 100755 --- a/netconn.c +++ b/netconn.c @@ -560,14 +560,13 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, else hostCacheCount++; } - c = -1; - if ((s = SearchInfostring(string, "gamename" )) != NULL) strncpy(game, s, sizeof(game) - 1); - if ((s = SearchInfostring(string, "modname" )) != NULL) strncpy(mod , s, sizeof(mod ) - 1); - if ((s = SearchInfostring(string, "mapname" )) != NULL) strncpy(map , s, sizeof(map ) - 1); - if ((s = SearchInfostring(string, "hostname" )) != NULL) strncpy(name, s, sizeof(name) - 1); - if ((s = SearchInfostring(string, "protocol" )) != NULL) c = atoi(s); - if ((s = SearchInfostring(string, "clients" )) != NULL) users = atoi(s); - if ((s = SearchInfostring(string, "sv_maxclients")) != NULL) maxusers = atoi(s); + if ((s = SearchInfostring(string, "gamename" )) != NULL) strncpy(game, s, sizeof(game) - 1);else game[0] = 0; + if ((s = SearchInfostring(string, "modname" )) != NULL) strncpy(mod , s, sizeof(mod ) - 1);else mod[0] = 0; + if ((s = SearchInfostring(string, "mapname" )) != NULL) strncpy(map , s, sizeof(map ) - 1);else map[0] = 0; + if ((s = SearchInfostring(string, "hostname" )) != NULL) strncpy(name, s, sizeof(name) - 1);else name[0] = 0; + if ((s = SearchInfostring(string, "protocol" )) != NULL) c = atoi(s);else c = -1; + if ((s = SearchInfostring(string, "clients" )) != NULL) users = atoi(s);else users = 0; + if ((s = SearchInfostring(string, "sv_maxclients")) != NULL) maxusers = atoi(s);else maxusers = 0; pingtime = 9999; for (i = 0;i < HOSTCACHESIZE;i++) if (!LHNETADDRESS_Compare(peeraddress, &pingcache[i].peeraddress)) -- 2.39.2