-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteam.cpp
More file actions
77 lines (59 loc) · 1.41 KB
/
team.cpp
File metadata and controls
77 lines (59 loc) · 1.41 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "team.h"
Team::Team(QString name, int num, int colorRED, int colorGREEN, int colorBLUE, int respawnFace, QObject *parent) : QObject(parent) {
this->name = name;
this->num = num;
this->colorRED = colorRED;
this->colorGREEN = colorGREEN;
this->colorBLUE = colorBLUE;
this->respawnFace = respawnFace;
this->teamPoints = 0;
}
int Team::getPoints(){
int res = this->teamPoints;
/*foreach(Player * p, this->players){
res += p->getKills();
}*/
return res;
}
void Team::addTeamPoints(int teamPoints){
if(teamPoints != 0){
this->teamPoints += teamPoints;
this->modifiedProperties.insert("points");
}
}
void Team::removeTeamPoints(int teamPoints){
if(teamPoints != 0){
this->teamPoints -= teamPoints;
if(!this->modifiedProperties.contains("points")) this->modifiedProperties.insert("points");
}
}
void Team::addPlayer(Player* p){
this->players << p;
}
void Team::removePlayer(Player* p){
this->players.removeOne(p);
}
QString Team::getName(){
return this->name;
}
int Team::getNum(){
return this->num;
}
int Team::getColorRED(){
return this->colorRED;
}
int Team::getColorGREEN(){
return this->colorGREEN;
}
int Team::getColorBLUE(){
return this->colorBLUE;
}
int Team::getRespawnFace(){
return this->respawnFace;
}
QSet<QString> & Team::getModifiedProperties(){
return this->modifiedProperties;
}
QList<Player*> & Team::getPlayers(){
return this->players;
}