fixed issues with http masters in server browser, add http://www.gameaholic.com/servers/qspy-quakeworld to master list

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2031 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-02-26 09:37:55 +00:00
parent 2ec98a1e80
commit 10abb9d212
2 changed files with 52 additions and 11 deletions

View File

@ -12,7 +12,8 @@
//despite not supporting nq or q2, we still load them. We just filter them. This is to make sure we properly write the listing files.
enum {
MT_BAD, //this would be an error
MT_MASTERHTTP, //an http/ftp based master server
MT_MASTERHTTP, //an http/ftp based master server with NQ servers
MT_MASTERHTTPQW,//an http/ftp based master server with QW servers
MT_BCASTQW, //-1status
MT_BCASTQ2, //-1status
MT_BCASTQ3,

View File

@ -523,18 +523,24 @@ void Master_AddMaster (char *address, int type, char *description)
master = mast;
}
void Master_AddMasterHTTP (char *address, int servertype, char *description)
void Master_AddMasterHTTP (char *address, int mastertype, char *description)
{
master_t *mast;
int servertype;
if (mastertype == MT_MASTERHTTPQW)
servertype = 0;
else
servertype = SS_NETQUAKE;
for (mast = master; mast; mast = mast->next)
{
if (!strcmp(mast->address, address) && mast->type == MT_MASTERHTTP) //already exists.
if (!strcmp(mast->address, address) && mast->type == mastertype) //already exists.
return;
}
mast = Z_Malloc(sizeof(master_t)+strlen(description)+1+strlen(address)+1);
mast->address = mast->name + strlen(description)+1;
mast->type = MT_MASTERHTTP;
mast->type = mastertype;
mast->servertype = servertype;
strcpy(mast->name, description);
strcpy(mast->address, address);
@ -606,6 +612,10 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth)
servertype = MT_MASTERQ2;
else if (!strcmp(com_token, "master:q3"))
servertype = MT_MASTERQ3;
else if (!strcmp(com_token, "master:http"))
servertype = MT_MASTERHTTP;
else if (!strcmp(com_token, "master:httpqw"))
servertype = MT_MASTERHTTPQW;
else if (!strcmp(com_token, "master")) //any other sort of master, assume it's a qw master.
servertype = MT_MASTERQW;
@ -661,7 +671,18 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth)
Con_Printf("Failed to resolve address - \"%s\"\n", line);
}
else
Master_AddMaster(line, servertype, name);
{
switch (servertype)
{
case MT_MASTERHTTP:
case MT_MASTERHTTPQW:
Master_AddMasterHTTP(line, servertype, name);
break;
default:
Master_AddMaster(line, servertype, name);
}
}
}
VFS_CLOSE(f);
@ -933,7 +954,7 @@ void SListOptionChanged(serverinfo_t *newserver)
}
#ifdef WEBCLIENT
void MasterInfo_ProcessHTTP(char *name, qboolean success)
void MasterInfo_ProcessHTTP(char *name, qboolean success, int type)
{
netadr_t adr;
char *s;
@ -973,7 +994,7 @@ void MasterInfo_ProcessHTTP(char *name, qboolean success)
info = Z_Malloc(sizeof(serverinfo_t));
info->adr = adr;
info->sends = 1;
info->special = SS_NETQUAKE;
info->special = type;
info->refreshtime = 0;
sprintf(info->name, "%s", NET_AdrToString(info->adr));
@ -985,6 +1006,17 @@ void MasterInfo_ProcessHTTP(char *name, qboolean success)
FS_Remove(name, FS_GAME);
}
// wrapper functions for the different server types
void MasterInfo_ProcessHTTPNQ(char *name, qboolean success)
{
MasterInfo_ProcessHTTP(name, success, SS_NETQUAKE);
}
void MasterInfo_ProcessHTTPQW(char *name, qboolean success)
{
MasterInfo_ProcessHTTP(name, success, 0);
}
#endif
//don't try sending to servers we don't support
@ -1055,11 +1087,14 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles)
NET_SendPollPacket (6, "query", mast->adr);
break;
#endif
case MT_MASTERHTTP:
#ifdef WEBCLIENT
HTTP_CL_Get(mast->address, va("master_%i_%i.tmp", mastersequence++, mast->servertype), MasterInfo_ProcessHTTP);
#endif
case MT_MASTERHTTP:
HTTP_CL_Get(mast->address, va("master_%i_%i.tmp", mastersequence++, mast->servertype), MasterInfo_ProcessHTTPNQ);
break;
case MT_MASTERHTTPQW:
HTTP_CL_Get(mast->address, va("master_%i_%i.tmp", mastersequence++, mast->servertype), MasterInfo_ProcessHTTPQW);
break;
#endif
}
}
@ -1097,6 +1132,9 @@ void MasterInfo_WriteServers(void)
case MT_MASTERHTTP:
typename = "master:http";
break;
case MT_MASTERHTTPQW:
typename = "master:httpqw";
break;
case MT_BCASTQW:
typename = "bcast:qw";
break;
@ -1174,6 +1212,7 @@ void MasterInfo_Begin(void)
// if (q1servers) //qw master servers
{
Master_AddMasterHTTP("http://www.gameaholic.com/servers/qspy-quakeworld", MT_MASTERHTTPQW, "gameaholic's QW master");
Master_AddMaster("192.246.40.37:27000", MT_MASTERQW, "id Limbo");
Master_AddMaster("192.246.40.37:27002", MT_MASTERQW, "id CTF");
Master_AddMaster("192.246.40.37:27003", MT_MASTERQW, "id TeamFortress");
@ -1196,7 +1235,7 @@ void MasterInfo_Begin(void)
// if (q1servers) //nq master servers
{
Master_AddMasterHTTP("http://www.gameaholic.com/servers/qspy-quake",SS_NETQUAKE, "gameaholic's NQ master");
Master_AddMasterHTTP("http://www.gameaholic.com/servers/qspy-quake", MT_MASTERHTTP, "gameaholic's NQ master");
Master_AddMaster("255.255.255.255:26000", MT_BCASTNQ, "Nearby Quake1 servers");
Master_AddMaster("ghdigital.com:27950", MT_MASTERDP, "DarkPlaces Master 1");
@ -1220,6 +1259,7 @@ void MasterInfo_Begin(void)
}
}
for (mast = master; mast; mast=mast->next)
{
MasterInfo_Request(mast, false);