Changeset 12132 for code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
- Timestamp:
- Nov 29, 2018, 7:22:46 PM (5 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.