- Revamp in-game server browser: you can now scan for games on multiple master servers, while retaining compatibility with old QVMs.
- Make Master server reporting/server queries ipv6 capable.
This commit is contained in:
parent
75cfef1afb
commit
9a8cc99a93
8 changed files with 182 additions and 259 deletions
|
@ -50,19 +50,17 @@ LAN_LoadCachedServers
|
|||
void LAN_LoadCachedServers( void ) {
|
||||
int size;
|
||||
fileHandle_t fileIn;
|
||||
cls.numglobalservers = cls.nummplayerservers = cls.numfavoriteservers = 0;
|
||||
cls.numglobalservers = cls.numfavoriteservers = 0;
|
||||
cls.numGlobalServerAddresses = 0;
|
||||
if (FS_SV_FOpenFileRead("servercache.dat", &fileIn)) {
|
||||
FS_Read(&cls.numglobalservers, sizeof(int), fileIn);
|
||||
FS_Read(&cls.nummplayerservers, sizeof(int), fileIn);
|
||||
FS_Read(&cls.numfavoriteservers, sizeof(int), fileIn);
|
||||
FS_Read(&size, sizeof(int), fileIn);
|
||||
if (size == sizeof(cls.globalServers) + sizeof(cls.favoriteServers) + sizeof(cls.mplayerServers)) {
|
||||
if (size == sizeof(cls.globalServers) + sizeof(cls.favoriteServers)) {
|
||||
FS_Read(&cls.globalServers, sizeof(cls.globalServers), fileIn);
|
||||
FS_Read(&cls.mplayerServers, sizeof(cls.mplayerServers), fileIn);
|
||||
FS_Read(&cls.favoriteServers, sizeof(cls.favoriteServers), fileIn);
|
||||
} else {
|
||||
cls.numglobalservers = cls.nummplayerservers = cls.numfavoriteservers = 0;
|
||||
cls.numglobalservers = cls.numfavoriteservers = 0;
|
||||
cls.numGlobalServerAddresses = 0;
|
||||
}
|
||||
FS_FCloseFile(fileIn);
|
||||
|
@ -78,12 +76,10 @@ void LAN_SaveServersToCache( void ) {
|
|||
int size;
|
||||
fileHandle_t fileOut = FS_SV_FOpenFileWrite("servercache.dat");
|
||||
FS_Write(&cls.numglobalservers, sizeof(int), fileOut);
|
||||
FS_Write(&cls.nummplayerservers, sizeof(int), fileOut);
|
||||
FS_Write(&cls.numfavoriteservers, sizeof(int), fileOut);
|
||||
size = sizeof(cls.globalServers) + sizeof(cls.favoriteServers) + sizeof(cls.mplayerServers);
|
||||
size = sizeof(cls.globalServers) + sizeof(cls.favoriteServers);
|
||||
FS_Write(&size, sizeof(int), fileOut);
|
||||
FS_Write(&cls.globalServers, sizeof(cls.globalServers), fileOut);
|
||||
FS_Write(&cls.mplayerServers, sizeof(cls.mplayerServers), fileOut);
|
||||
FS_Write(&cls.favoriteServers, sizeof(cls.favoriteServers), fileOut);
|
||||
FS_FCloseFile(fileOut);
|
||||
}
|
||||
|
@ -104,10 +100,7 @@ static void LAN_ResetPings(int source) {
|
|||
servers = &cls.localServers[0];
|
||||
count = MAX_OTHER_SERVERS;
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
servers = &cls.mplayerServers[0];
|
||||
count = MAX_OTHER_SERVERS;
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
servers = &cls.globalServers[0];
|
||||
count = MAX_GLOBAL_SERVERS;
|
||||
|
@ -141,10 +134,7 @@ static int LAN_AddServer(int source, const char *name, const char *address) {
|
|||
count = &cls.numlocalservers;
|
||||
servers = &cls.localServers[0];
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
count = &cls.nummplayerservers;
|
||||
servers = &cls.mplayerServers[0];
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
max = MAX_GLOBAL_SERVERS;
|
||||
count = &cls.numglobalservers;
|
||||
|
@ -188,10 +178,7 @@ static void LAN_RemoveServer(int source, const char *addr) {
|
|||
count = &cls.numlocalservers;
|
||||
servers = &cls.localServers[0];
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
count = &cls.nummplayerservers;
|
||||
servers = &cls.mplayerServers[0];
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
count = &cls.numglobalservers;
|
||||
servers = &cls.globalServers[0];
|
||||
|
@ -229,9 +216,7 @@ static int LAN_GetServerCount( int source ) {
|
|||
case AS_LOCAL :
|
||||
return cls.numlocalservers;
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
return cls.nummplayerservers;
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
return cls.numglobalservers;
|
||||
break;
|
||||
|
@ -255,12 +240,7 @@ static void LAN_GetServerAddressString( int source, int n, char *buf, int buflen
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
Q_strncpyz(buf, NET_AdrToStringwPort( cls.mplayerServers[n].adr) , buflen );
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
Q_strncpyz(buf, NET_AdrToStringwPort( cls.globalServers[n].adr) , buflen );
|
||||
|
@ -292,11 +272,7 @@ static void LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
|
|||
server = &cls.localServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
server = &cls.mplayerServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
server = &cls.globalServers[n];
|
||||
|
@ -343,11 +319,7 @@ static int LAN_GetServerPing( int source, int n ) {
|
|||
server = &cls.localServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
server = &cls.mplayerServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
server = &cls.globalServers[n];
|
||||
|
@ -377,11 +349,7 @@ static serverInfo_t *LAN_GetServerPtr( int source, int n ) {
|
|||
return &cls.localServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
return &cls.mplayerServers[n];
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
return &cls.globalServers[n];
|
||||
|
@ -514,9 +482,7 @@ static void LAN_MarkServerVisible(int source, int n, qboolean visible ) {
|
|||
case AS_LOCAL :
|
||||
server = &cls.localServers[0];
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
server = &cls.mplayerServers[0];
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
server = &cls.globalServers[0];
|
||||
count = MAX_GLOBAL_SERVERS;
|
||||
|
@ -538,11 +504,7 @@ static void LAN_MarkServerVisible(int source, int n, qboolean visible ) {
|
|||
cls.localServers[n].visible = visible;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
cls.mplayerServers[n].visible = visible;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
cls.globalServers[n].visible = visible;
|
||||
|
@ -570,11 +532,7 @@ static int LAN_ServerIsVisible(int source, int n ) {
|
|||
return cls.localServers[n].visible;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER :
|
||||
if (n >= 0 && n < MAX_OTHER_SERVERS) {
|
||||
return cls.mplayerServers[n].visible;
|
||||
}
|
||||
break;
|
||||
case AS_MPLAYER:
|
||||
case AS_GLOBAL :
|
||||
if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
|
||||
return cls.globalServers[n].visible;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue