Example #1
0
void SearchLocalGames( void )
{
	int32_t		i;

	m_num_servers = 0;
	for (i=0 ; i<MAX_LOCAL_SERVERS ; i++)
		strcpy (local_server_names[i], NO_SERVER_STRING);

	Menu_DrawTextBox (168, 192, 36, 3);
	SCR_DrawString (188, 192+MENU_FONT_SIZE, ALIGN_CENTER, S_COLOR_ALT"Searching for local servers, this", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*2, ALIGN_CENTER, S_COLOR_ALT"could take up to a minute, so", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*3, ALIGN_CENTER, S_COLOR_ALT"please be patient.", 255);

	// the text box won't show up unless we do a buffer swap
	R_EndFrame();

	// send out info packets
	CL_PingServers_f();
}
Example #2
0
void CL_Serverlist2Packet (netadr_t net_from, sizebuf_t *net_message)
{
	static qboolean firstupdate = true;

	if (Q_streq(MSG_ReadString(net_message), "serverlist2"))
	{
		int num_servers, i, j;
		int ip[4], port;
		char szServer[256];

		// Wait until we get a server list response to clear the list.  We don't want to wipe somebody's list
		// if the server list server isn't responding.  Only clear the list once per run, as well (in case server sends multiple packets).
		if (firstupdate)
		{
			firstupdate = false;
			Serverlist_Clear_f();
		}

		num_servers = ntohl(MSG_ReadLong(net_message));

		for (i = 0; i < num_servers; ++i)
		{
			for (j = 0; j < 4; ++j)
			{
				ip[j] = MSG_ReadByte(net_message);

				if (ip[j] < 0)
				{
					assert(ip[j] >= 0);
					return; // end of packet -- corrupt or truncated, just bail out.  todo: handle > 164 servers.
				}
			}

			port = ntohs(MSG_ReadShort(net_message));
			Com_sprintf(szServer, sizeof(szServer), "%d.%d.%d.%d:%d", ip[0], ip[1], ip[2], ip[3], port);
			CL_AddServerlistServer(szServer);
		}

		CL_PingServers_f();
	}
}
Example #3
0
// color servers grey and re-ping them
void M_ServerlistRefresh_f (void)
{
	grey_serverlist();
	CL_PingServers_f();
}