Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 12136 was 12136, checked in by kunzro, 5 years ago

HUD fixed

File size: 3.2 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({0,0,255}, 100.0f) );
59                    break;
60            case 4: this->setRadarObjectColour( colour({255,255,0}, 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        //TEST
80        if(troops == 5){
81            Ogre::ColourValue cv = colour({255,255,255}, 100.0f);
82            this->setRadarObjectColour(cv);
83        }
84       
85    }
86    //set ID
87    void WagnisProvince::setID(int id){
88        this->ID = id;
89    }
90    //set Continent
91    void WagnisProvince::setContinent(int cont){
92        this->continent = cont;
93    }
94
95
96    //GET()
97
98    //get owner_ID
99    int WagnisProvince::getOwner_ID() const{
100        return this->owner_ID;
101    }
102    //get troops
103    int WagnisProvince::getTroops() const{
104        return this->troops;
105    }
106    //get ID
107    int WagnisProvince::getID() const{
108        return this->ID;
109    }
110    //get continent
111    int WagnisProvince::getContinent() const{
112        return this-> continent;
113    }
114
115    //Adds a connection to neighbors.
116    void WagnisProvince::addNeighbor(WagnisProvince* prov){
117        neighbors.push_back(prov);
118    }
119}
Note: See TracBrowser for help on using the repository browser.