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

#include <bdLobby/bdTeams/bdGetTeamMembersResult.h>

bdGetTeamMembersResult::bdGetTeamMembersResult()
{
}

bdGetTeamMembersResult::~bdGetTeamMembersResult()
{
	m_members.clear();
}

bdBool bdGetTeamMembersResult::handleResult(const bdUInt numResults, 
											bdBitBufferRef buffer)
{
	bdBool ok = true;
	
	for(bdUInt i=0; ok && (i < numResults); i++)
	{
		bdGetTeamMembersResult::bdTeamMember member;
		
		ok = buffer->readUInt64(member.m_userID);
		ok = ok && buffer->readString(member.m_userName, BD_MAX_USERNAME_LENGTH);
		ok = ok && buffer->readBool(member.m_isOnline);
		ok = ok && buffer->readUByte8(member.m_status);

		if(ok)
		{
			m_members.pushBack(member);
		}	
	}

	m_numResults = m_members.getSize();
	return ok;
}
