Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 3:37:48 AM (15 years ago)
Author:
landauf
Message:
  • Added a health bar
  • Some changes in CameraManager to handle the case when no camera exists after removing the last one, but this is still somehow buggy (freezes and later crashes reproducible but inexplicable after a few respawns)
  • Added PawnManager to handle destruction of Pawns without using delete within tick()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/gametypes/Gametype.cc

    r2361 r2369  
    169169        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    170170        {
    171             if (!it->first->getControllableEntity() && (!it->first->isReadyToSpawn() || !this->bStarted_))
    172             {
    173                 SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
    174                 if (spawn)
    175                 {
    176                     // force spawn at spawnpoint with default pawn
    177                     ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
    178                     spawn->spawn(entity);
    179                     it->first->startControl(entity);
    180                     it->second = PlayerState::Dead;
    181                 }
    182                 else
    183                 {
    184                     COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
    185                     abort();
     171            if (!it->first->getControllableEntity())
     172            {
     173                it->second = PlayerState::Dead;
     174
     175                if (!it->first->isReadyToSpawn() || !this->bStarted_)
     176                {
     177                    SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
     178                    if (spawn)
     179                    {
     180                        // force spawn at spawnpoint with default pawn
     181                        ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
     182                        spawn->spawn(entity);
     183                        it->first->startControl(entity);
     184                        it->second = PlayerState::Dead;
     185                    }
     186                    else
     187                    {
     188                        COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
     189                        abort();
     190                    }
    186191                }
    187192            }
     
    211216                {
    212217                    bool allplayersready = true;
     218                    bool hashumanplayers = false;
    213219                    for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    214220                    {
    215221                        if (!it->first->isReadyToSpawn())
    216222                            allplayersready = false;
    217                     }
    218                     if (allplayersready)
     223                        if (it->first->isHumanPlayer())
     224                            hashumanplayers = true;
     225                    }
     226                    if (allplayersready && hashumanplayers)
    219227                    {
    220228                        this->startCountdown_ = this->initialStartCountdown_;
Note: See TracChangeset for help on using the changeset viewer.