-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathteam.cpp
More file actions
45 lines (36 loc) · 976 Bytes
/
Copy pathteam.cpp
File metadata and controls
45 lines (36 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "team.h"
#include <QDebug>
team::team(QString new_name){
tname = QString(new_name.trimmed());
inGame = false;
}
void team::insertPlayer(player *new_player){
players.push_back(new_player);
}
bool team::get_player(unsigned int num, player **r_player){
if(players.size() < 1 ){
qDebug() << "There are no players on the team " << tname << endl;
return false;
}
if( (num >= players.size()) ){
qDebug() << "Player number " << num <<" doesnt exist on team" << tname <<endl;
return false;
}
*r_player = players[num];
return true;
}
int team::get_team_size(){
return players.size();
}
bool team::get_player_by_mac(QString new_sta_mac, player **r_player){
for(unsigned int i = 0 ; i < players.size(); i++){
if(players[i]->mac() == new_sta_mac){
*r_player = players[i];
return true;
}
}
return false;
}
QString team::name(){
return tname;
}