MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / pushServerFavorites

Function pushServerFavorites

engine/source/network/serverQuery.cc:799–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797//-----------------------------------------------------------------------------
798
799static void pushServerFavorites()
800{
801 S32 count = Con::getIntVariable( "$pref::Client::ServerFavoriteCount" );
802 if ( count < 0 )
803 {
804 Con::setIntVariable( "$pref::Client::ServerFavoriteCount", 0 );
805 return;
806 }
807
808 NetAddress addr;
809 const char* server = NULL;
810 char buf[256], serverName[25], addrString[256];
811 U32 sz, len;
812 for ( S32 i = 0; i < count; i++ )
813 {
814 dSprintf( buf, sizeof( buf ), "Pref::Client::ServerFavorite%d", i );
815 server = Con::getVariable( buf );
816 if ( server )
817 {
818 sz = dStrcspn( server, "\t" );
819 if ( sz > 0 )
820 {
821 len = sz > 24 ? 24 : sz;
822 dStrncpy( serverName, server, len );
823 serverName[len] = 0;
824 dStrncpy( addrString, server + ( sz + 1 ), 255 );
825
826 //Con::errorf( "Pushing server favorite \"%s\" - %s...", serverName, addrString );
827 Net::stringToAddress( addrString, &addr );
828 ServerInfo* si = findOrCreateServerInfo( &addr );
829 AssertFatal(si, "pushServerFavorites - failed to create Server Info!" );
830 si->name = (char*) dRealloc( (void*) si->name, dStrlen( serverName ) + 1 );
831 dStrcpy( si->name, serverName );
832 si->isFavorite = true;
833 pushPingRequest( &addr );
834 }
835 }
836 }
837}
838
839//-----------------------------------------------------------------------------
840

Callers 2

queryLanServersFunction · 0.85
queryFavoriteServersFunction · 0.85

Calls 10

getIntVariableFunction · 0.85
setIntVariableFunction · 0.85
getVariableFunction · 0.85
findOrCreateServerInfoFunction · 0.85
pushPingRequestFunction · 0.85
dSprintfFunction · 0.50
dStrcspnFunction · 0.50
dStrncpyFunction · 0.50
dStrlenFunction · 0.50
dStrcpyFunction · 0.50

Tested by

no test coverage detected