Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7893 for code


Ignore:
Timestamp:
Feb 14, 2011, 10:59:22 PM (14 years ago)
Author:
jo
Message:

still problem with vector to fix

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

Legend:

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

    r7890 r7893  
    4343    LastTeamStanding::LastTeamStanding(BaseObject* creator) : TeamDeathmatch(creator)
    4444    {
     45        RegisterObject(LastTeamStanding);
    4546        this->bForceSpawn_ = true;
    4647        this->lives = 1;//4
    47         this->eachTeamsPlayers.reserve(teams_);
     48        //this->eachTeamsPlayers.reserve(teams_);
    4849        this->teamsAlive = 0;
    4950        this->bMinTeamsReached = false;
     
    5859    {
    5960        this->playerLives_.clear();
    60         this->eachTeamsPlayers.clear();
     61        //this->eachTeamsPlayers.clear();
    6162        this->timeToAct_.clear();
    6263        this->playerDelayTime_.clear();
     
    7273            playerLives_[player]=lives;
    7374        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 alive
    77             this->teamsAlive++;
    78         this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased
     75            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
    7980
    8081        if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
     
    9091        if (valid_player)
    9192        {
    92             this->eachTeamsPlayers[getTeam(player)]--;       // a player left the team
    93             if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died
    94                  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--;
    9596            this->playerLives_.erase(player);
    96             this->eachTeamsPlayers.clear();
     97            //this->eachTeamsPlayers.clear();
    9798            this->timeToAct_.erase(player);
    9899            this->playerDelayTime_.erase(player);
     
    114115        if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives
    115116        {
    116             this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
    117             if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
     117            //this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
     118            //if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
    118119                this->teamsAlive--;
    119120            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
     
    165166       
    166167        this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer
    167         this->playerDelayTime_[player] = respawnDelay;
     168        //this->playerDelayTime_[player] = respawnDelay;
    168169       
    169170        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
     
    239240            else
    240241                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);*/
    246242        }
    247243
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h

    r7890 r7893  
    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.