Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

WIP 21 nov

File size: 2.6 KB
Line 
1
2
3#include "WagnisProvince.h"
4#include "core/CoreIncludes.h"
5#include "BulletDynamics/Dynamics/btRigidBody.h"
6#include "worldentities/StaticEntity.h"
7#include <vector>
8
9#define WAGNIS_PROVINCE_MAX_HEALTH 1000.0f
10
11/**TODO
12 *
13 *
14 *
15 **/
16
17namespace orxonox
18{
19    RegisterClass(WagnisProvince);
20
21    //Constructor
22    WagnisProvince::WagnisProvince(Context* context) : Pawn(context){
23        RegisterObject(WagnisProvince);
24        this->owner_ID = 0;
25        this->troops = 0;
26        this->ID = -1;
27        this->continent = -1;
28        this->neighbors = std::vector<WagnisProvince*>();
29        this->markerBillboard = nullptr;
30        this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
31        this->health_ = WAGNIS_PROVINCE_MAX_HEALTH-10.0f; // <-- DEBUG
32    }
33    //Destructor
34    WagnisProvince::~WagnisProvince(){
35
36    }
37
38    //XML Port
39    void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
40        SUPER(WagnisProvince, XMLPort, xmlelement, mode);
41
42        XMLPortObject(WagnisProvince, Billboard, "MarkerBillboard", addMarkerBillboard, getMarkerBillboard, xmlelement, mode);
43        XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
44        XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
45    }
46
47    void WagnisProvince::addMarkerBillboard(Billboard* billi){
48        this->markerBillboard = billi;
49        attach(billi);
50    }
51    Billboard* WagnisProvince::getMarkerBillboard(unsigned int i) const{
52        if(i != 0) return nullptr;
53        return this->markerBillboard;
54    }
55
56
57
58
59    //SET()
60
61    //set owner_ID
62    void WagnisProvince::setOwner_ID(int owner){
63        this->owner_ID = owner;
64    }
65    //set troops
66    void WagnisProvince::setTroops(int troops){
67        this->troops = troops;
68    }
69    //set ID
70    void WagnisProvince::setID(int id){
71        this->ID = id;
72    }
73    //set Continent
74    void WagnisProvince::setContinent(int cont){
75        this->continent = cont;
76    }
77
78
79    //GET()
80
81    //get owner_ID
82    int WagnisProvince::getOwner_ID() const{
83        return this->owner_ID;
84    }
85    //get troops
86    int WagnisProvince::getTroops() const{
87        return this->troops;
88    }
89    //get ID
90    int WagnisProvince::getID() const{
91        return this->ID;
92    }
93    //get continent
94    int WagnisProvince::getContinent() const{
95        return this-> continent;
96    }
97
98    //Adds a connection to neighbors.
99    void WagnisProvince::addNeighbor(WagnisProvince* prov){
100        neighbors.push_back(prov);
101    }
102
103    void WagnisProvince::setBillbardVisibility(bool b){
104        //TODO set visibility of billboard
105    }
106}
Note: See TracBrowser for help on using the repository browser.