2013-12-18 08:30:58 +01:00
|
|
|
#include "TeamManager.h"
|
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
|
|
|
|
|
|
|
TeamManager::TeamManager(void)
|
2014-01-20 15:47:52 +01:00
|
|
|
: teams(10)
|
|
|
|
, maxNrOfTeams(10)
|
2013-12-18 08:30:58 +01:00
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
teams[i] = 0;
|
|
|
|
}
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TeamManager::TeamManager(int maxNrOfTeams)
|
2014-01-20 15:47:52 +01:00
|
|
|
: teams(maxNrOfTeams)
|
|
|
|
, maxNrOfTeams(maxNrOfTeams)
|
2013-12-18 08:30:58 +01:00
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
for (int i = 0; i < this->maxNrOfTeams; i++)
|
2013-12-18 08:30:58 +01:00
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
teams[i] = 0;
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TeamManager::~TeamManager(void)
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
for (int i = 0; i < this->maxNrOfTeams; i++)
|
|
|
|
{
|
|
|
|
delete this->teams[i];
|
|
|
|
this->teams[i] = 0;
|
|
|
|
}
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void TeamManager::RespawnPlayerRandom(Player *player)
|
|
|
|
{
|
2014-02-09 16:42:26 +01:00
|
|
|
int teamID = player->GetTeamID();
|
|
|
|
|
|
|
|
Player *respawnOnThis = this->teams[teamID]->GetPlayer(0);
|
|
|
|
|
|
|
|
player->Respawn(respawnOnThis->GetPosition());
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void TeamManager::CreateTeam(int teamSize)
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
//if (this->nrOfTeams < this->maxNrOfTeams)
|
|
|
|
//{
|
|
|
|
// this->teams[this->nrOfTeams] = new Team(teamSize);
|
|
|
|
// this->nrOfTeams++;
|
|
|
|
//}
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void TeamManager::RemoveTeam(int teamID)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TeamManager::AddPlayerToTeam(Player *player,int teamID)
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
//if (IsValidTeam(teamID))
|
|
|
|
//{
|
|
|
|
// return this->teams[teamID]->AddPlayer(player);
|
|
|
|
//}
|
2013-12-18 08:30:58 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TeamManager::AddPlayerToTeam(Player *player)
|
|
|
|
{
|
2013-12-18 08:41:31 +01:00
|
|
|
return false;
|
2013-12-18 08:30:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool TeamManager::IsValidTeam(int teamID)
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
//if (teamID < this->nrOfTeams && teamID > 0 && this->teams[teamID] != NULL)
|
|
|
|
//{
|
|
|
|
// return true;
|
|
|
|
//}
|
2013-12-18 08:30:58 +01:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|