Changeset 12134 for code/branches/wagnis_HS18/src/modules/wagnis
- Timestamp:
- Dec 2, 2018, 10:47:00 PM (6 years ago)
- Location:
- code/branches/wagnis_HS18/src/modules/wagnis
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
r12133 r12134 1 2 3 4 1 5 2 … … 64 61 if (checkMove(SET_TROOPS_INITIAL)){ 65 62 this->target_province->owner_ID = this->Player_ID; 66 this->target_province-> troops += 1;67 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province-> troops<<endl;63 this->target_province->setTroops(this->target_province->getTroops()+1); 64 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl; 68 65 master->playerFinishedStageCallback(this); 69 66 }else{ … … 77 74 { 78 75 if (checkMove(SET_TROOPS)){ 79 this->target_province-> troops += 1;80 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province-> troops<<endl;76 this->target_province->setTroops(this->target_province->getTroops()+1); 77 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl; 81 78 } 82 79 … … 87 84 if (checkMove(ATTACK)) 88 85 { 89 while ((this->origin_province-> troops > 1) && (this->target_province->troops> 0)) //still troops available86 while ((this->origin_province->getTroops() > 1) && (this->target_province->getTroops() > 0)) //still troops available 90 87 { 91 while ((this->origin_province-> troops >= 4) && (this->target_province->troops>= 2))88 while ((this->origin_province->getTroops() >= 4) && (this->target_province->getTroops() >= 2)) 92 89 { 93 90 //normal fight, 3 attackers, 2 defenders 94 91 } 95 92 96 if ((this->origin_province-> troops == 3) && (this->target_province->troops>= 2))93 if ((this->origin_province->getTroops() == 3) && (this->target_province->getTroops() >= 2)) 97 94 { 98 95 //2 attackers, 2 defenders 99 96 } 100 97 101 if((this->origin_province-> troops == 2) && (this->target_province->troops>= 2))98 if((this->origin_province->getTroops() == 2) && (this->target_province->getTroops() >= 2)) 102 99 { 103 100 //1 attacker, 2 defenders … … 107 104 } 108 105 109 if (this->target_province-> troops== 0) //attacker won106 if (this->target_province->getTroops() == 0) //attacker won 110 107 { 111 108 this->target_province->owner_ID = this->Player_ID; 112 this->target_province-> troops = (this->origin_province->troops- 1);113 this->origin_province-> troops = 1;109 this->target_province->setTroops(this->origin_province->getTroops() - 1); 110 this->origin_province->setTroops(1); 114 111 } 115 112 } … … 121 118 if (checkMove(MOVE)) 122 119 { 123 this->target_province-> troops += ((this->origin_province->troops) -1);124 this->origin_province-> troops = 1;120 this->target_province->setTroops(this->origin_province->getTroops()-1); 121 this->origin_province->setTroops(1); 125 122 } 126 123 break; -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
r12130 r12134 39 39 40 40 41 //void (Wagnis::*finishedStageCallback) (WagnisPlayer*);42 41 Wagnis* master; 43 42 GameStage gameStage; -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
r12133 r12134 2 2 3 3 #include "WagnisProvince.h" 4 #include "core/CoreIncludes.h"5 #include "BulletDynamics/Dynamics/btRigidBody.h"6 #include "worldentities/StaticEntity.h"7 #include <vector>8 4 9 5 #define WAGNIS_PROVINCE_MAX_HEALTH 1000000.0f … … 24 20 this->owner_ID = -1; 25 21 this->troops = 0; 22 this->setRadarName(std::to_string(0)); 26 23 this->ID = -1; 27 24 this->continent = -1; 28 25 this->neighbors = std::vector<WagnisProvince*>(); 29 this->markerBillboard = nullptr;30 26 31 27 this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH; … … 42 38 SUPER(WagnisProvince, XMLPort, xmlelement, mode); 43 39 44 XMLPortObject(WagnisProvince, Billboard, "MarkerBillboard", addMarkerBillboard, getMarkerBillboard, xmlelement, mode);45 40 XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode); 46 41 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 42 } 57 43 … … 68 54 void WagnisProvince::setTroops(int troops){ 69 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 70 63 } 71 64 //set ID … … 102 95 neighbors.push_back(prov); 103 96 } 104 105 void WagnisProvince::setBillbardVisibility(bool b){106 //TODO set visibility of billboard107 }108 97 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.h
r12114 r12134 11 11 #include "core/XMLPort.h" 12 12 #include "worldentities/pawns/Pawn.h" 13 #include " graphics/Billboard.h"13 #include "tools/OgreBulletUtils.h" 14 14 #include <vector> 15 #include <OgreColourValue.h> 16 #include "tools/ToolsPrereqs.h" 15 17 16 18 … … 25 27 26 28 virtual void XMLPort(Element&,XMLPort::Mode); 27 void addMarkerBillboard(Billboard*);28 Billboard* getMarkerBillboard(unsigned int) const;29 29 30 30 void setOwner_ID(int); … … 39 39 40 40 void addNeighbor(WagnisProvince*); 41 void setBillbardVisibility(bool);42 41 43 42 44 43 std::vector<WagnisProvince*> neighbors; 45 44 int owner_ID; 46 int troops;47 45 int ID; 48 46 int continent; 49 50 Billboard* markerBillboard; 47 48 private: 49 int troops; 50 51 51 }; 52 52 }
Note: See TracChangeset
for help on using the changeset viewer.