// DWBS ------------------------------------------------------------------ DWBS
//
// PLATFORM		: ALL
// PRODUCT		: BIT_DEMON
// VISIBILITY	: PUBLIC
//
// DWBS ------------------------------------------------------------------ DWBS



template <typename T, bdUInt ARRAY_SIZE> 
bdMatchMakingResult<T, ARRAY_SIZE>::bdMatchMakingResult()
{
}

template <typename T, bdUInt ARRAY_SIZE> 
bdMatchMakingResult<T, ARRAY_SIZE>::~bdMatchMakingResult()
{
}

template <typename T, bdUInt ARRAY_SIZE>
bdBool bdMatchMakingResult<T, ARRAY_SIZE>::handleResult(const bdUInt numResults,
														bdBitBufferRef buffer)
{
	bdBool ok = true;	

	const bdUInt resultsToRead = BD_MIN(numResults , ARRAY_SIZE);
	if(resultsToRead != numResults )
	{
		BD_WARN("MatchmakingResultTemplate", "Received %u results but can only store %u.", 
					numResults, ARRAY_SIZE);
	}
	
	reset();

	for(bdUInt i=0; ok && (i < resultsToRead); i++)
	{
		ok = m_MMInfo[i].deserialize(buffer);
		if(ok)
		{
			m_numResults++;
		}
	}

	return ok;
}
