- Timestamp:
- Feb 14, 2011, 10:59:22 PM (14 years ago)
- Location:
- code/branches/lastmanstanding2/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
r7890 r7893 43 43 LastTeamStanding::LastTeamStanding(BaseObject* creator) : TeamDeathmatch(creator) 44 44 { 45 RegisterObject(LastTeamStanding); 45 46 this->bForceSpawn_ = true; 46 47 this->lives = 1;//4 47 this->eachTeamsPlayers.reserve(teams_);48 //this->eachTeamsPlayers.reserve(teams_); 48 49 this->teamsAlive = 0; 49 50 this->bMinTeamsReached = false; … … 58 59 { 59 60 this->playerLives_.clear(); 60 this->eachTeamsPlayers.clear();61 //this->eachTeamsPlayers.clear(); 61 62 this->timeToAct_.clear(); 62 63 this->playerDelayTime_.clear(); … … 72 73 playerLives_[player]=lives; 73 74 else 74 playerLives_[player]=getMinLives();//new players only get minimum of lives 75 76 if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive77 this->teamsAlive++;78 this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased75 playerLives_[player]=getMinLives();//new players only get minimum of lives */ 76 77 //if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive 78 // this->teamsAlive++; 79 //this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased 79 80 80 81 if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams. … … 90 91 if (valid_player) 91 92 { 92 this->eachTeamsPlayers[getTeam(player)]--; // a player left the team93 if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died94 this->teamsAlive--;93 //this->eachTeamsPlayers[getTeam(player)]--; // a player left the team 94 //if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died 95 // this->teamsAlive--; 95 96 this->playerLives_.erase(player); 96 this->eachTeamsPlayers.clear();97 //this->eachTeamsPlayers.clear(); 97 98 this->timeToAct_.erase(player); 98 99 this->playerDelayTime_.erase(player); … … 114 115 if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives 115 116 { 116 this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;117 if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died117 //this->eachTeamsPlayers[getTeam(victim->getPlayer())]--; 118 //if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died 118 119 this->teamsAlive--; 119 120 const std::string& message = victim->getPlayer()->getName() + " has lost all lives"; … … 165 166 166 167 this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer 167 this->playerDelayTime_[player] = respawnDelay;168 //this->playerDelayTime_[player] = respawnDelay; 168 169 169 170 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); … … 239 240 else 240 241 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID()); 241 /*//erase maps:242 this->playerLives_.erase(it->first);243 this->playerDelayTime_.erase (it->first);244 this->inGame_.erase (it->first);245 this->timeToAct_.erase(it->first);*/246 242 } 247 243 -
code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h
r7890 r7893 54 54 int lives; //!< Standard amount of lives. Each player starts a game with so many lives. 55 55 std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here. 56 std::vector<int> eachTeamsPlayers; //!<Number of players in each team.56 //std::vector<int> eachTeamsPlayers; //!<Number of players in each team. !!!!!!!!!!!!!! 57 57 int teamsAlive; //!< Counter counting teams with more than one player remaining. 58 58 //Data for CamperPunishment
Note: See TracChangeset
for help on using the changeset viewer.