| 1551 | //----------------------------------------------------------------------------- |
| 1552 | |
| 1553 | static void handleGameMasterInfoRequest( const NetAddress* address, U32 key, U8 flags ) |
| 1554 | { |
| 1555 | if ( GNet->doesAllowConnections() ) |
| 1556 | { |
| 1557 | U8 temp8; |
| 1558 | U32 temp32; |
| 1559 | |
| 1560 | char netString[256]; |
| 1561 | Net::addressToString(address, netString); |
| 1562 | |
| 1563 | Vector<MasterInfo> *masterList = getMasterServerList(); |
| 1564 | const NetAddress *masterAddr; |
| 1565 | bool fromMaster = false; |
| 1566 | for(U32 i = 0; i < (U32)masterList->size(); i++) |
| 1567 | { |
| 1568 | masterAddr = &(*masterList)[i].address; |
| 1569 | if (masterAddr->isSameAddress(*address)) |
| 1570 | { |
| 1571 | fromMaster = true; |
| 1572 | break; |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | Con::printf( "Received info request from %s [%s].", fromMaster?"a master server":"a machine", netString); |
| 1577 | |
| 1578 | BitStream *out = BitStream::getPacketStream(); |
| 1579 | |
| 1580 | out->write( U8( NetInterface::GameMasterInfoResponse ) ); |
| 1581 | out->write( U8( flags ) ); |
| 1582 | out->write( key ); |
| 1583 | |
| 1584 | writeCString( out, Con::getVariable( "Server::GameType" ) ); |
| 1585 | writeCString( out, Con::getVariable( "Server::MissionType" ) ); |
| 1586 | temp8 = U8( Con::getIntVariable( "Pref::Server::MaxPlayers" ) ); |
| 1587 | out->write( temp8 ); |
| 1588 | temp32 = Con::getIntVariable( "Pref::Server::RegionMask" ); |
| 1589 | out->write( temp32 ); |
| 1590 | temp32 = getVersionNumber(); |
| 1591 | out->write( temp32 ); |
| 1592 | temp8 = 0; |
| 1593 | #if defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OPENBSD) |
| 1594 | temp8 |= ServerInfo::Status_Linux; |
| 1595 | #endif |
| 1596 | if ( Con::getBoolVariable( "Server::Dedicated" ) ) |
| 1597 | temp8 |= ServerInfo::Status_Dedicated; |
| 1598 | if ( dStrlen( Con::getVariable( "Pref::Server::Password" ) ) > 0 ) |
| 1599 | temp8 |= ServerInfo::Status_Passworded; |
| 1600 | out->write( temp8 ); |
| 1601 | temp8 = U8( Con::getIntVariable( "Server::BotCount" ) ); |
| 1602 | out->write( temp8 ); |
| 1603 | out->write( PlatformSystemInfo.processor.mhz ); |
| 1604 | |
| 1605 | U8 playerCount = U8( Con::getIntVariable( "Server::PlayerCount" ) ); |
| 1606 | out->write( playerCount ); |
| 1607 | |
| 1608 | const char* guidList = Con::getVariable( "Server::GuidList" ); |
| 1609 | char* buf = new char[dStrlen( guidList ) + 1]; |
| 1610 | dStrcpy( buf, guidList ); |
no test coverage detected