Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc @ 12150

Last change on this file since 12150 was 12150, checked in by stadlero, 5 years ago

Game progression finished. still bugs.

File size: 3.1 KB
Line 
1
2
3#include "WagnisProvince.h"
4
5#define WAGNIS_PROVINCE_MAX_HEALTH 1000000.0f
6
7/**TODO
8 *
9 *
10 *
11 **/
12
13namespace orxonox
14{
15    RegisterClass(WagnisProvince);
16
17    //Constructor
18    WagnisProvince::WagnisProvince(Context* context) : Pawn(context){
19        RegisterObject(WagnisProvince);
20        this->owner_ID = -1;
21        this->troops = 0;
22        this->setRadarName(std::to_string(0));
23        this->setRadarObjectColour(colour({128,128,128}, 100.0f));
24        this->ID = -1;
25        this->continent = -1;
26        this->neighbors = std::vector<WagnisProvince*>();
27       
28        this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
29        this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
30        this->health_ = WAGNIS_PROVINCE_MAX_HEALTH;
31    }
32    //Destructor
33    WagnisProvince::~WagnisProvince(){
34
35    }
36
37    //XML Port
38    void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
39        SUPER(WagnisProvince, XMLPort, xmlelement, mode);
40
41        XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
42        XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
43    }
44
45
46
47
48    //SET()
49
50    //set owner_ID
51    void WagnisProvince::setOwner_ID(int owner){
52        this->owner_ID = owner;
53        switch(owner){
54            case 1: this->setRadarObjectColour( colour({255,0,0}, 100.0f) );
55                    break;
56            case 2: this->setRadarObjectColour( colour({0,255,0}, 100.0f) );
57                    break;
58            case 3: this->setRadarObjectColour( colour({255,255,0}, 100.0f) );
59                    break;
60            case 4: this->setRadarObjectColour( colour({0,0,255}, 100.0f) );
61                    break;
62            case 5: this->setRadarObjectColour( colour({255,0,255}, 100.0f) );
63                    break;
64            case 6: this->setRadarObjectColour( colour({128,128,0}, 40.0f) );
65                    break;
66            case 7: this->setRadarObjectColour( colour({0,255,255}, 100.0f) );
67                    break;
68            case 8: this->setRadarObjectColour( colour({153,255,204}, 100.0f) );
69                    break;
70            case 9: this->setRadarObjectColour( colour({102,51,0}, 100.0f) );
71                    break;
72        }
73
74    }
75    //set troops
76    void WagnisProvince::setTroops(int troops){
77        this->troops = troops;
78        this->setRadarName(std::to_string(troops));
79    }
80    //set ID
81    void WagnisProvince::setID(int id){
82        this->ID = id;
83    }
84    //set Continent
85    void WagnisProvince::setContinent(int cont){
86        this->continent = cont;
87    }
88
89
90    //GET()
91
92    //get owner_ID
93    int WagnisProvince::getOwner_ID() const{
94        return this->owner_ID;
95    }
96    //get troops
97    int WagnisProvince::getTroops() const{
98        return this->troops;
99    }
100    //get ID
101    int WagnisProvince::getID() const{
102        return this->ID;
103    }
104    //get continent
105    int WagnisProvince::getContinent() const{
106        return this-> continent;
107    }
108
109    //Adds a connection to neighbors.
110    void WagnisProvince::addNeighbor(WagnisProvince* prov){
111        neighbors.push_back(prov);
112    }
113}
Note: See TracBrowser for help on using the repository browser.