Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 11, 2010, 1:35:49 AM (14 years ago)
Author:
landauf
Message:

compiles and works

Location:
code/branches/lastmanstanding/src/modules/overlays
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding/src/modules/overlays/OverlaysPrereqs.h

    r7163 r7636  
    8888    class HUDTimer;
    8989    class KillMessage;
     90    class LastManStandingInfos;
    9091    class TeamBaseMatchScore;
    9192    class UnderAttackHealthBar;
  • code/branches/lastmanstanding/src/modules/overlays/hud/LastManStandingInfos.cc

    r7635 r7636  
    4343        RegisterObject(LastManStandingInfos);
    4444
    45         this->owner_ = 0;
     45        this->lms_ = 0;
     46        this->player_ = 0;
    4647        this->bShowLives_ = false;
    4748        this->bShowPlayers_ = false;
     
    6465        SUPER(LastManStandingInfos, tick, dt);
    6566
    66         if (this->owner_)
     67        if (this->player_ && this->lms_)
    6768        {
    68 
    69             Pawn* pawn = dynamic_cast<Pawn*>(this->getOwner()->getControllableEntity());
    70             /*LastManStanding* */ owner_ = dynamic_cast<LastManStanding*>(this->getOwner()->getGametype());
    71             int iLives = this->owner_->pawnGetLives(pawn);
    72             const std::string& lives = multi_cast<std::string>(iLives);
    73 
    74             const std::string& players = multi_cast<std::string>(this->owner_->playersAlive);
    75 
    7669            if (this->bShowLives_)
    7770            {
     71                const std::string& lives = multi_cast<std::string>(this->lms_->playerGetLives(this->player_));
    7872                this->setCaption(lives);
    7973            }
    8074            else if(this->bShowPlayers_)
    8175            {
     76                const std::string& players = multi_cast<std::string>(this->lms_->getNumPlayersAlive());
    8277                this->setCaption(players);
    8378            }
    8479        }
    8580    }
     81
     82    void LastManStandingInfos::changedOwner()
     83    {
     84        SUPER(LastManStandingInfos, changedOwner);
     85
     86        if (this->getOwner() && this->getOwner()->getGametype())
     87        {
     88            this->player_ = orxonox_cast<PlayerInfo*>(this->getOwner());
     89            this->lms_ = orxonox_cast<LastManStanding*>(this->getOwner()->getGametype().get());
     90        }
     91        else
     92        {
     93            this->player_ = 0;
     94            this->lms_ = 0;
     95        }
     96    }
    8697}
  • code/branches/lastmanstanding/src/modules/overlays/hud/LastManStandingInfos.h

    r7635 r7636  
    4545            virtual void tick(float dt);
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     47            virtual void changedOwner();
    4748
    4849            inline void setShowLives(bool value)
     
    5758
    5859        private:
    59             LastManStanding* owner_;
     60            LastManStanding* lms_;
     61            PlayerInfo* player_;
    6062            bool bShowLives_;
    6163            bool bShowPlayers_;
Note: See TracChangeset for help on using the changeset viewer.