Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Wagnis runs without crashing on startup

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 1000000.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       
31        this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
32        this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
33        this->health_ = WAGNIS_PROVINCE_MAX_HEALTH;
34    }
35    //Destructor
36    WagnisProvince::~WagnisProvince(){
37
38    }
39
40    //XML Port
41    void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
42        SUPER(WagnisProvince, XMLPort, xmlelement, mode);
43
44        XMLPortObject(WagnisProvince, Billboard, "MarkerBillboard", addMarkerBillboard, getMarkerBillboard, xmlelement, mode);
45        XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
46        XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
47    }
48
49    void WagnisProvince::addMarkerBillboard(Billboard* billi){
50        this->markerBillboard = billi;
51        attach(billi);
52    }
53    Billboard* WagnisProvince::getMarkerBillboard(unsigned int i) const{
54        if(i != 0) return nullptr;
55        return this->markerBillboard;
56    }
57
58
59
60
61    //SET()
62
63    //set owner_ID
64    void WagnisProvince::setOwner_ID(int owner){
65        this->owner_ID = owner;
66    }
67    //set troops
68    void WagnisProvince::setTroops(int troops){
69        this->troops = troops;
70    }
71    //set ID
72    void WagnisProvince::setID(int id){
73        this->ID = id;
74    }
75    //set Continent
76    void WagnisProvince::setContinent(int cont){
77        this->continent = cont;
78    }
79
80
81    //GET()
82
83    //get owner_ID
84    int WagnisProvince::getOwner_ID() const{
85        return this->owner_ID;
86    }
87    //get troops
88    int WagnisProvince::getTroops() const{
89        return this->troops;
90    }
91    //get ID
92    int WagnisProvince::getID() const{
93        return this->ID;
94    }
95    //get continent
96    int WagnisProvince::getContinent() const{
97        return this-> continent;
98    }
99
100    //Adds a connection to neighbors.
101    void WagnisProvince::addNeighbor(WagnisProvince* prov){
102        neighbors.push_back(prov);
103    }
104
105    void WagnisProvince::setBillbardVisibility(bool b){
106        //TODO set visibility of billboard
107    }
108}
Note: See TracBrowser for help on using the repository browser.