MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / handleGameMasterInfoRequest

Function handleGameMasterInfoRequest

Engine/source/app/net/serverQuery.cpp:1699–1777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1697//-----------------------------------------------------------------------------
1698
1699static void handleGameMasterInfoRequest( const NetAddress* address, U32 key, U8 flags )
1700{
1701 if ( GNet->doesAllowConnections() )
1702 {
1703 U8 temp8;
1704 U32 temp32;
1705
1706 char netString[256];
1707 Net::addressToString(address, netString);
1708
1709 Vector<MasterInfo> *masterList = getMasterServerList();
1710 const NetAddress *masterAddr;
1711 bool fromMaster = false;
1712 for(U32 i = 0; i < masterList->size(); i++)
1713 {
1714 masterAddr = &(*masterList)[i].address;
1715 if (masterAddr->isSameAddress(*address))
1716 {
1717 fromMaster = true;
1718 break;
1719 }
1720 }
1721
1722 Con::printf( "Received info request from %s [%s].", fromMaster?"a master server":"a machine", netString);
1723
1724 BitStream *out = BitStream::getPacketStream();
1725 out->clearStringBuffer();
1726
1727 out->write( U8( NetInterface::GameMasterInfoResponse ) );
1728 out->write( U8( flags ) );
1729 out->write( key );
1730
1731 writeCString( out, Con::getVariable( "Server::GameType" ) );
1732 writeCString( out, Con::getVariable( "Server::MissionType" ) );
1733 temp8 = U8( Con::getIntVariable( "pref::Server::MaxPlayers" ) );
1734 out->write( temp8 );
1735 temp32 = Con::getIntVariable( "pref::Server::RegionMask" );
1736 out->write( temp32 );
1737 temp32 = getVersionNumber();
1738 out->write( temp32 );
1739 temp8 = 0;
1740#if defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD)
1741 temp8 |= ServerInfo::Status_Linux;
1742#endif
1743#if defined(TORQUE_OS_XENON)
1744 temp8 |= ServerInfo::Status_Xenon;
1745#endif
1746 if ( Con::getBoolVariable( "Server::Dedicated" ) )
1747 temp8 |= ServerInfo::Status_Dedicated;
1748 if ( dStrlen( Con::getVariable( "pref::Server::Password" ) ) > 0 )
1749 temp8 |= ServerInfo::Status_Passworded;
1750 out->write( temp8 );
1751 temp8 = U8( Con::getIntVariable( "Server::BotCount" ) );
1752 out->write( temp8 );
1753 out->write( Platform::SystemInfo.processor.mhz );
1754
1755 U8 playerCount = U8( Con::getIntVariable( "Server::PlayerCount" ) );
1756 out->write( playerCount );

Callers 1

handleInfoPacketMethod · 0.85

Calls 15

getMasterServerListFunction · 0.85
printfFunction · 0.85
writeCStringFunction · 0.85
getVariableFunction · 0.85
getIntVariableFunction · 0.85
getVersionNumberFunction · 0.85
getBoolVariableFunction · 0.85
dStrcpyFunction · 0.85
dStrtokFunction · 0.85
doesAllowConnectionsMethod · 0.80
isSameAddressMethod · 0.80
clearStringBufferMethod · 0.80

Tested by

no test coverage detected