Changeset 9941 for code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
- Timestamp:
- Dec 29, 2013, 8:06:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
r9667 r9941 33 33 #include "infos/PlayerInfo.h" 34 34 #include "worldentities/pawns/Pawn.h" 35 #include "core/config/ConfigValueIncludes.h" 35 36 36 37 namespace orxonox … … 41 42 { 42 43 RegisterObject(TeamDeathmatch); 44 45 this->setConfigValues(); 46 } 47 48 void TeamDeathmatch::setConfigValues() 49 { 50 SetConfigValue(maxScore_, 10); 43 51 } 44 52 … … 57 65 std::string message("The match has ended."); 58 66 ChatManager::message(message); 67 68 //find team that won the match 69 int winnerTeam = 0; 70 int highestScore = 0; 71 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 72 { 73 if ( this->getTeamScore(it->first) > highestScore ) 74 { 75 winnerTeam = this->getTeam(it->first); 76 highestScore = this->getTeamScore(it->first); 77 } 78 } 79 80 //announce win 81 this->announceTeamWin(winnerTeam); 59 82 } 60 83 … … 100 123 { 101 124 if (killer->getPlayer()) 125 { 102 126 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName(); 127 if(this->isExactlyA(Class(TeamDeathmatch)) && (this->getTeamScore(killer->getPlayer()) >= (this->maxScore_ -1)) ) 128 this->end(); 129 } 103 130 else 104 131 message = victim->getPlayer()->getName() + " was killed";
Note: See TracChangeset
for help on using the changeset viewer.