Changeset 12132 for code/branches/wagnis_HS18/src/modules
- Timestamp:
- Nov 29, 2018, 7:22:46 PM (6 years ago)
- Location:
- code/branches/wagnis_HS18/src/modules/wagnis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
r12130 r12132 18 18 19 19 int n = 3; 20 this->players.push_back(nullptr); 21 for(int i = 1;i <= n;i++){ 20 for(int i = 0;i < n;i++){ 22 21 WagnisPlayer* p = new WagnisPlayer(context); 23 p->gameBoard = this->gameBoard; 24 p->Player_ID = i; 22 p->Player_ID = i+1; 25 23 p->master = this; 26 //p->finishedStageCallback = &Wagnis::playerFinishedStage;27 24 this->players.push_back(p); 28 25 } … … 37 34 if(this->gameStage == NOT_READY){ 38 35 this->createGame(); 36 37 for(WagnisPlayer* ptr: this->players){ 38 ptr->gameBoard = this->gameBoard; 39 } 39 40 } 40 41 41 //this->gameStage = CHOOSE_PROVINCE_STAGE;42 //this->players[1]->gameStage = this->gameStage;43 //this->players[1]->is_active = true;42 this->gameStage = CHOOSE_PROVINCE_STAGE; 43 this->players.at(0)->gameStage = this->gameStage; 44 this->players.at(0)->is_active = true; 44 45 } 45 46 … … 57 58 * enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE }; 58 59 **/ 59 void Wagnis::playerFinishedStage(WagnisPlayer* player){ 60 61 /////////////////TEST//////////// 62 orxout()<<"juhuuuuuuuuuuuuuuuuuuu"<<endl; 63 /////////////////TEST//////////// 60 void Wagnis::playerFinishedStageCallback(WagnisPlayer* player){ 64 61 65 62 if(this->active_player != player->Player_ID){ … … 69 66 case CHOOSE_PROVINCE_STAGE:{ 70 67 player->is_active = false; 71 if(this->active_player +1< this->players.size()){68 if(this->active_player < this->players.size()){ 72 69 this->active_player++; 73 this->players[this->active_player]->gameStage = CHOOSE_PROVINCE_STAGE; 74 this->players[this->active_player]->is_active = true; 70 WagnisPlayer* next = this->players[this->active_player-1]; 71 next->gameStage = CHOOSE_PROVINCE_STAGE; 72 next->is_active = true; 73 orxout()<<"Player "<<next->Player_ID<<"\'s turn. Please choose province"<<endl; 75 74 }else{ 76 75 this->active_player = 1; 77 this->players[this->active_player]->gameStage = REINFORCEMENT_STAGE; 78 this->players[this->active_player]->is_active = true; 76 WagnisPlayer* next = this->players[this->active_player-1]; 77 next->gameStage = REINFORCEMENT_STAGE; 78 this->gameStage = REINFORCEMENT_STAGE; 79 next->is_active = true; 80 orxout()<<"Player "<<next->Player_ID<<"\'s turn. Reinforcement"<<endl; 79 81 } 80 82 break; 81 83 } 82 84 case REINFORCEMENT_STAGE:{ 83 85 break; 84 86 } 85 87 case ATTACK_STAGE:{ 86 88 break; 87 89 } 88 90 case MOVE_STAGE:{ 89 91 break; 90 92 } 93 default:{} 91 94 } 92 95 } -
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
r12130 r12132 38 38 void start(); 39 39 void tick(float); 40 void playerFinishedStage (WagnisPlayer*);40 void playerFinishedStageCallback(WagnisPlayer*); 41 41 42 42 -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
r12130 r12132 34 34 orxout() << "added" << endl; 35 35 orxout() << province->getID() << endl; 36 37 36 this->provs.push_back(province); 38 37 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
r12130 r12132 21 21 this->target_province = nullptr; 22 22 this->province_selection_changed = false; 23 this->gameStage = NOT_READY; 23 24 } 24 25 //Destructor … … 30 31 SUPER(WagnisPlayer, tick, dt); 31 32 32 ///////////TEST//////////////33 /**34 if(this->is_active){35 (master ->* ((orxonox::WagnisPlayer*)this)->orxonox::WagnisPlayer::finishedStageCallback) (this);36 }37 38 **/39 ///////////TEST//////////////40 41 42 43 33 if(this->is_active) 44 34 { 35 45 36 for(WagnisProvince* prov:this->gameBoard->provs){ 37 //orxout()<<"province health: "<<prov->getHealth()<<endl; 46 38 if(prov->getHealth() < prov->getMaxHealth()){ 39 //Check if next-player-button was hit 40 if(prov->getID() == 1000){ 41 master->playerFinishedStageCallback(this); 42 break; 43 } 44 //Check left/right click 47 45 if(prov->getHealth() <= prov->getMaxHealth()-1000.0f){ 48 46 this->target_province = prov; … … 52 50 this->province_selection_changed = true; 53 51 } 52 prov->setHealth(prov->getMaxHealth()); 54 53 } 55 54 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
r12119 r12132 28 28 this->neighbors = std::vector<WagnisProvince*>(); 29 29 this->markerBillboard = nullptr; 30 31 this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH; 30 32 this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH; 31 33 this->health_ = WAGNIS_PROVINCE_MAX_HEALTH; 32 33 34 } 34 35 //Destructor
Note: See TracChangeset
for help on using the changeset viewer.