summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c2
-rw-r--r--src/ui/ui_gameinfo.c6
-rw-r--r--src/ui/ui_local.h1
-rw-r--r--src/ui/ui_main.c46
-rw-r--r--src/ui/ui_shared.c16
-rw-r--r--src/ui/ui_shared.h1
6 files changed, 46 insertions, 26 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 2a0a2ba5..18427b8a 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1149,7 +1149,7 @@ static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y,
info = CG_ConfigString( CS_SERVERINFO );
- Q_strncpyz( buffer, Info_ValueForKey( info, "sv_hostname" ), 1024 );
+ UI_EscapeEmoticons( buffer, Info_ValueForKey( info, "sv_hostname" ), sizeof( buffer ) );
Q_CleanStr( buffer );
UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, buffer );
diff --git a/src/ui/ui_gameinfo.c b/src/ui/ui_gameinfo.c
index b39be790..6c4e4681 100644
--- a/src/ui/ui_gameinfo.c
+++ b/src/ui/ui_gameinfo.c
@@ -346,6 +346,7 @@ char *UI_GetBotNameByNumber( int num )
void UI_ServerInfo( void )
{
char info[ MAX_INFO_VALUE ];
+ char hostname[MAX_HOSTNAME_LENGTH];
info[0] = '\0';
@@ -357,8 +358,9 @@ void UI_ServerInfo( void )
Info_ValueForKey( info, "timelimit" ) );
trap_Cvar_Set( "ui_serverinfo_sd",
Info_ValueForKey( info, "g_suddenDeathTime" ) );
- trap_Cvar_Set( "ui_serverinfo_hostname",
- Info_ValueForKey( info, "sv_hostname" ) );
+ UI_EscapeEmoticons( hostname, Info_ValueForKey( info, "sv_hostname" ),
+ sizeof( hostname ) );
+ trap_Cvar_Set( "ui_serverinfo_hostname", hostname );
trap_Cvar_Set( "ui_serverinfo_maxclients",
Info_ValueForKey( info, "sv_maxclients" ) );
trap_Cvar_Set( "ui_serverinfo_version",
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 86649d62..46210d02 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -105,7 +105,6 @@ 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 ab96fa3e..2937cbc2 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -283,9 +283,6 @@ static void UI_InsertServerIntoDisplayList( int num, int position )
uiInfo.serverStatus.numDisplayServers++;
- if( Info_ValueForKey( info, "label" )[0] )
- uiInfo.serverStatus.numFeaturedServers++;
-
for( i = uiInfo.serverStatus.numDisplayServers; i > position; i-- )
uiInfo.serverStatus.displayServers[i] = uiInfo.serverStatus.displayServers[i-1];
@@ -309,8 +306,6 @@ static void UI_RemoveServerFromDisplayList( int num )
uiInfo.serverStatus.numDisplayServers--;
trap_LAN_GetServerInfo( ui_netSource.integer, num, info, MAX_STRING_CHARS );
- if( Info_ValueForKey( info, "label" )[0] )
- uiInfo.serverStatus.numFeaturedServers--;
for( j = i; j < uiInfo.serverStatus.numDisplayServers; j++ )
uiInfo.serverStatus.displayServers[j] = uiInfo.serverStatus.displayServers[j+1];
@@ -848,7 +843,6 @@ static void UI_BuildServerDisplayList( qboolean force )
numinvisible = 0;
// clear number of displayed servers
uiInfo.serverStatus.numDisplayServers = 0;
- uiInfo.serverStatus.numFeaturedServers = 0;
uiInfo.serverStatus.numPlayersOnServers = 0;
// set list box index to zero
Menu_SetFeederSelection( NULL, FEEDER_SERVERS, 0, NULL );
@@ -863,7 +857,6 @@ static void UI_BuildServerDisplayList( qboolean force )
{
// still waiting on a response from the master
uiInfo.serverStatus.numDisplayServers = 0;
- uiInfo.serverStatus.numFeaturedServers = 0;
uiInfo.serverStatus.numPlayersOnServers = 0;
uiInfo.serverStatus.nextDisplayRefresh = uiInfo.uiDC.realTime + 500;
return;
@@ -1056,7 +1049,6 @@ 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 );
@@ -3354,10 +3346,7 @@ static int UI_FeederCount( float feederID )
else if( feederID == FEEDER_MAPS )
return uiInfo.mapCount;
else if( feederID == FEEDER_SERVERS )
- return uiInfo.serverStatus.numDisplayServers -
- uiInfo.serverStatus.numFeaturedServers;
- else if( feederID == FEEDER_FEATURED )
- return uiInfo.serverStatus.numFeaturedServers;
+ return uiInfo.serverStatus.numDisplayServers;
else if( feederID == FEEDER_SERVERSTATUS )
return uiInfo.serverStatusInfo.numLines;
else if( feederID == FEEDER_NEWS )
@@ -3438,6 +3427,7 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
{
static char info[MAX_STRING_CHARS];
static char hostname[1024];
+ static char cleaned[1024];
static char clientBuff[32];
static char resolution[MAX_STRING_CHARS];
static int lastColumn = -1;
@@ -3451,15 +3441,12 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
int actual;
return UI_SelectedMap( index, &actual );
}
- else if( feederID == FEEDER_SERVERS || feederID == FEEDER_FEATURED )
+ else if( feederID == FEEDER_SERVERS )
{
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],
@@ -3476,6 +3463,8 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
// UI_UpdatePendingPings();
}
+ UI_EscapeEmoticons( cleaned, Info_ValueForKey( info, "hostname" ), sizeof( cleaned ) );
+
switch( column )
{
case SORT_HOST:
@@ -3486,15 +3475,30 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
if( ui_netSource.integer == AS_LOCAL )
{
Com_sprintf( hostname, sizeof( hostname ), "%s [%s]",
- Info_ValueForKey( info, "hostname" ),
+ cleaned,
netnames[atoi( Info_ValueForKey( info, "nettype" ) )] );
return hostname;
}
else
{
char *text;
-
- Com_sprintf( hostname, sizeof( hostname ), "%s", Info_ValueForKey( info, "hostname" ) );
+ char *label;
+
+ label = Info_ValueForKey( info, "label" );
+ if( label[0] )
+ {
+ // First char of the label response is a sorting tag. Skip it.
+ label+= 1;
+
+ Com_sprintf( hostname, sizeof( hostname ), "%s %s",
+ label,
+ cleaned );
+ }
+ else
+ {
+ Com_sprintf( hostname, sizeof( hostname ), "%s",
+ cleaned );
+ }
// Strip leading whitespace
text = hostname;
@@ -3707,12 +3711,10 @@ static void UI_FeederSelection( float feederID, int index )
trap_CIN_PlayCinematic( va( "%s.roq", uiInfo.mapList[ui_selectedMap.integer].mapLoadName ),
0, 0, 0, 0, ( CIN_loop | CIN_silent ) );
}
- else if( feederID == FEEDER_SERVERS || feederID == FEEDER_FEATURED )
+ else if( feederID == FEEDER_SERVERS )
{
const char *mapName = NULL;
- if( feederID == FEEDER_SERVERS )
- index += UI_FeederCount( FEEDER_FEATURED );
uiInfo.serverStatus.currentServer = index;
trap_LAN_GetServerInfo( ui_netSource.integer, uiInfo.serverStatus.displayServers[index],
info, MAX_STRING_CHARS );
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 25bbff2a..bcb694ce 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1833,6 +1833,22 @@ void Script_playLooped( itemDef_t *item, char **args )
}
}
+void UI_EscapeEmoticons( char *dest, const char *src, int destsize )
+{
+ int len;
+ qboolean escaped;
+ for( ; *src && destsize > 1; src++, destsize-- )
+ {
+ if ( UI_Text_Emoticon( src, &escaped, &len, NULL, NULL ) && !escaped )
+ {
+ *dest++ = '[';
+ destsize--;
+ }
+ *dest++ = *src;
+ }
+ *dest++ = '\0';
+}
+
qboolean UI_Text_Emoticon( const char *s, qboolean *escaped,
int *length, qhandle_t *h, int *width )
{
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index dec93587..e2e30508 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -521,6 +521,7 @@ float UI_Text_Height( const char *text, float scale, int limit );
float UI_Text_EmWidth( float scale );
float UI_Text_EmHeight( float scale );
qboolean UI_Text_Emoticon( const char *s, qboolean *escaped, int *length, qhandle_t *h, int *width );
+void UI_EscapeEmoticons( char *dest, const char *src, int destsize );
int trap_Parse_AddGlobalDefine( char *define );
int trap_Parse_LoadSource( const char *filename );