/* ================ SVC_Info New Xbox version - sends a short broadcast packet about our game, only done in system link games, every THREE seconds. ================ */ void SVC_Info( void ) { int i, count, wDisable; char infostring[MAX_INFO_STRING]; // We only send if we're in system link if (xb_gameType->integer != 2) return; // Wait three seconds to send another int now = Sys_Milliseconds(); if (now < svs.syslinkAdvertTime) return; svs.syslinkAdvertTime = now + 3000; // don't count bots! count = 0; for ( i = 0 ; i < sv_maxclients->integer ; i++ ) { if ( svs.clients[i].state >= CS_CONNECTED && svs.clients[i].netchan.remoteAddress.type != NA_BOT ) { count++; } } infostring[0] = 0; Info_SetValueForKey( infostring, "hostname", sv_hostname->string ); Info_SetValueForKey( infostring, "mapname", sv_mapname->string ); Info_SetValueForKey( infostring, "clients", va("%i", count) ); Info_SetValueForKey( infostring, "sv_maxclients", va("%i", sv_maxclients->integer) ); Info_SetValueForKey( infostring, "gametype", va("%i", sv_gametype->integer ) ); if ( sv_gametype->integer == GT_DUEL || sv_gametype->integer == GT_POWERDUEL ) { wDisable = Cvar_VariableIntegerValue( "g_duelWeaponDisable" ); } else { wDisable = Cvar_VariableIntegerValue( "g_weaponDisable" ); } Info_SetValueForKey( infostring, "wdisable", va("%i", wDisable ) ); Info_SetValueForKey( infostring, "fdisable", va("%i", Cvar_VariableIntegerValue( "g_forcePowerDisable" ) ) ); #ifdef _XBOX // Include Xbox specific networking info char sxnkid[XNKID_STRING_LEN]; XNKIDToString(SysLink_GetXNKID(), sxnkid); Info_SetValueForKey(infostring, "xnkid", sxnkid); char sxnkey[XNKEY_STRING_LEN]; XNKEYToString(SysLink_GetXNKEY(), sxnkey); Info_SetValueForKey(infostring, "xnkey", sxnkey); char sxnaddr[XNADDR_STRING_LEN]; XnAddrToString(Net_GetXNADDR(), sxnaddr); Info_SetValueForKey(infostring, "xnaddr", sxnaddr); #endif // NET_OutOfBandPrint( NS_SERVER, from, "infoResponse\n%s", infostring ); NET_BroadcastPrint( NS_SERVER, "infoResponse\n%s", infostring ); }
/* ================ SVC_Info Responds with a short info message that should be enough to determine if a user is interested in a server to do a full status ================ */ void SVC_Info( netadr_t from ) { int i, count, wDisable; char *gamedir; char infostring[MAX_INFO_STRING]; // ignore if we are in single player /* if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) { return; } */ #ifdef _XBOX // don't send system link info if in Xbox Live if (logged_on) return; #endif if (Cvar_VariableValue("ui_singlePlayerActive")) { return; } // don't count privateclients count = 0; for ( i = sv_privateClients->integer ; i < sv_maxclients->integer ; i++ ) { if ( svs.clients[i].state >= CS_CONNECTED ) { count++; } } infostring[0] = 0; // echo back the parameter to status. so servers can use it as a challenge // to prevent timed spoofed reply packets that add ghost servers Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) ); Info_SetValueForKey( infostring, "protocol", va("%i", PROTOCOL_VERSION) ); Info_SetValueForKey( infostring, "hostname", sv_hostname->string ); Info_SetValueForKey( infostring, "mapname", sv_mapname->string ); Info_SetValueForKey( infostring, "clients", va("%i", count) ); Info_SetValueForKey( infostring, "sv_maxclients", va("%i", sv_maxclients->integer - sv_privateClients->integer ) ); Info_SetValueForKey( infostring, "gametype", va("%i", sv_gametype->integer ) ); Info_SetValueForKey( infostring, "needpass", va("%i", sv_needpass->integer ) ); Info_SetValueForKey( infostring, "truejedi", va("%i", Cvar_VariableIntegerValue( "g_jediVmerc" ) ) ); if ( sv_gametype->integer == GT_DUEL || sv_gametype->integer == GT_POWERDUEL ) { wDisable = Cvar_VariableIntegerValue( "g_duelWeaponDisable" ); } else { wDisable = Cvar_VariableIntegerValue( "g_weaponDisable" ); } Info_SetValueForKey( infostring, "wdisable", va("%i", wDisable ) ); Info_SetValueForKey( infostring, "fdisable", va("%i", Cvar_VariableIntegerValue( "g_forcePowerDisable" ) ) ); //Info_SetValueForKey( infostring, "pure", va("%i", sv_pure->integer ) ); if( sv_minPing->integer ) { Info_SetValueForKey( infostring, "minPing", va("%i", sv_minPing->integer) ); } if( sv_maxPing->integer ) { Info_SetValueForKey( infostring, "maxPing", va("%i", sv_maxPing->integer) ); } gamedir = Cvar_VariableString( "fs_game" ); if( *gamedir ) { Info_SetValueForKey( infostring, "game", gamedir ); } #ifdef USE_CD_KEY Info_SetValueForKey( infostring, "sv_allowAnonymous", va("%i", sv_allowAnonymous->integer) ); #endif #ifdef _XBOX // Include Xbox specific networking info char sxnkid[XNKID_STRING_LEN]; XNKIDToString(SysLink_GetXNKID(), sxnkid); Info_SetValueForKey(infostring, "xnkid", sxnkid); char sxnkey[XNKEY_STRING_LEN]; XNKEYToString(SysLink_GetXNKEY(), sxnkey); Info_SetValueForKey(infostring, "xnkey", sxnkey); char sxnaddr[XNADDR_STRING_LEN]; XnAddrToString(Net_GetXNADDR(), sxnaddr); Info_SetValueForKey(infostring, "xnaddr", sxnaddr); #endif NET_OutOfBandPrint( NS_SERVER, from, "infoResponse\n%s", infostring ); }