Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2009, 9:59:34 PM (15 years ago)
Author:
landauf
Message:

moved gametype-HUD from PlayerInfo to HumanPlayer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/miniprojects/src/orxonox/objects/infos/HumanPlayer.cc

    r2806 r2819  
    5454
    5555        this->humanHud_ = 0;
     56        this->gametypeHud_ = 0;
    5657
    5758        this->setConfigValues();
     
    6162    HumanPlayer::~HumanPlayer()
    6263    {
    63         if (this->BaseObject::isInitialized() && this->humanHud_)
    64             delete this->humanHud_;
     64        if (this->BaseObject::isInitialized())
     65        {
     66            if (this->humanHud_)
     67                delete this->humanHud_;
     68
     69            if (this->gametypeHud_)
     70                delete this->gametypeHud_;
     71        }
    6572    }
    6673
     
    115122
    116123            this->createController();
     124            this->updateHumanHUD();
    117125        }
    118126    }
     
    150158    }
    151159
     160    void HumanPlayer::changedGametype()
     161    {
     162        PlayerInfo::changedGametype();
     163
     164        if (this->isInitialized() && this->isLocalPlayer())
     165            if (this->getGametype()->getHUDTemplate() != "")
     166                this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
     167    }
     168
    152169    void HumanPlayer::changedControllableEntity()
    153170    {
     
    156173        if (this->humanHud_)
    157174            this->humanHud_->setOwner(this->getControllableEntity());
     175
     176        if (this->gametypeHud_)
     177            this->gametypeHud_->setOwner(this->getControllableEntity());
    158178    }
    159179
     
    166186        }
    167187
    168         if (this->humanHudTemplate_ != "")
     188        if (this->isLocalPlayer() && this->humanHudTemplate_ != "")
    169189        {
    170190            this->humanHud_ = new OverlayGroup(this);
     
    173193        }
    174194    }
     195
     196    void HumanPlayer::updateGametypeHUD()
     197    {
     198        if (this->gametypeHud_)
     199        {
     200            delete this->gametypeHud_;
     201            this->gametypeHud_ = 0;
     202        }
     203
     204        if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "")
     205        {
     206            this->gametypeHud_ = new OverlayGroup(this);
     207            this->gametypeHud_->addTemplate(this->gametypeHudTemplate_);
     208            this->gametypeHud_->setOwner(this->getControllableEntity());
     209        }
     210    }
    175211}
Note: See TracChangeset for help on using the changeset viewer.