Changeset 12170 for code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
- Timestamp:
- Dec 7, 2018, 5:14:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
r12163 r12170 118 118 }else{ 119 119 //No more troops left to place and player 1 is next. 120 next->reinforcements = provincesOfPlayerCounter(1);120 next->reinforcements = this->reinforcementsCounter(1); 121 121 } 122 122 }else{ … … 152 152 this->active_player = 1; 153 153 } 154 tc = provincesOfPlayerCounter(this->active_player); 154 155 tc = 0; 156 for(WagnisProvince* p: this->gameBoard->provs){ 157 if(p->getOwner_ID() == this->active_player){ 158 tc++; 159 } 160 } 155 161 }while(tc == 0); //Skip players without provinces. 156 162 … … 165 171 this->gameStage = REINFORCEMENT_STAGE; 166 172 next->setActive(true); 167 next->reinforcements = tc;173 next->reinforcements = reinforcementsCounter(next->Player_ID); 168 174 } 169 175 … … 186 192 187 193 this->gameBoard->initializeNeighbors(); 194 this->gameBoard->initializeContinents(); 188 195 189 196 orxout() << "Game creation finished" << endl; … … 215 222 } 216 223 217 int Wagnis:: provincesOfPlayerCounter(int player){224 int Wagnis::reinforcementsCounter(int player){ 218 225 int n = 0; 219 226 for(WagnisProvince* p:this->gameBoard->provs){ … … 226 233 } 227 234 } 235 236 n = n/3; 237 if(n<3)n=3; 238 239 int i = 0; 240 bool b = true; 241 242 for(std::vector<WagnisProvince*>* cont_vec:this->gameBoard->continents){ 243 for(WagnisProvince* p: *(cont_vec)){ 244 if(p->getOwner_ID() != player) b = false; 245 } 246 247 if(b) n += this->getContinentValue(i); 248 b = true; i++; 249 } 250 228 251 return n; 229 252 } 230 253 231 232 233 234 235 236 237 238 239 240 254 int Wagnis::getContinentValue(int cont){ 255 switch(cont){ 256 case 1: return 7; 257 case 2: return 5; 258 case 3: return 5; 259 case 4: return 3; 260 case 5: return 2; 261 case 6: return 2; 262 default: return 0; 263 } 264 return 0; 265 } 241 266 242 267
Note: See TracChangeset
for help on using the changeset viewer.