[Orxonox-commit 2840] r7543 - code/branches/lastmanstanding/src/orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Thu Oct 14 23:58:56 CEST 2010
Author: jo
Date: 2010-10-14 23:58:56 +0200 (Thu, 14 Oct 2010)
New Revision: 7543
Modified:
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
Log:
Bug description. Couldn't find a solution though.
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-14 21:02:57 UTC (rev 7542)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-14 21:58:56 UTC (rev 7543)
@@ -189,26 +189,40 @@
else
return 0;
}
-
+ /*BUG-Description:
+ *There are two ways for a player to be killed: Either receiving damage, or through the following function.
+ *The function works fine - until the last call, when a player looses his last live. Than the kill part
+ *(it->second.state_ = PlayerState::Dead;) somehow isn't executed:
+ *The player isn't killed (he doesn't leave play). Although the corresponding code is reached.
+ *
+ *How to reproduce this bug: Start a new Lastmanstanding-Match. Immdiately add 8 bots(before actually entering the level).
+ *Just fly around and wait. Don't shoot, since only passive behaviour triggers the killPlayer-Function.
+ */
void LastManStanding::killPlayer(PlayerInfo* player)
{
if(!player)
return;
- std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);//!!!!!!!!!!!
+ std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
if (it != this->players_.end())
{
- it->second.state_ = PlayerState::Dead;//-------------killpart
- it->second.killed_++;
-
- playerLives_[player]=playerLives_[player]-1;//-----------datapart
- if (playerLives_[player]<=0)//if player lost all lives
+ if (playerLives_[player]<=1)//if player lost all lives
{
this->playersAlive--;
const std::string& message = player->getName() + " is out";
COUT(0) << message << std::endl;
Host::Broadcast(message);
+ playerLives_[player]=playerLives_[player]-1;//-----------datapart
+ it->second.killed_++;
+ it->second.state_ = PlayerState::Dead;//-------------killpart
}
- this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
+ else
+ {
+ playerLives_[player]=playerLives_[player]-1;//-----------datapart
+ it->second.killed_++;
+ it->second.state_ = PlayerState::Dead;//-------------killpart
+
+ this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
+ }
}
}
More information about the Orxonox-commit
mailing list