BOOL KTeamClient::DelMember(DWORD dwMemberID, int nGroupIndex) { BOOL bResult = false; KPlayer* pPlayer = NULL; KG_PROCESS_ERROR(m_dwTeamID != ERROR_ID); KG_PROCESS_ERROR(nGroupIndex < m_nGroupNum); for ( KTEAM_MEMBER_LIST::iterator it = m_TeamGroup[nGroupIndex].MemberList.begin(); it != m_TeamGroup[nGroupIndex].MemberList.end(); ++it ) { if (it->dwMemberID == dwMemberID) { m_TeamGroup[nGroupIndex].MemberList.erase(it); pPlayer = g_pSO3World->m_PlayerSet.GetObj(dwMemberID); if (pPlayer) { pPlayer->SetCurrentTeamID(m_bSystem, ERROR_ID); } bResult = true; goto Exit0; } } Exit0: return bResult; }
BOOL KTeamClient::AddMember(DWORD dwMemberID, int nGroupIndex, char szMemberName[]) { BOOL bResult = false; KPlayer* pPlayer = NULL; KTEAM_MEMBER_INFO MemberInfo; KG_PROCESS_ERROR(m_dwTeamID != ERROR_ID); KGLOG_PROCESS_ERROR(nGroupIndex < m_nGroupNum); KG_PROCESS_ERROR(m_TeamGroup[nGroupIndex].MemberList.size() < MAX_PLAYER_PER_GROUP); memset(&MemberInfo, 0, sizeof(MemberInfo)); strncpy(MemberInfo.szRoleName, szMemberName, sizeof(MemberInfo.szRoleName)); MemberInfo.szRoleName[sizeof(MemberInfo.szRoleName) - 1] = '\0'; MemberInfo.dwMemberID = dwMemberID; MemberInfo.bDeathFlag = false; MemberInfo.bOnlineFlag = true; MemberInfo.nLifePercent = UCHAR_MAX; MemberInfo.nManaPercent = UCHAR_MAX; MemberInfo.nRagePercent = UCHAR_MAX; m_TeamGroup[nGroupIndex].MemberList.push_back(MemberInfo); pPlayer = g_pSO3World->m_PlayerSet.GetObj(dwMemberID); if (pPlayer) { pPlayer->SetCurrentTeamID(m_bSystem, m_dwTeamID); } bResult = true; Exit0: return bResult; }