Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 14, 2010, 11:58:56 PM (14 years ago)
Author:
jo
Message:

Bug description. Couldn't find a solution though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc

    r7542 r7543  
    190190            return 0;
    191191    }
    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    */
    193201    void LastManStanding::killPlayer(PlayerInfo* player)
    194202    {
    195203        if(!player)
    196204            return;
    197         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);//!!!!!!!!!!!
     205        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
    198206        if (it != this->players_.end())
    199207        {
    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
    205209            {
    206210                this->playersAlive--;
     
    208212                COUT(0) << message << std::endl;
    209213                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            }
    212226        }
    213227    }
Note: See TracChangeset for help on using the changeset viewer.