ignore maxservpings when using onlyconnected option

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4054 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-12-21 19:03:11 +00:00
parent d2e59d8971
commit 32a32ed224
+14 -2
View File
@@ -361,7 +361,19 @@ void pingservers(bool issearch, bool onlyconnected)
pingbuf[curpingbuf] = totalmillis;
putint(p, curpingbuf + 1); // offset by 1 to avoid extinfo trigger
int baselen = p.length();
if(searchlan < 2)
if(onlyconnected)
{
serverinfo *si = getconnectedserverinfo();
if(si)
{
p.len = baselen;
putint(p, si->getnames || issearch ? EXTPING_NAMELIST : EXTPING_NOP);
buf.data = ping;
buf.dataLength = p.length();
enet_socket_send(pingsock, &si->address, &buf, 1);
}
}
else if(searchlan < 2)
{
static int lastping = 0;
if(lastping >= servers.length()) lastping = 0;
@@ -369,7 +381,7 @@ void pingservers(bool issearch, bool onlyconnected)
{
serverinfo &si = *servers[lastping];
if(++lastping >= servers.length()) lastping = 0;
if(si.address.host == ENET_HOST_ANY || (onlyconnected && &si != getconnectedserverinfo())) continue;
if(si.address.host == ENET_HOST_ANY) continue;
p.len = baselen;
putint(p, si.getnames || issearch ? EXTPING_NAMELIST : EXTPING_NOP);
buf.data = ping;