diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 13:15:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:37 +0000 |
commit | 7199e8ddded777709df090973cab53c040592b72 (patch) | |
tree | 309ae026f25034903d1e09d37f01fca2f13ecc36 /src/ui | |
parent | 39a04df7a0477708c11dae6e45e99c6da33e20d7 (diff) |
* Featured server system
- The new master server sends some server records with an additional
flag for the client to mark them as featured - they will then appear
in a separate list.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_local.h | 1 | ||||
-rw-r--r-- | src/ui/ui_main.c | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index 48eea7db..938f1e23 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -102,6 +102,7 @@ typedef struct serverStatus_s int currentServer; int displayServers[MAX_DISPLAY_SERVERS]; int numDisplayServers; + int numFeaturedServers; int numPlayersOnServers; int nextDisplayRefresh; int nextSortTime; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 441ce79a..43aaa0af 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -907,6 +907,8 @@ static void UI_BuildServerDisplayList( qboolean force ) if( ping > 0 ) { trap_LAN_MarkServerVisible( ui_netSource.integer, i, qfalse ); + if( Info_ValueForKey( info, "label" )[0] ) + uiInfo.serverStatus.numFeaturedServers++; numinvisible++; } } @@ -1043,6 +1045,7 @@ static void UI_StartServerRefresh( qboolean full ) uiInfo.serverStatus.nextDisplayRefresh = uiInfo.uiDC.realTime + 1000; // clear number of displayed servers uiInfo.serverStatus.numDisplayServers = 0; + uiInfo.serverStatus.numFeaturedServers = 0; uiInfo.serverStatus.numPlayersOnServers = 0; // mark all servers as visible so we store ping updates for them trap_LAN_MarkServerVisible( ui_netSource.integer, -1, qtrue ); @@ -3342,7 +3345,10 @@ static int UI_FeederCount( float feederID ) else if( feederID == FEEDER_MAPS ) return uiInfo.mapCount; else if( feederID == FEEDER_SERVERS ) - return uiInfo.serverStatus.numDisplayServers; + return uiInfo.serverStatus.numDisplayServers - + uiInfo.serverStatus.numFeaturedServers; + else if( feederID == FEEDER_FEATURED ) + return uiInfo.serverStatus.numFeaturedServers; else if( feederID == FEEDER_SERVERSTATUS ) return uiInfo.serverStatusInfo.numLines; else if( feederID == FEEDER_FINDPLAYER ) @@ -3434,12 +3440,15 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha int actual; return UI_SelectedMap( index, &actual ); } - else if( feederID == FEEDER_SERVERS ) + else if( feederID == FEEDER_SERVERS || feederID == FEEDER_FEATURED ) { - if( index >= 0 && index < uiInfo.serverStatus.numDisplayServers ) + if( index >= 0 && index < UI_FeederCount( feederID ) ) { int ping; + if( feederID == FEEDER_SERVERS ) + index += UI_FeederCount( FEEDER_FEATURED ); + if( lastColumn != column || lastTime > uiInfo.uiDC.realTime + 5000 ) { trap_LAN_GetServerInfo( ui_netSource.integer, uiInfo.serverStatus.displayServers[index], |