Changeset 8170 for code/branches/lastmanstanding3/src
- Timestamp:
- Apr 3, 2011, 1:01:28 PM (14 years ago)
- Location:
- code/branches/lastmanstanding3/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding3/src/orxonox/gametypes/LastTeamStanding.cc
r7903 r8170 47 47 this->eachTeamsPlayers.resize(teams_,0); 48 48 this->teamsAlive = 0; 49 this->bMinTeamsReached = false;50 49 this->bNoPunishment = false; 51 50 this->bHardPunishment = false; … … 75 74 playerLives_[player]=getMinLives();//new players only get minimum of lives */ 76 75 77 if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.78 bMinTeamsReached = true; // since there are at least two teams, the game is allowed to end79 76 this->timeToAct_[player] = timeRemaining; 80 77 this->playerDelayTime_[player] = respawnDelay; 81 78 this->inGame_[player] = true; 82 int team = getTeam(player);79 unsigned int team = getTeam(player); 83 80 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 84 81 return; … … 97 94 this->playerDelayTime_.erase(player); 98 95 this->inGame_.erase(player); 99 int team = getTeam(player);96 unsigned int team = getTeam(player); 100 97 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 101 98 return valid_player; … … 119 116 if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives 120 117 { 121 int team = getTeam(victim->getPlayer());118 unsigned int team = getTeam(victim->getPlayer()); 122 119 if(team < 0|| team > teams_) // make sure getTeam returns a regular value 123 120 return allow; … … 189 186 if(this->hasStarted()&&(!this->hasEnded())) 190 187 { 191 if ( bMinTeamsReached &&(this->hasStarted()&&(teamsAlive<=1)))//last team remaining -> game will end188 if ( this->hasStarted()&&(teamsAlive<=1) )//last team remaining -> game will end 192 189 { 193 190 this->end(); … … 236 233 { 237 234 Gametype::end(); 238 235 int party = -1; 236 //find a player who survived 239 237 for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it) 240 238 { … … 243 241 244 242 if (it->second > 0) 245 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID()); 246 else 247 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID()); 248 } 249 243 { 244 //which party has survived? 245 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(it->first); 246 if (it2 != this->teamnumbers_.end()) 247 { 248 party = it2->second; 249 } 250 //if (party < 0) return; //if search failed 251 //victory message to all team members 252 for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3) 253 { 254 if (it3->first->getClientID() == CLIENTID_UNKNOWN) 255 continue; 256 if (it3->second == party) 257 this->gtinfo_->sendAnnounceMessage("You have won the match!", it3->first->getClientID()); 258 else 259 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it3->first->getClientID()); 260 } 261 return; 262 } 263 } 250 264 } 251 265 -
code/branches/lastmanstanding3/src/orxonox/gametypes/LastTeamStanding.h
r7903 r8170 67 67 std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state. 68 68 69 bool bMinTeamsReached; //!< Lock. Game shouldn't end right at the beginning.70 71 69 virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn. 72 70 virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
Note: See TracChangeset
for help on using the changeset viewer.