Danbias/Code/Game/GameLogic/TeamManager.cpp

81 lines
1.3 KiB
C++
Raw Normal View History

#include "TeamManager.h"
using namespace GameLogic;
TeamManager::TeamManager(void)
2014-01-20 15:47:52 +01:00
: teams(10)
, maxNrOfTeams(10)
{
2014-01-20 15:47:52 +01:00
for (int i = 0; i < 10; i++)
{
teams[i] = 0;
}
}
TeamManager::TeamManager(int maxNrOfTeams)
2014-01-20 15:47:52 +01:00
: teams(maxNrOfTeams)
, maxNrOfTeams(maxNrOfTeams)
{
2014-01-20 15:47:52 +01:00
for (int i = 0; i < this->maxNrOfTeams; i++)
{
2014-01-20 15:47:52 +01:00
teams[i] = 0;
}
}
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;
}
}
void TeamManager::RespawnPlayerRandom(Player *player)
{
int teamID = player->GetTeamID();
Player *respawnOnThis = this->teams[teamID]->GetPlayer(0);
player->Respawn(respawnOnThis->GetPosition());
}
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++;
//}
}
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);
//}
return false;
}
bool TeamManager::AddPlayerToTeam(Player *player)
{
2013-12-18 08:41:31 +01:00
return false;
}
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;
//}
return false;
}