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

Function handleGameInfoResponse

Engine/source/app/net/serverQuery.cpp:2031–2183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2029//-----------------------------------------------------------------------------
2030
2031static void handleGameInfoResponse( const NetAddress* address, BitStream* stream, U32 /*key*/, U8 /*flags*/ )
2032{
2033 if ( !gQueryList.size() )
2034 return;
2035
2036 S32 index = findPingEntry( gQueryList, address );
2037 if ( index == -1 )
2038 return;
2039
2040 // Remove the server from the query list since it has been so kind as to respond:
2041 gQueryList.erase( index );
2042 updateQueryProgress();
2043 ServerInfo *si = findServerInfo( address );
2044 if ( !si )
2045 return;
2046
2047 bool isUpdate = si->isUpdating();
2048 bool applyFilter = !isUpdate && ( sActiveFilter.type == ServerFilter::Normal );
2049 char addrString[256];
2050 Net::addressToString( address, addrString );
2051
2052 // Get the rules set:
2053 char stringBuf[2048]; // Who knows how big this should be?
2054 stream->readString( stringBuf );
2055 if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 )
2056 {
2057 dsize_t gameTypeLen = dStrlen(stringBuf) + 1;
2058 si->gameType = (char*) dRealloc( (void*) si->gameType, gameTypeLen );
2059 dStrcpy( si->gameType, stringBuf, gameTypeLen );
2060
2061 // Test against the active filter:
2062 if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0
2063 && dStricmp( si->gameType, sActiveFilter.gameType ) != 0 )
2064 {
2065 Con::printf( "Server %s filtered out by rules set. (%s:%s)", addrString, sActiveFilter.gameType, si->gameType );
2066 removeServerInfo( address );
2067 return;
2068 }
2069 }
2070
2071 // Get the mission type:
2072 stream->readString( stringBuf );
2073 if ( !si->missionType || String::compare( si->missionType, stringBuf ) != 0 )
2074 {
2075 dsize_t missionTypeLen = dStrlen(stringBuf) + 1;
2076 si->missionType = (char*) dRealloc( (void*) si->missionType, missionTypeLen );
2077 dStrcpy( si->missionType, stringBuf, missionTypeLen );
2078
2079 // Test against the active filter:
2080 if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0
2081 && dStricmp( si->missionType, sActiveFilter.missionType ) != 0 )
2082 {
2083 Con::printf( "Server %s filtered out by mission type. (%s:%s)", addrString, sActiveFilter.missionType, si->missionType );
2084 removeServerInfo( address );
2085 return;
2086 }
2087 }
2088

Callers 1

handleInfoPacketMethod · 0.85

Calls 15

findPingEntryFunction · 0.85
updateQueryProgressFunction · 0.85
findServerInfoFunction · 0.85
dStricmpFunction · 0.85
dStrcpyFunction · 0.85
printfFunction · 0.85
removeServerInfoFunction · 0.85
compareFunction · 0.85
dStrstrFunction · 0.85
readLongCStringFunction · 0.85
isUpdatingMethod · 0.80
isPasswordedMethod · 0.80

Tested by

no test coverage detected