-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflag.cpp
More file actions
76 lines (59 loc) · 1.68 KB
/
flag.cpp
File metadata and controls
76 lines (59 loc) · 1.68 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
#include "flag.h"
Flag::Flag(float initialPosX, float initialPosY, float initialPosZ, int initialCube, Team * team, QObject *parent) : Cuboid(parent) {
this->initialPosX = initialPosX;
this->initialPosY = initialPosY;
this->initialPosZ = initialPosZ;
this->initialCube = initialCube;
this->setPosX(initialPosX);
this->setPosY(initialPosY);
this->setPosZ(initialPosZ);
this->setCube(initialCube);
this->team = team;
this->setColorRED(team->getColorRED());
this->setColorGREEN(team->getColorGREEN());
this->setColorBLUE(team->getColorBLUE());
this->moved = false;
this->setWidth(FLAG_WIDTH);
this->setHeight(FLAG_HEIGHT);
this->setLength(FLAG_LENGTH);
}
bool Flag::hasBeenMoved(){
return this->moved;
}
void Flag::respawn(){
this->setPosX(this->initialPosX);
this->setPosY(this->initialPosY);
this->setPosZ(this->initialPosZ);
this->setCube(this->initialCube);
this->modifiedProperties.insert("posX", QString::number(getPosX()));
this->modifiedProperties.insert("posY", QString::number(getPosY()));
this->modifiedProperties.insert("posZ", QString::number(getPosZ()));
this->modifiedProperties.insert("cube", QString::number(getCube()));
}
Player * Flag::getOwner(){
return this->owner;
}
void Flag::setOwner(Player * p){
this->owner = p;
}
Team * Flag::getTeam(){
return this->team;
}
void Flag::setPosX(float posX){
if(posX != this->initialPosX){
this->moved = true;
}
Cuboid::setPosX(posX);
}
void Flag::setPosY(float posY){
if(posY != this->initialPosY){
this->moved = true;
}
Cuboid::setPosY(posY);
}
void Flag::setPosZ(float posZ){
if(posZ != this->initialPosZ){
this->moved = true;
}
Cuboid::setPosZ(posZ);
}