Changeset 7901 for code/branches/lastmanstanding2/src/orxonox
- Timestamp:
- Feb 15, 2011, 3:38:54 PM (14 years ago)
- Location:
- code/branches/lastmanstanding2/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding2/src/orxonox/gametypes/Gametype.h
r7284 r7901 150 150 { this->timeLimit_ = t; } 151 151 152 //inline bool getForceSpawn() 153 // { return this->bForceSpawn_; } 154 152 155 virtual void resetTimer(); 153 156 virtual void resetTimer(float t); -
code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
r7899 r7901 58 58 LastTeamStanding::~LastTeamStanding() 59 59 { 60 this->playerLives_.clear();61 this->eachTeamsPlayers.clear();62 this->timeToAct_.clear();63 this->inGame_.clear();64 this->playerDelayTime_.clear();60 //this->playerLives_.clear(); 61 //this->eachTeamsPlayers.clear(); 62 //this->timeToAct_.clear(); 63 //this->inGame_.clear(); 64 //this->playerDelayTime_.clear(); 65 65 } 66 66 … … 75 75 playerLives_[player]=getMinLives();//new players only get minimum of lives */ 76 76 77 if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive78 this->teamsAlive++;79 this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased80 81 77 if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams. 82 78 bMinTeamsReached = true; // since there are at least two teams, the game is allowed to end … … 84 80 this->playerDelayTime_[player] = respawnDelay; 85 81 this->inGame_[player] = true; 82 int team = getTeam(player); 83 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 84 return; 85 if(this->eachTeamsPlayers[team]==0) //if a player is the first in his group, a new team is alive 86 this->teamsAlive++; 87 this->eachTeamsPlayers[team]++; //the number of player in this team is increased 86 88 } 87 89 … … 91 93 if (valid_player) 92 94 { 93 this->eachTeamsPlayers[getTeam(player)]--; // a player left the team94 if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died95 this->teamsAlive--;96 95 this->playerLives_.erase(player); 97 96 this->timeToAct_.erase(player); 98 97 this->playerDelayTime_.erase(player); 99 98 this->inGame_.erase(player); 99 int team = getTeam(player); 100 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 101 return valid_player; 102 this->eachTeamsPlayers[team]--; // a player left the team 103 if(this->eachTeamsPlayers[team] == 0) // if it was the last player a team died 104 this->teamsAlive--; 100 105 } 101 106 … … 114 119 if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives 115 120 { 116 this->eachTeamsPlayers[getTeam(victim->getPlayer())]--; 117 if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died 121 int team = getTeam(victim->getPlayer()); 122 if(team < 0|| team > teams_) // make sure getTeam returns a regular value 123 return allow; 124 this->eachTeamsPlayers[team]--; 125 if(eachTeamsPlayers[team] == 0) //last team member died 118 126 this->teamsAlive--; 119 127 const std::string& message = victim->getPlayer()->getName() + " has lost all lives"; … … 121 129 Host::Broadcast(message); 122 130 } 123 124 131 return allow; 125 132 }
Note: See TracChangeset
for help on using the changeset viewer.