Changeset 8980 for code/branches/presentation2011/src/modules/pong/Pong.cc
- Timestamp:
- Dec 14, 2011, 2:38:37 PM (13 years ago)
- Location:
- code/branches/presentation2011
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011
- Property svn:mergeinfo changed
/code/branches/gamecontent (added) merged: 8893,8895,8899-8901,8904,8907,8909-8910,8922-8924,8930,8932,8941-8942,8950-8951,8956
- Property svn:mergeinfo changed
-
code/branches/presentation2011/src/modules/pong/Pong.cc
r8858 r8980 37 37 #include "core/EventIncludes.h" 38 38 #include "core/command/Executor.h" 39 #include "core/ConfigValueIncludes.h" 39 40 40 41 #include "gamestates/GSLevel.h" 42 #include "chat/ChatManager.h" 41 43 42 44 #include "PongCenterpoint.h" … … 45 47 #include "PongBot.h" 46 48 #include "PongAI.h" 47 48 49 namespace orxonox 49 50 { … … 75 76 // Set the type of Bots for this particular Gametype. 76 77 this->botclass_ = Class(PongBot); 78 this->scoreLimit_ = 10; 79 this->setConfigValues(); 77 80 } 78 81 … … 280 283 } 281 284 285 // If a palyer gets 21 points, he won the game -> end of game 286 287 PlayerInfo* player1 = this->getLeftPlayer(); 288 PlayerInfo* player2 = this->getRightPlayer(); 289 if(player1==NULL||player2==NULL) return; //safety 290 if(this->getScore(player1) >= scoreLimit_) 291 { 292 std::string name1=player1->getName(); 293 std::string message(name1 + " has won!"); 294 ChatManager::message(message); 295 this->end(); 296 } 297 else if(this->getScore(player2) >= scoreLimit_) 298 { 299 std::string name2=player2->getName(); 300 std::string message2(name2 + " has won!"); 301 ChatManager::message(message2); 302 this->end(); 303 } 282 304 // Restart the timer to start the ball. 283 305 this->starttimer_.startTimer(); 306 284 307 } 285 308 … … 321 344 return 0; 322 345 } 346 347 /** 348 @brief 349 Make scoreLimit_ configurable e.g. in the menu. 350 */ 351 void Pong::setConfigValues() 352 { 353 SetConfigValue(scoreLimit_, 10).description("The player first reaching those points wins."); 354 } 323 355 }
Note: See TracChangeset
for help on using the changeset viewer.