1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | #include "WagnisProvince.h" |
---|
8 | #include "core/CoreIncludes.h" |
---|
9 | #include "BulletDynamics/Dynamics/btRigidBody.h" |
---|
10 | #include <vector> |
---|
11 | |
---|
12 | namespace orxonox |
---|
13 | { |
---|
14 | RegisterClass(WagnisProvince); |
---|
15 | |
---|
16 | //Constructor |
---|
17 | WagnisProvince::WagnisProvince(Context* context) : MovableEntity(context){ |
---|
18 | RegisterObject(WagnisProvince); |
---|
19 | this->owner_ID = 0; |
---|
20 | this->troops = 0; |
---|
21 | this->ID = -1; |
---|
22 | this->continent = -1; |
---|
23 | this->neighbors = std::vector<WagnisProvince*>(); |
---|
24 | } |
---|
25 | //Destructor |
---|
26 | WagnisProvince::~WagnisProvince(){ |
---|
27 | |
---|
28 | } |
---|
29 | |
---|
30 | //XML Port |
---|
31 | void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){ |
---|
32 | XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode); |
---|
33 | XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode); |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | //SET() |
---|
40 | |
---|
41 | //set owner_ID |
---|
42 | void WagnisProvince::setOwner_ID(int owner){ |
---|
43 | this->owner_ID = owner; |
---|
44 | } |
---|
45 | //set troops |
---|
46 | void WagnisProvince::setTroops(int troops){ |
---|
47 | this->troops = troops; |
---|
48 | } |
---|
49 | //set ID |
---|
50 | void WagnisProvince::setID(int id){ |
---|
51 | this->ID = id; |
---|
52 | } |
---|
53 | //set Continent |
---|
54 | void WagnisProvince::setContinent(int cont){ |
---|
55 | this->continent = cont; |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | //GET() |
---|
60 | |
---|
61 | //get owner_ID |
---|
62 | int WagnisProvince::getOwner_ID() const{ |
---|
63 | return this->owner_ID; |
---|
64 | } |
---|
65 | //get troops |
---|
66 | int WagnisProvince::getTroops() const{ |
---|
67 | return this->troops; |
---|
68 | } |
---|
69 | //get ID |
---|
70 | int WagnisProvince::getID() const{ |
---|
71 | return this->ID; |
---|
72 | } |
---|
73 | //get continent |
---|
74 | int WagnisProvince::getContinent() const{ |
---|
75 | return this-> continent; |
---|
76 | } |
---|
77 | |
---|
78 | //Creates a connection between two provinces. |
---|
79 | void WagnisProvince::addNeighbor(WagnisProvince* prov){ |
---|
80 | neighbors.push_back(prov); |
---|
81 | prov->neighbors.push_back(this); |
---|
82 | } |
---|
83 | } |
---|