Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7897


Ignore:
Timestamp:
Feb 15, 2011, 12:15:43 AM (14 years ago)
Author:
jo
Message:

Problem with the destruction of the vector eachTeamsPlayers - couldn't find a solution yet.

Location:
code/branches/lastmanstanding2/src/orxonox/gametypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc

    r7893 r7897  
    4646        this->bForceSpawn_ = true;
    4747        this->lives = 1;//4
    48         //this->eachTeamsPlayers.reserve(teams_);
     48        this->eachTeamsPlayers.resize(teams_,0);
    4949        this->teamsAlive = 0;
    5050        this->bMinTeamsReached = false;
     
    5959    {
    6060        this->playerLives_.clear();
    61         //this->eachTeamsPlayers.clear();
     61        this->eachTeamsPlayers.clear();
    6262        this->timeToAct_.clear();
     63        this->inGame_.clear();
    6364        this->playerDelayTime_.clear();
    64         this->inGame_.clear();
    6565    }   
    6666
     
    7575            playerLives_[player]=getMinLives();//new players only get minimum of lives */
    7676       
    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
     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
    8080
    8181        if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
     
    9191        if (valid_player)
    9292        {
    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--;
     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--;
    9696            this->playerLives_.erase(player);
    97             //this->eachTeamsPlayers.clear();
    9897            this->timeToAct_.erase(player);
    9998            this->playerDelayTime_.erase(player);
     
    115114        if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives
    116115        {
    117             //this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
    118             //if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
     116            this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
     117            if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
    119118                this->teamsAlive--;
    120119            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
     
    166165       
    167166        this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer
    168         //this->playerDelayTime_[player] = respawnDelay;
     167        this->playerDelayTime_[player] = respawnDelay;
    169168       
    170169        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h

    r7893 r7897  
    5454            int lives; //!< Standard amount of lives. Each player starts a game with so many lives.
    5555            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.
    5757            int teamsAlive; //!< Counter counting teams with more than one player remaining.
    5858//Data for CamperPunishment
Note: See TracChangeset for help on using the changeset viewer.