コード例 #1
0
ファイル: GameBrowser.cpp プロジェクト: Aytunes/Tanks
//---------------------------------------
void CGameBrowser::Update(const float dt)
{
	if (m_delayedSearchType != eDST_None)
	{
		if (m_searchingTask==CryLobbyInvalidTaskID && !CanStartSearch())
		{
			CryLog("[UI] Activate delayed search %d", m_delayedSearchType);
			if (m_delayedSearchType == eDST_Full)
			{
				StartSearchingForServers();
			}
			else if (m_delayedSearchType == eDST_FavouriteId)
			{
				if (!DoFavouriteIdSearch())
				{
#ifdef USE_C2_FRONTEND
					if (CMPMenuHub *pMPMenu = CMPMenuHub::GetMPMenuHub())
					{
						pMPMenu->SearchComplete();
					}
#endif //#ifdef USE_C2_FRONTEND
				}
			}

			m_delayedSearchType = eDST_None;
		}
	}
}
コード例 #2
0
ファイル: GameBrowser.cpp プロジェクト: hybridsix/Code
//---------------------------------------
void CGameBrowser::Update(const float dt)
{
	if (m_delayedSearchType != eDST_None)
	{
		if (m_searchingTask==CryLobbyInvalidTaskID && !CanStartSearch())
		{
			CryLog("[UI] Activate delayed search %d", m_delayedSearchType);
			if (m_delayedSearchType == eDST_Full)
			{
				StartSearchingForServers();
			}
			else if (m_delayedSearchType == eDST_FavouriteId)
			{
				if (!DoFavouriteIdSearch())
				{
					NOTIFY_UILOBBY_MP(SearchCompleted());
				}
			}

			m_delayedSearchType = eDST_None;
		}
	}
}
コード例 #3
0
ファイル: GameBrowser.cpp プロジェクト: Aytunes/Tanks
//-------------------------------------------------------------------------
bool CGameBrowser::DoFavouriteIdSearch()
{
	CryLog("[UI] DoFavouriteIdSearch");

	bool bResult = false;

#if USE_CRYLOBBY_GAMESPY
	const int k_maxNumData = START_SEARCHING_FOR_SERVERS_NUM_DATA + MAX_NUM_PER_FRIEND_ID_SEARCH;
	SCrySessionSearchParam param;
	SCrySessionSearchData data[k_maxNumData];

	param.m_type = REQUIRED_SESSIONS_QUERY;
	param.m_data = data;
	param.m_numFreeSlots = 0;
	param.m_maxNumReturn = MAX_NUM_PER_FRIEND_ID_SEARCH;
	param.m_ranked = false;

	int curData = 0;

	data[curData].m_operator = eCSSO_Equal;
	data[curData].m_data.m_id = LID_MATCHDATA_VERSION;
	data[curData].m_data.m_type = eCLUDT_Int32;
	data[curData].m_data.m_int32 = GameLobbyData::GetVersion();
	curData++;

	uint32 numAdded = 0;
#if IMPLEMENT_PC_BLADES
	for (; m_currentSearchFavouriteIdIndex<m_numSearchFavouriteIds && numAdded<MAX_NUM_PER_FRIEND_ID_SEARCH; ++m_currentSearchFavouriteIdIndex)
	{
		if (m_searchFavouriteIds[m_currentSearchFavouriteIdIndex] != INVALID_SESSION_FAVOURITE_ID)
		{
			CRY_ASSERT_MESSAGE( curData < k_maxNumData, "Session search data buffer overrun" );
			data[curData].m_operator = eCSSO_Equal;
			data[curData].m_data.m_id = LID_MATCHDATA_FAVOURITE_ID;
			data[curData].m_data.m_type = eCLUDT_Int32;
			data[curData].m_data.m_int32 = m_searchFavouriteIds[m_currentSearchFavouriteIdIndex];
			curData++;

			++numAdded;

			CryLog("[UI] Do favourite ID search for %d, on index %d of %d", m_searchFavouriteIds[m_currentSearchFavouriteIdIndex], m_currentSearchFavouriteIdIndex, m_numSearchFavouriteIds);
		}
	}
#endif

	param.m_numData = curData;

	if (numAdded > 0)
	{
		ICryLobby *pLobby = gEnv->pNetwork->GetLobby();
		if (pLobby)
		{
			if (pLobby->GetLobbyService())
			{
				CRY_ASSERT_MESSAGE(m_searchingTask==CryLobbyInvalidTaskID,"CGameBrowser Trying to search for sessions when you think you are already searching.");

				ECryLobbyError result = StartSearchingForServers(&param, CGameBrowser::MatchmakingSessionSearchCallback, this, true);

				CryLog("CCGameBrowser::DoFavouriteIdSearch result=%u, taskId=%u", result, m_searchingTask);
				if (result == eCLE_Success)
				{
					bResult = true;
				}
				else
				{
					m_searchingTask = CryLobbyInvalidTaskID;
				}
			}
		}
	}
#endif

	return bResult;
}
コード例 #4
0
ファイル: GameBrowser.cpp プロジェクト: Aytunes/Tanks
//-------------------------------------------------------------------------
void CGameBrowser::StartSearchingForServers(CryMatchmakingSessionSearchCallback cb)
{
	ICryLobby *lobby = gEnv->pNetwork->GetLobby();
	if (lobby != NULL && lobby->GetLobbyService())
	{
#ifdef GAME_IS_CRYSIS2
		CCCPOINT (GameLobby_StartSearchingForServers);
#endif

		if (CanStartSearch())
		{
			CryLog("[UI] Delayed Searching for sessions");
			m_delayedSearchType = eDST_Full;

#ifdef USE_C2_FRONTEND
			if (CMPMenuHub *pMPMenu = CMPMenuHub::GetMPMenuHub())
			{
				pMPMenu->StartSearching();
			}
#endif //#ifdef USE_C2_FRONTEND

			return;
		}

		SCrySessionSearchParam param;
		SCrySessionSearchData data[START_SEARCHING_FOR_SERVERS_NUM_DATA];

		param.m_type = REQUIRED_SESSIONS_QUERY;
		param.m_data = data;



		param.m_numFreeSlots = 0; 

		param.m_maxNumReturn = g_pGameCVars->g_maxGameBrowserResults;
		param.m_ranked = false;

		int curData = 0;









		CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
		data[curData].m_operator = eCSSO_Equal;
		data[curData].m_data.m_id = LID_MATCHDATA_VERSION;
		data[curData].m_data.m_type = eCLUDT_Int32;
		data[curData].m_data.m_int32 = GameLobbyData::GetVersion();
		curData++;

#ifdef GAME_IS_CRYSIS2
		if (!g_pGameCVars->g_ignoreDLCRequirements)
		{
			// Note: GetSquadCommonDLCs is actually a bit field, so it should really be doing a bitwise & to determine
			// if the client can join the server. However this is not supported so the less than equal operator
			// is used instead. This may return some false positives but never any false negatives, the false
			// positives will be filtered out when the results are retreived.
			CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
			data[curData].m_operator = eCSSO_LessThanEqual;
			data[curData].m_data.m_id = LID_MATCHDATA_REQUIRED_DLCS;
			data[curData].m_data.m_type = eCLUDT_Int32;
			data[curData].m_data.m_int32 = g_pGame->GetDLCManager()->GetSquadCommonDLCs();
			curData++;
		}
#endif

#if USE_CRYLOBBY_GAMESPY
		uint32	region = eSR_All;	// Game side support for region filtering needs to change this.

		if ( region != eSR_All )
		{
			CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
			data[curData].m_operator = eCSSO_BitwiseAndNotEqualZero;
			data[curData].m_data.m_id = LID_MATCHDATA_REGION;
			data[curData].m_data.m_type = eCLUDT_Int32;
			data[curData].m_data.m_int32 = region;
			curData++;
		}

		int32		favouriteID = 0;	// Game side support for favourite servers needs to change this.

		if ( favouriteID )
		{
			CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
			data[curData].m_operator = eCSSO_Equal;
			data[curData].m_data.m_id = LID_MATCHDATA_FAVOURITE_ID;
			data[curData].m_data.m_type = eCLUDT_Int32;
			data[curData].m_data.m_int32 = favouriteID;
			curData++;
		}

#endif

		param.m_numData = curData;

		CRY_ASSERT_MESSAGE(m_searchingTask==CryLobbyInvalidTaskID,"CGameBrowser Trying to search for sessions when you think you are already searching.");

		ECryLobbyError error = StartSearchingForServers(&param, cb, this, false);


		CRY_ASSERT_MESSAGE(error==eCLE_Success,"CGameBrowser searching for sessions failed.");

#ifdef USE_C2_FRONTEND
		CMPMenuHub *pMPMenu = CMPMenuHub::GetMPMenuHub();

		if (error == eCLE_Success)
		{
			if (pMPMenu)
			{
				pMPMenu->StartSearching();
			}

			CryLogAlways("CCGameBrowser::StartSearchingForServers %d", m_searchingTask);
		}
		else
		{
			if (pMPMenu)
			{
				pMPMenu->SearchComplete();
			}

			m_searchingTask = CryLobbyInvalidTaskID;
		}
#endif //#ifdef USE_C2_FRONTEND
	}
	else
	{
		CRY_ASSERT_MESSAGE(0,"CGameBrowser Cannot search for servers : no lobby service available.");
	}
}
コード例 #5
0
ファイル: GameBrowser.cpp プロジェクト: hybridsix/Code
//-------------------------------------------------------------------------
void CGameBrowser::StartSearchingForServers(CryMatchmakingSessionSearchCallback cb)
{
	ICryLobby *lobby = gEnv->pNetwork->GetLobby();
	if (lobby != NULL && lobby->GetLobbyService())
	{
		CCCPOINT (GameLobby_StartSearchingForServers);

		if (CanStartSearch())
		{
			CryLog("[UI] Delayed Searching for sessions");
			m_delayedSearchType = eDST_Full;

			NOTIFY_UILOBBY_MP(SearchStarted());

			return;
		}

		SCrySessionSearchParam param;
		SCrySessionSearchData data[START_SEARCHING_FOR_SERVERS_NUM_DATA];

		param.m_type = REQUIRED_SESSIONS_QUERY;
		param.m_data = data;
#if defined(XENON) || defined(PS3)
		param.m_numFreeSlots = max(g_pGame->GetSquadManager()->GetSquadSize(), 1);
#else
		param.m_numFreeSlots = 0; 
#endif
		param.m_maxNumReturn = g_pGameCVars->g_maxGameBrowserResults;
		param.m_ranked = false;

		int curData = 0;

#if defined(XENON)
		data[curData].m_operator = eCSSO_Equal;
		data[curData].m_data.m_id = REQUIRED_SESSIONS_SEARCH_PARAM;
		data[curData].m_data.m_type = eCLUDT_Int32;
		data[curData].m_data.m_int32 = 0;
		++curData;
#endif

		CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
		data[curData].m_operator = eCSSO_Equal;
		data[curData].m_data.m_id = LID_MATCHDATA_VERSION;
		data[curData].m_data.m_type = eCLUDT_Int32;
		data[curData].m_data.m_int32 = GameLobbyData::GetVersion();
		++curData;


		// if you want to use this, make sure the search query in the SPA asks for this param as well
		if (!g_pGameCVars->g_ignoreDLCRequirements)
		{
			// Note: GetSquadCommonDLCs is actually a bit field, so it should really be doing a bitwise & to determine
			// if the client can join the server. However this is not supported so the less than equal operator
			// is used instead. This may return some false positives but never any false negatives, the false
			// positives will be filtered out when the results are retreived.
			CRY_ASSERT_MESSAGE( curData < START_SEARCHING_FOR_SERVERS_NUM_DATA, "Session search data buffer overrun" );
			data[curData].m_operator = eCSSO_LessThanEqual;
			data[curData].m_data.m_id = LID_MATCHDATA_REQUIRED_DLCS;
			data[curData].m_data.m_type = eCLUDT_Int32;
			data[curData].m_data.m_int32 = g_pGame->GetDLCManager()->GetSquadCommonDLCs();
			++curData;
		}

		param.m_numData = curData;

		CRY_ASSERT_MESSAGE(m_searchingTask==CryLobbyInvalidTaskID,"CGameBrowser Trying to search for sessions when you think you are already searching.");

		ECryLobbyError error = StartSearchingForServers(&param, cb, this, false);

		CRY_ASSERT_MESSAGE(error==eCLE_Success,"CGameBrowser searching for sessions failed.");

		if (error == eCLE_Success)
		{
			NOTIFY_UILOBBY_MP(SearchStarted());

			CryLogAlways("CCGameBrowser::StartSearchingForServers %d", m_searchingTask);
		}
		else
		{
			NOTIFY_UILOBBY_MP(SearchCompleted());

			m_searchingTask = CryLobbyInvalidTaskID;
		}
	}
	else
	{
		CRY_ASSERT_MESSAGE(0,"CGameBrowser Cannot search for servers : no lobby service available.");
	}
}