diff options
Diffstat (limited to 'src/client/cl_ui.c')
-rw-r--r-- | src/client/cl_ui.c | 90 |
1 files changed, 28 insertions, 62 deletions
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c index 8aa4550f..c0d4e729 100644 --- a/src/client/cl_ui.c +++ b/src/client/cl_ui.c @@ -47,19 +47,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); @@ -75,12 +73,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); } @@ -101,10 +97,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; @@ -138,10 +131,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; @@ -153,7 +143,7 @@ static int LAN_AddServer(int source, const char *name, const char *address) { break; } if (servers && *count < max) { - NET_StringToAdr( address, &adr ); + NET_StringToAdr( address, &adr, NA_IP ); for ( i = 0; i < *count; i++ ) { if (NET_CompareAdr(servers[i].adr, adr)) { break; @@ -185,10 +175,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]; @@ -200,7 +187,7 @@ static void LAN_RemoveServer(int source, const char *addr) { } if (servers) { netadr_t comp; - NET_StringToAdr( addr, &comp ); + NET_StringToAdr( addr, &comp, NA_IP ); for (i = 0; i < *count; i++) { if (NET_CompareAdr( comp, servers[i].adr)) { int j = i; @@ -226,9 +213,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; @@ -248,25 +233,20 @@ static void LAN_GetServerAddressString( int source, int n, char *buf, int buflen switch (source) { case AS_LOCAL : if (n >= 0 && n < MAX_OTHER_SERVERS) { - Q_strncpyz(buf, NET_AdrToString( cls.localServers[n].adr) , buflen ); - return; - } - break; - case AS_MPLAYER : - if (n >= 0 && n < MAX_OTHER_SERVERS) { - Q_strncpyz(buf, NET_AdrToString( cls.mplayerServers[n].adr) , buflen ); + Q_strncpyz(buf, NET_AdrToStringwPort( cls.localServers[n].adr) , buflen ); return; } break; + case AS_MPLAYER: case AS_GLOBAL : if (n >= 0 && n < MAX_GLOBAL_SERVERS) { - Q_strncpyz(buf, NET_AdrToString( cls.globalServers[n].adr) , buflen ); + Q_strncpyz(buf, NET_AdrToStringwPort( cls.globalServers[n].adr) , buflen ); return; } break; case AS_FAVORITES : if (n >= 0 && n < MAX_OTHER_SERVERS) { - Q_strncpyz(buf, NET_AdrToString( cls.favoriteServers[n].adr) , buflen ); + Q_strncpyz(buf, NET_AdrToStringwPort( cls.favoriteServers[n].adr) , buflen ); return; } break; @@ -289,11 +269,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]; @@ -339,11 +315,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]; @@ -373,11 +345,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]; @@ -520,9 +488,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; @@ -544,11 +510,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; @@ -576,11 +538,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; @@ -743,6 +701,14 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { return 0; case UI_CMD_EXECUTETEXT: + if(args[1] == 0 + && (!strncmp(VMA(2), "snd_restart", 11) + || !strncmp(VMA(2), "vid_restart", 11) + || !strncmp(VMA(2), "quit", 5))) + { + Com_Printf (S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char*)VMA(2)); + args[1] = EXEC_INSERT; + } Cbuf_ExecuteText( args[1], VMA(2) ); return 0; |