Changeset 7543 for code/branches/lastmanstanding/src
- Timestamp:
- Oct 14, 2010, 11:58:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
r7542 r7543 190 190 return 0; 191 191 } 192 192 /*BUG-Description: 193 *There are two ways for a player to be killed: Either receiving damage, or through the following function. 194 *The function works fine - until the last call, when a player looses his last live. Than the kill part 195 *(it->second.state_ = PlayerState::Dead;) somehow isn't executed: 196 *The player isn't killed (he doesn't leave play). Although the corresponding code is reached. 197 * 198 *How to reproduce this bug: Start a new Lastmanstanding-Match. Immdiately add 8 bots(before actually entering the level). 199 *Just fly around and wait. Don't shoot, since only passive behaviour triggers the killPlayer-Function. 200 */ 193 201 void LastManStanding::killPlayer(PlayerInfo* player) 194 202 { 195 203 if(!player) 196 204 return; 197 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); //!!!!!!!!!!!205 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); 198 206 if (it != this->players_.end()) 199 207 { 200 it->second.state_ = PlayerState::Dead;//-------------killpart 201 it->second.killed_++; 202 203 playerLives_[player]=playerLives_[player]-1;//-----------datapart 204 if (playerLives_[player]<=0)//if player lost all lives 208 if (playerLives_[player]<=1)//if player lost all lives 205 209 { 206 210 this->playersAlive--; … … 208 212 COUT(0) << message << std::endl; 209 213 Host::Broadcast(message); 210 } 211 this->timeToAct_[player]=timeRemaining+3.0f;//reset timer 214 playerLives_[player]=playerLives_[player]-1;//-----------datapart 215 it->second.killed_++; 216 it->second.state_ = PlayerState::Dead;//-------------killpart 217 } 218 else 219 { 220 playerLives_[player]=playerLives_[player]-1;//-----------datapart 221 it->second.killed_++; 222 it->second.state_ = PlayerState::Dead;//-------------killpart 223 224 this->timeToAct_[player]=timeRemaining+3.0f;//reset timer 225 } 212 226 } 213 227 }
Note: See TracChangeset
for help on using the changeset viewer.