2011-12-25 13:33:05 +00:00
|
|
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
2010-08-30 12:13:43 +00:00
|
|
|
#include "teamscore.h"
|
|
|
|
|
2011-01-06 05:30:19 +00:00
|
|
|
CTeamsCore::CTeamsCore()
|
|
|
|
{
|
2010-09-24 07:12:26 +00:00
|
|
|
Reset();
|
2010-08-30 12:13:43 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:35:13 +00:00
|
|
|
bool CTeamsCore::SameTeam(int ClientID1, int ClientID2)
|
2011-01-06 05:30:19 +00:00
|
|
|
{
|
2011-02-13 05:35:13 +00:00
|
|
|
return m_Team[ClientID1] == m_Team[ClientID2];
|
2010-08-30 12:13:43 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:35:13 +00:00
|
|
|
int CTeamsCore::Team(int ClientID)
|
2011-01-06 05:30:19 +00:00
|
|
|
{
|
2011-02-13 05:35:13 +00:00
|
|
|
return m_Team[ClientID];
|
2010-08-30 12:13:43 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:35:13 +00:00
|
|
|
void CTeamsCore::Team(int ClientID, int Team)
|
2011-01-06 05:30:19 +00:00
|
|
|
{
|
2011-02-13 05:35:13 +00:00
|
|
|
m_Team[ClientID] = Team;
|
2010-09-21 19:09:11 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 05:35:13 +00:00
|
|
|
bool CTeamsCore::CanCollide(int ClientID1, int ClientID2)
|
2011-01-06 05:30:19 +00:00
|
|
|
{
|
2011-09-02 18:04:18 +00:00
|
|
|
if(m_Team[ClientID1] == TEAM_SUPER || m_Team[ClientID2] == TEAM_SUPER || ClientID1 == ClientID2)
|
2011-04-20 16:47:25 +00:00
|
|
|
return true;
|
2011-09-02 18:04:18 +00:00
|
|
|
if(m_IsSolo[ClientID1] || m_IsSolo[ClientID2])
|
|
|
|
return false;
|
2011-02-13 05:35:13 +00:00
|
|
|
return m_Team[ClientID1] == m_Team[ClientID2];
|
2010-09-24 07:12:26 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 05:30:19 +00:00
|
|
|
void CTeamsCore::Reset()
|
|
|
|
{
|
|
|
|
for(int i = 0; i < MAX_CLIENTS; ++i)
|
2011-09-02 18:04:18 +00:00
|
|
|
{
|
2010-09-24 07:12:26 +00:00
|
|
|
m_Team[i] = TEAM_FLOCK;
|
2011-09-02 18:04:18 +00:00
|
|
|
m_IsSolo[i] = false;
|
|
|
|
}
|
2010-11-13 13:22:19 +00:00
|
|
|
}
|