Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Troop count is visible in the HUD

File size: 2.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->ID = -1;
24        this->continent = -1;
25        this->neighbors = std::vector<WagnisProvince*>();
26       
27        this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
28        this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
29        this->health_ = WAGNIS_PROVINCE_MAX_HEALTH;
30    }
31    //Destructor
32    WagnisProvince::~WagnisProvince(){
33
34    }
35
36    //XML Port
37    void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
38        SUPER(WagnisProvince, XMLPort, xmlelement, mode);
39
40        XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
41        XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
42    }
43
44
45
46
47    //SET()
48
49    //set owner_ID
50    void WagnisProvince::setOwner_ID(int owner){
51        this->owner_ID = owner;
52    }
53    //set troops
54    void WagnisProvince::setTroops(int troops){
55        this->troops = troops;
56        this->setRadarName(std::to_string(troops));
57        //TEST
58        if(troops == 5){
59            Ogre::ColourValue cv = colour({255,255,255}, 100.0f);
60            this->setRadarObjectColour(cv);
61        }
62       
63    }
64    //set ID
65    void WagnisProvince::setID(int id){
66        this->ID = id;
67    }
68    //set Continent
69    void WagnisProvince::setContinent(int cont){
70        this->continent = cont;
71    }
72
73
74    //GET()
75
76    //get owner_ID
77    int WagnisProvince::getOwner_ID() const{
78        return this->owner_ID;
79    }
80    //get troops
81    int WagnisProvince::getTroops() const{
82        return this->troops;
83    }
84    //get ID
85    int WagnisProvince::getID() const{
86        return this->ID;
87    }
88    //get continent
89    int WagnisProvince::getContinent() const{
90        return this-> continent;
91    }
92
93    //Adds a connection to neighbors.
94    void WagnisProvince::addNeighbor(WagnisProvince* prov){
95        neighbors.push_back(prov);
96    }
97}
Note: See TracBrowser for help on using the repository browser.