MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / pushServerFavorites

Function pushServerFavorites

Engine/source/app/net/serverQuery.cpp:943–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941//-----------------------------------------------------------------------------
942
943static void pushServerFavorites()
944{
945 S32 count = Con::getIntVariable( "$pref::Client::ServerFavoriteCount" );
946 if ( count < 0 )
947 {
948 Con::setIntVariable( "$pref::Client::ServerFavoriteCount", 0 );
949 return;
950 }
951
952 NetAddress addr;
953 const char* server = NULL;
954 char buf[256], serverName[25], addrString[256];
955 U32 sz, len;
956 for ( S32 i = 0; i < count; i++ )
957 {
958 dSprintf( buf, sizeof( buf ), "pref::Client::ServerFavorite%d", i );
959 server = Con::getVariable( buf );
960 if ( server )
961 {
962 sz = dStrcspn( server, "\t" );
963 if ( sz > 0 )
964 {
965 len = sz > 24 ? 24 : sz;
966 dStrncpy( serverName, server, len );
967 serverName[len] = 0;
968 dStrncpy( addrString, server + ( sz + 1 ), 255 );
969
970 //Con::errorf( "Pushing server favorite \"%s\" - %s...", serverName, addrString );
971 Net::stringToAddress( addrString, &addr );
972 ServerInfo* si = findOrCreateServerInfo( &addr );
973 AssertFatal(si, "pushServerFavorites - failed to create Server Info!" );
974 dsize_t nameLen = dStrlen(serverName) + 1;
975 si->name = (char*) dRealloc( (void*) si->name, nameLen );
976 dStrcpy( si->name, serverName, nameLen );
977 si->isFavorite = true;
978 pushPingRequest( &addr );
979 }
980 }
981 }
982}
983
984//-----------------------------------------------------------------------------
985

Callers 2

queryLanServersFunction · 0.85
queryFavoriteServersFunction · 0.85

Calls 10

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

Tested by

no test coverage detected