Changeset 11071 for code/trunk/src/modules/mini4dgame
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/mini4dgame/Mini4Dgame.cc
r10624 r11071 66 66 RegisterObject(Mini4Dgame); 67 67 68 this->board_ = 0;68 this->board_ = nullptr; 69 69 70 70 // Set the type of Bots for this particular Gametype. … … 88 88 void Mini4Dgame::cleanup() 89 89 { 90 if(this->board_ != NULL)// Destroy the board, if present.90 if(this->board_ != nullptr)// Destroy the board, if present. 91 91 { 92 92 //this->board_->destroy(); 93 this->board_ = 0;93 this->board_ = nullptr; 94 94 } 95 95 } … … 101 101 void Mini4Dgame::start() 102 102 { 103 if (this->board_ != NULL) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place.103 if (this->board_ != nullptr) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place. 104 104 { 105 105 /* 106 if (this->board_ == NULL)106 if (this->board_ == nullptr) 107 107 { 108 108 this->board_ = new Mini4DgameBoard(this->board_->getContext()); … … 155 155 { 156 156 // first spawn human players to assign always the left bat to the player in singleplayer 157 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)158 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))159 this->spawnPlayer( it->first);157 for (const auto& mapEntry : this->players_) 158 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 159 this->spawnPlayer(mapEntry.first); 160 160 // now spawn bots 161 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)162 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))163 this->spawnPlayer( it->first);161 for (const auto& mapEntry : this->players_) 162 if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 163 this->spawnPlayer(mapEntry.first); 164 164 } 165 165 … … 174 174 assert(player); 175 175 176 if(false)//this->player_ == NULL)176 if(false)//this->player_ == nullptr) 177 177 { 178 178 //this->player_ = player; … … 183 183 void Mini4Dgame::undoStone()//Vector4 move, const int playerColor) 184 184 { 185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 186 186 it->undoMove(); 187 187 } … … 191 191 { 192 192 Mini4DgamePosition move = Mini4DgamePosition(x,y,z,w); 193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 194 194 it->makeMove(move); 195 195 } -
code/trunk/src/modules/mini4dgame/Mini4Dgame.h
r10230 r11071 41 41 namespace orxonox 42 42 { 43 44 namespace mini4DgamePlayerColor45 {46 enum color47 {48 none,49 red,50 blue,51 green52 };53 }54 55 43 /** 56 44 @brief … … 65 53 virtual ~Mini4Dgame(); //!< Destructor. Cleans up, if initialized. 66 54 67 virtual void start(void) ; //!< Starts the Mini4Dgame minigame.68 virtual void end(void) ; ///!< Ends the Mini4Dgame minigame.55 virtual void start(void) override; //!< Starts the Mini4Dgame minigame. 56 virtual void end(void) override; ///!< Ends the Mini4Dgame minigame. 69 57 70 virtual void spawnPlayer(PlayerInfo* player) ; //!< Spawns the input player.58 virtual void spawnPlayer(PlayerInfo* player) override; //!< Spawns the input player. 71 59 72 60 void setGameboard(Mini4DgameBoard* board) … … 84 72 85 73 protected: 86 virtual void spawnPlayersIfRequested() ; //!< Spawns player.74 virtual void spawnPlayersIfRequested() override; //!< Spawns player. 87 75 88 76 -
code/trunk/src/modules/mini4dgame/Mini4DgameAI.cc
r10230 r11071 60 60 61 61 this->setConfigValues(); 62 this->center_ = 0;62 this->center_ = nullptr; 63 63 } 64 64 … … 104 104 for(int k=0;k<4;k++){ 105 105 for(int l=0;l<4;l++){ 106 if (this->board_[i][j][k][l]== mini4DgamePlayerColor::none)106 if (this->board_[i][j][k][l]==Mini4DgamePlayerColor::none) 107 107 possibleMoves.push_back(Vector4(i,j,k,l)); 108 108 } … … 112 112 return possibleMoves; 113 113 } 114 115 /**116 @brief117 Is called each tick.118 Implements the behavior of the PongAI (i.e. its intelligence).119 @param dt120 The time that has elapsed since the last tick.121 */122 void Mini4DgameAI::tick(float dt)123 {124 125 }126 114 } -
code/trunk/src/modules/mini4dgame/Mini4DgameAI.h
r10230 r11071 39 39 #include <list> 40 40 41 #include "tools/interfaces/Tickable.h"42 43 41 #include "controllers/Controller.h" 44 42 #include "Mini4DgameCenterpoint.h" … … 55 53 Oliver Richter 56 54 */ 57 class _Mini4DgameExport Mini4DgameAI : public Controller , public Tickable55 class _Mini4DgameExport Mini4DgameAI : public Controller 58 56 { 59 57 public: … … 73 71 Vector4 makeMove(float timeout); 74 72 75 76 virtual void tick(float dt);77 78 73 void setCenterpoint(Mini4DgameCenterpoint* center) 79 74 { this->center_ = center; } … … 81 76 protected: 82 77 83 std::list<std::pair<Timer*, char> 78 std::list<std::pair<Timer*, char>> reactionTimers_; //!< A list of reaction timers and the directions that take effect when their timer expires. 84 79 Mini4DgameCenterpoint* center_; 85 80 … … 88 83 std::list<Vector4> getPossibleMoves(); 89 84 void copyBoard(); 90 mini4DgamePlayerColor::color board_[4][4][4][4];85 Mini4DgamePlayerColor board_[4][4][4][4]; 91 86 }; 92 87 } -
code/trunk/src/modules/mini4dgame/Mini4DgameBoard.cc
r10624 r11071 40 40 #include "graphics/BlinkingBillboard.h" 41 41 42 #include "core/XMLPort.h"43 44 42 #include "Mini4Dgame.h" 45 43 … … 63 61 for(int k=0;k<4;k++){ 64 62 for(int l=0;l<4;l++){ 65 this->board[i][j][k][l]= mini4DgamePlayerColor::none;66 this->blinkingBillboards[i][j][k][l] = 0;63 this->board[i][j][k][l]=Mini4DgamePlayerColor::none; 64 this->blinkingBillboards[i][j][k][l] = nullptr; 67 65 } 68 66 } … … 71 69 this->player_toggle_ = false; 72 70 this->checkGametype(); 73 }74 75 76 //xml port for loading sounds77 void Mini4DgameBoard::XMLPort(Element& xmlelement, XMLPort::Mode mode)78 {79 SUPER(Mini4DgameBoard, XMLPort, xmlelement, mode);80 71 } 81 72 … … 88 79 return (move.x<4 && move.y<4 && move.z<4 && move.w<4 89 80 && move.x>=0 && move.y>=0 && move.z>=0 && move.w>=0 90 && this->board[move.x][move.y][move.z][move.w] == mini4DgamePlayerColor::none);81 && this->board[move.x][move.y][move.z][move.w] == Mini4DgamePlayerColor::none); 91 82 } 92 83 … … 95 86 const Mini4DgamePosition& move = moves.back(); 96 87 moves.pop_back(); 97 this->board[move.x][move.y][move.z][move.w] = mini4DgamePlayerColor::none;88 this->board[move.x][move.y][move.z][move.w] = Mini4DgamePlayerColor::none; 98 89 this->blinkingBillboards[move.x][move.y][move.z][move.w]->destroy(); 99 this->blinkingBillboards[move.x][move.y][move.z][move.w] = 0;90 this->blinkingBillboards[move.x][move.y][move.z][move.w] = nullptr; 100 91 if(player_toggle_){ 101 92 this->player_toggle_ = false; … … 124 115 125 116 moves.push_back(move); 126 mini4DgamePlayerColor::color playerColor = mini4DgamePlayerColor::none;117 Mini4DgamePlayerColor playerColor = Mini4DgamePlayerColor::none; 127 118 if(player_toggle_){ 128 playerColor = mini4DgamePlayerColor::blue;119 playerColor = Mini4DgamePlayerColor::blue; 129 120 this->player_toggle_ = false; 130 121 }else{ 131 playerColor = mini4DgamePlayerColor::green;122 playerColor = Mini4DgamePlayerColor::green; 132 123 this->player_toggle_ = true; 133 124 } 134 125 135 this->board[move.x][move.y][move.z][move.w] = (mini4DgamePlayerColor::color)playerColor;126 this->board[move.x][move.y][move.z][move.w] = playerColor; 136 127 137 128 BlinkingBillboard* bb = new BlinkingBillboard(this->getContext()); … … 155 146 156 147 switch(playerColor){ 157 case mini4DgamePlayerColor::red:148 case Mini4DgamePlayerColor::red: 158 149 bb->setColour(ColourValue(1,0,0)); break; 159 case mini4DgamePlayerColor::green:150 case Mini4DgamePlayerColor::green: 160 151 bb->setColour(ColourValue(0,1,0)); break; 161 case mini4DgamePlayerColor::blue:152 case Mini4DgamePlayerColor::blue: 162 153 bb->setColour(ColourValue(0,0,1)); break; 163 154 default: break; … … 169 160 170 161 Mini4DgameWinner winner = this->getWinner(); 171 if(winner.color_ != mini4DgamePlayerColor::none)162 if(winner.color_ != Mini4DgamePlayerColor::none) 172 163 { 173 164 orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl; … … 197 188 { 198 189 Mini4DgameWinner winner; 199 winner.color_ = mini4DgamePlayerColor::none;190 winner.color_ = Mini4DgamePlayerColor::none; 200 191 201 192 //check diagonals rows-columns-height-numbers 202 193 for(int i=1; i<4; i++) 203 194 { 204 if(this->board[i][i][i][i]== mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i])195 if(this->board[i][i][i][i]==Mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i]) 205 196 break; 206 197 if(i==3) … … 218 209 for(int i=1; i<4; i++) 219 210 { 220 if(this->board[3-i][i][i][i]== mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i])211 if(this->board[3-i][i][i][i]==Mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i]) 221 212 break; 222 213 if(i==3) … … 234 225 for(int i=1; i<4; i++) 235 226 { 236 if(this->board[i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i])227 if(this->board[i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i]) 237 228 break; 238 229 if(i==3) … … 250 241 for(int i=1; i<4; i++) 251 242 { 252 if(this->board[i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i])243 if(this->board[i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i]) 253 244 break; 254 245 if(i==3) … … 266 257 for(int i=1; i<4; i++) 267 258 { 268 if(this->board[i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i])259 if(this->board[i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i]) 269 260 break; 270 261 if(i==3) … … 282 273 for(int i=1; i<4; i++) 283 274 { 284 if(this->board[3-i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i])275 if(this->board[3-i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i]) 285 276 break; 286 277 if(i==3) … … 298 289 for(int i=1; i<4; i++) 299 290 { 300 if(this->board[3-i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i])291 if(this->board[3-i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i]) 301 292 break; 302 293 if(i==3) … … 314 305 for(int i=1; i<4; i++) 315 306 { 316 if(this->board[3-i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i])307 if(this->board[3-i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i]) 317 308 break; 318 309 if(i==3) … … 334 325 for(int i=1; i<4; i++) 335 326 { 336 if(this->board[i][i][i][l]== mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l])327 if(this->board[i][i][i][l]==Mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l]) 337 328 break; 338 329 if(i==3) … … 350 341 for(int i=1; i<4; i++) 351 342 { 352 if(this->board[3-i][i][i][l]== mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l])343 if(this->board[3-i][i][i][l]==Mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l]) 353 344 break; 354 345 if(i==3) … … 366 357 for(int i=1; i<4; i++) 367 358 { 368 if(this->board[i][3-i][i][l]== mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l])359 if(this->board[i][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l]) 369 360 break; 370 361 if(i==3) … … 382 373 for(int i=1; i<4; i++) 383 374 { 384 if(this->board[i][i][3-i][l]== mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l])375 if(this->board[i][i][3-i][l]==Mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l]) 385 376 break; 386 377 if(i==3) … … 403 394 for(int i=1; i<4; i++) 404 395 { 405 if(this->board[i][i][l][i]== mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i])396 if(this->board[i][i][l][i]==Mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i]) 406 397 break; 407 398 if(i==3) … … 419 410 for(int i=1; i<4; i++) 420 411 { 421 if(this->board[3-i][i][l][i]== mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i])412 if(this->board[3-i][i][l][i]==Mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i]) 422 413 break; 423 414 if(i==3) … … 435 426 for(int i=1; i<4; i++) 436 427 { 437 if(this->board[i][3-i][l][i]== mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i])428 if(this->board[i][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i]) 438 429 break; 439 430 if(i==3) … … 451 442 for(int i=1; i<4; i++) 452 443 { 453 if(this->board[i][i][l][3-i]== mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i])444 if(this->board[i][i][l][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i]) 454 445 break; 455 446 if(i==3) … … 472 463 for(int i=1; i<4; i++) 473 464 { 474 if(this->board[i][l][i][i]== mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i])465 if(this->board[i][l][i][i]==Mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i]) 475 466 break; 476 467 if(i==3) … … 488 479 for(int i=1; i<4; i++) 489 480 { 490 if(this->board[3-i][l][i][i]== mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i])481 if(this->board[3-i][l][i][i]==Mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i]) 491 482 break; 492 483 if(i==3) … … 504 495 for(int i=1; i<4; i++) 505 496 { 506 if(this->board[i][l][3-i][i]== mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i])497 if(this->board[i][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i]) 507 498 break; 508 499 if(i==3) … … 520 511 for(int i=1; i<4; i++) 521 512 { 522 if(this->board[i][l][i][3-i]== mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i])513 if(this->board[i][l][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i]) 523 514 break; 524 515 if(i==3) … … 541 532 for(int i=1; i<4; i++) 542 533 { 543 if(this->board[l][i][i][i]== mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i])534 if(this->board[l][i][i][i]==Mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i]) 544 535 break; 545 536 if(i==3) … … 557 548 for(int i=1; i<4; i++) 558 549 { 559 if(this->board[l][3-i][i][i]== mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i])550 if(this->board[l][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i]) 560 551 break; 561 552 if(i==3) … … 573 564 for(int i=1; i<4; i++) 574 565 { 575 if(this->board[l][i][3-i][i]== mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i])566 if(this->board[l][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i]) 576 567 break; 577 568 if(i==3) … … 589 580 for(int i=1; i<4; i++) 590 581 { 591 if(this->board[l][i][i][3-i]== mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i])582 if(this->board[l][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i]) 592 583 break; 593 584 if(i==3) … … 611 602 for(int i=1; i<4; i++) 612 603 { 613 if(this->board[i][i][k][l]== mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l])604 if(this->board[i][i][k][l]==Mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l]) 614 605 break; 615 606 if(i==3) … … 627 618 for(int i=1; i<4; i++) 628 619 { 629 if(this->board[3-i][i][k][l]== mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l])620 if(this->board[3-i][i][k][l]==Mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l]) 630 621 break; 631 622 if(i==3) … … 644 635 for(int i=1; i<4; i++) 645 636 { 646 if(this->board[i][k][i][l]== mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l])637 if(this->board[i][k][i][l]==Mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l]) 647 638 break; 648 639 if(i==3) … … 660 651 for(int i=1; i<4; i++) 661 652 { 662 if(this->board[3-i][k][i][l]== mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l])653 if(this->board[3-i][k][i][l]==Mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l]) 663 654 break; 664 655 if(i==3) … … 677 668 for(int i=1; i<4; i++) 678 669 { 679 if(this->board[i][k][l][i]== mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i])670 if(this->board[i][k][l][i]==Mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i]) 680 671 break; 681 672 if(i==3) … … 693 684 for(int i=1; i<4; i++) 694 685 { 695 if(this->board[3-i][k][l][i]== mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i])686 if(this->board[3-i][k][l][i]==Mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i]) 696 687 break; 697 688 if(i==3) … … 710 701 for(int i=1; i<4; i++) 711 702 { 712 if(this->board[k][i][i][l]== mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l])703 if(this->board[k][i][i][l]==Mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l]) 713 704 break; 714 705 if(i==3) … … 726 717 for(int i=1; i<4; i++) 727 718 { 728 if(this->board[k][3-i][i][l]== mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l])719 if(this->board[k][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l]) 729 720 break; 730 721 if(i==3) … … 743 734 for(int i=1; i<4; i++) 744 735 { 745 if(this->board[k][i][l][i]== mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i])736 if(this->board[k][i][l][i]==Mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i]) 746 737 break; 747 738 if(i==3) … … 759 750 for(int i=1; i<4; i++) 760 751 { 761 if(this->board[k][3-i][l][i]== mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i])752 if(this->board[k][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i]) 762 753 break; 763 754 if(i==3) … … 776 767 for(int i=1; i<4; i++) 777 768 { 778 if(this->board[k][l][i][i]== mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i])769 if(this->board[k][l][i][i]==Mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i]) 779 770 break; 780 771 if(i==3) … … 792 783 for(int i=1; i<4; i++) 793 784 { 794 if(this->board[k][l][3-i][i]== mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i])785 if(this->board[k][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i]) 795 786 break; 796 787 if(i==3) … … 813 804 for(int k=0;k<4;k++){ 814 805 for(int l=0;l<4;l++){ 815 if(this->board[0][j][k][l]!= mini4DgamePlayerColor::none806 if(this->board[0][j][k][l]!= Mini4DgamePlayerColor::none 816 807 && this->board[0][j][k][l]==this->board[1][j][k][l] 817 808 && this->board[1][j][k][l]==this->board[2][j][k][l] … … 835 826 for(int k=0;k<4;k++){ 836 827 for(int l=0;l<4;l++){ 837 if(this->board[i][0][k][l]!= mini4DgamePlayerColor::none828 if(this->board[i][0][k][l]!= Mini4DgamePlayerColor::none 838 829 && this->board[i][0][k][l]==this->board[i][1][k][l] 839 830 && this->board[i][1][k][l]==this->board[i][2][k][l] … … 857 848 for(int j=0;j<4;j++){ 858 849 for(int l=0;l<4;l++){ 859 if(this->board[i][j][0][l]!= mini4DgamePlayerColor::none850 if(this->board[i][j][0][l]!= Mini4DgamePlayerColor::none 860 851 && this->board[i][j][0][l]==this->board[i][j][1][l] 861 852 && this->board[i][j][1][l]==this->board[i][j][2][l] … … 879 870 for(int j=0;j<4;j++){ 880 871 for(int k=0;k<4;k++){ 881 if(this->board[i][j][k][0]!= mini4DgamePlayerColor::none872 if(this->board[i][j][k][0]!= Mini4DgamePlayerColor::none 882 873 && this->board[i][j][k][0]==this->board[i][j][k][1] 883 874 && this->board[i][j][k][1]==this->board[i][j][k][2] … … 905 896 void Mini4DgameBoard::checkGametype() 906 897 { 907 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Mini4Dgame)))898 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Mini4Dgame))) 908 899 { 909 900 Mini4Dgame* Mini4DgameGametype = orxonox_cast<Mini4Dgame*>(this->getGametype()); -
code/trunk/src/modules/mini4dgame/Mini4DgameBoard.h
r10624 r11071 42 42 namespace orxonox 43 43 { 44 enum class Mini4DgamePlayerColor 45 { 46 none, 47 red, 48 blue, 49 green 50 }; 44 51 45 52 struct Mini4DgamePosition … … 58 65 int winningHeight[4]; 59 66 int winningNumber[4]; 60 intcolor_;67 Mini4DgamePlayerColor color_; 61 68 }; 62 69 … … 74 81 //virtual ~Mini4DgameBoard(); 75 82 76 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);77 78 83 bool isValidMove(const Mini4DgamePosition& move); 79 84 void undoMove(); … … 88 93 bool player_toggle_; 89 94 BlinkingBillboard* blinkingBillboards[4][4][4][4]; 90 intboard[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number]95 Mini4DgamePlayerColor board[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number] 91 96 }; 92 97 }
Note: See TracChangeset
for help on using the changeset viewer.