mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-12 21:22:14 +00:00
Automatically get initial Internet servers in Team Arena UI
Having to manually request the list, with two buttons (get new list, refresh list) is somewhat confusing. Also since it looks like there are no servers, users might not try to figure out how to get the server list. The first time viewing a master server list in Team Arena UI, automatically request a new server list. After that the cache will be available with a timestamp of the last refresh time. I think this will make it easier to understand how the menu works. This may cause unneeded updating of the server cache because the last refresh timestamp is per-fs_game but the server cache is shared by all games. This will only occur once for each game though so it's not a big concern.
This commit is contained in:
parent
f6f2710f94
commit
e8f092637c
1 changed files with 18 additions and 11 deletions
|
@ -114,7 +114,7 @@ static int gamecodetoui[] = {4,2,3,0,5,1,6};
|
|||
static int uitogamecode[] = {4,6,2,3,1,5,7};
|
||||
|
||||
|
||||
static void UI_StartServerRefresh(qboolean full);
|
||||
static void UI_StartServerRefresh(qboolean full, qboolean force);
|
||||
static void UI_StopServerRefresh( void );
|
||||
static void UI_DoServerRefresh( void );
|
||||
static void UI_FeederSelection(float feederID, int index);
|
||||
|
@ -2503,9 +2503,7 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
|
|||
}
|
||||
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
if (!(ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5)) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
}
|
||||
UI_StartServerRefresh(qtrue, qfalse);
|
||||
trap_Cvar_SetValue( "ui_netSource", ui_netSource.integer);
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -3277,10 +3275,10 @@ static void UI_RunMenuScript(char **args) {
|
|||
} else if (Q_stricmp(name, "resetScores") == 0) {
|
||||
UI_ClearScores();
|
||||
} else if (Q_stricmp(name, "RefreshServers") == 0) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
UI_StartServerRefresh(qtrue, qtrue);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
} else if (Q_stricmp(name, "RefreshFilter") == 0) {
|
||||
UI_StartServerRefresh(qfalse);
|
||||
UI_StartServerRefresh(qfalse, qtrue);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
} else if (Q_stricmp(name, "RunSPDemo") == 0) {
|
||||
if (uiInfo.demoAvailable) {
|
||||
|
@ -3322,9 +3320,8 @@ static void UI_RunMenuScript(char **args) {
|
|||
uiInfo.nextServerStatusRefresh = 0;
|
||||
uiInfo.nextFindPlayerRefresh = 0;
|
||||
} else if (Q_stricmp(name, "UpdateFilter") == 0) {
|
||||
if (ui_netSource.integer == UIAS_LOCAL) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
}
|
||||
// UpdateFilter is called when server broser menu is opened and when a favorite server is deleted.
|
||||
UI_StartServerRefresh(qtrue, qfalse);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
UI_FeederSelection(FEEDER_SERVERS, 0);
|
||||
} else if (Q_stricmp(name, "ServerStatus") == 0) {
|
||||
|
@ -5949,12 +5946,22 @@ static void UI_DoServerRefresh( void )
|
|||
UI_StartServerRefresh
|
||||
=================
|
||||
*/
|
||||
static void UI_StartServerRefresh(qboolean full)
|
||||
static void UI_StartServerRefresh(qboolean full, qboolean force)
|
||||
{
|
||||
char *ptr;
|
||||
int lanSource;
|
||||
|
||||
qtime_t q;
|
||||
|
||||
// This function is called with force=qfalse when server browser menu opens or net source changes.
|
||||
// Automatically update local and favorite servers.
|
||||
// Only update master server list the first time because the server info cache will be available after that.
|
||||
if ( !force && ( ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5 ) ) {
|
||||
char *value = UI_Cvar_VariableString( va( "ui_lastServerRefresh_%i", ui_netSource.integer ) );
|
||||
if ( value[0] != 0 ) {
|
||||
return; // should have cached list
|
||||
}
|
||||
}
|
||||
|
||||
trap_RealTime(&q);
|
||||
trap_Cvar_Set( va("ui_lastServerRefresh_%i", ui_netSource.integer), va("%s-%i, %i at %i:%i", MonthAbbrev[q.tm_mon],q.tm_mday, 1900+q.tm_year,q.tm_hour,q.tm_min));
|
||||
|
||||
|
|
Loading…
Reference in a new issue