[Orxonox-commit 3200] r7893 - code/branches/lastmanstanding2/src/orxonox/gametypes

jo at orxonox.net jo at orxonox.net
Mon Feb 14 22:59:23 CET 2011


Author: jo
Date: 2011-02-14 22:59:22 +0100 (Mon, 14 Feb 2011)
New Revision: 7893

Modified:
   code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
   code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h
Log:
still problem with vector to fix

Modified: code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc	2011-02-14 21:51:44 UTC (rev 7892)
+++ code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc	2011-02-14 21:59:22 UTC (rev 7893)
@@ -42,9 +42,10 @@
 
     LastTeamStanding::LastTeamStanding(BaseObject* creator) : TeamDeathmatch(creator)
     {
+        RegisterObject(LastTeamStanding);
         this->bForceSpawn_ = true;
         this->lives = 1;//4
-        this->eachTeamsPlayers.reserve(teams_);
+        //this->eachTeamsPlayers.reserve(teams_);
         this->teamsAlive = 0;
         this->bMinTeamsReached = false;
         this->bNoPunishment = false;
@@ -57,7 +58,7 @@
     LastTeamStanding::~LastTeamStanding()
     {
         this->playerLives_.clear();
-        this->eachTeamsPlayers.clear();
+        //this->eachTeamsPlayers.clear();
         this->timeToAct_.clear();
         this->playerDelayTime_.clear();
         this->inGame_.clear();
@@ -71,11 +72,11 @@
         if (teamsAlive<=1)
             playerLives_[player]=lives;
         else
-            playerLives_[player]=getMinLives();//new players only get minimum of lives
+            playerLives_[player]=getMinLives();//new players only get minimum of lives */
         
-        if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive
-            this->teamsAlive++;
-        this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased
+        //if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive
+          //  this->teamsAlive++;
+        //this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased
 
         if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
             bMinTeamsReached = true; // since there are at least two teams, the game is allowed to end
@@ -89,11 +90,11 @@
         bool valid_player = TeamDeathmatch::playerLeft(player);
         if (valid_player)
         {
-            this->eachTeamsPlayers[getTeam(player)]--;       // a player left the team
-            if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died
-                 this->teamsAlive--;
+            //this->eachTeamsPlayers[getTeam(player)]--;       // a player left the team
+            //if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died
+             //    this->teamsAlive--;
             this->playerLives_.erase(player);
-            this->eachTeamsPlayers.clear();
+            //this->eachTeamsPlayers.clear();
             this->timeToAct_.erase(player);
             this->playerDelayTime_.erase(player);
             this->inGame_.erase(player);
@@ -113,8 +114,8 @@
         this->inGame_[victim->getPlayer()] = false; //if player dies, he isn't allowed to respawn immediately
         if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives
         {
-            this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
-            if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
+            //this->eachTeamsPlayers[getTeam(victim->getPlayer())]--;
+            //if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died
                 this->teamsAlive--;
             const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
             COUT(0) << message << std::endl;
@@ -164,7 +165,7 @@
         TeamDeathmatch::playerStartsControllingPawn(player,pawn);
         
         this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer
-        this->playerDelayTime_[player] = respawnDelay;
+        //this->playerDelayTime_[player] = respawnDelay;
         
         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
         if (it != this->players_.end())
@@ -238,11 +239,6 @@
                 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
             else
                 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
-        /*//erase maps:
-            this->playerLives_.erase(it->first);
-            this->playerDelayTime_.erase (it->first);
-            this->inGame_.erase (it->first);
-            this->timeToAct_.erase(it->first);*/
         }
 
     }

Modified: code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h
===================================================================
--- code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h	2011-02-14 21:51:44 UTC (rev 7892)
+++ code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h	2011-02-14 21:59:22 UTC (rev 7893)
@@ -53,7 +53,7 @@
         protected:
             int lives; //!< Standard amount of lives. Each player starts a game with so many lives.
             std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here.
-            std::vector<int> eachTeamsPlayers; //!<Number of players in each team.
+            //std::vector<int> eachTeamsPlayers; //!<Number of players in each team. !!!!!!!!!!!!!!
             int teamsAlive; //!< Counter counting teams with more than one player remaining.
 //Data for CamperPunishment
             float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.




More information about the Orxonox-commit mailing list