Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2014, 4:27:06 PM (11 years ago)
Author:
maxima
Message:

Changes of Hannes. Upgrading towers does not work yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc

    r10140 r10159  
    3939    {
    4040        RegisterObject(TowerDefenseHUDController);
     41        this->td = 0;
    4142    }
    4243
     
    4950    {
    5051        SUPER(TowerDefenseHUDController, tick, dt);
     52        const std::string& lifes = multi_cast<std::string>(this->td->getLifes());
     53        const std::string& credits = multi_cast<std::string>(this->td->getCredit());
     54        const std::string& waves = multi_cast<std::string>(this->td->getWaveNumber());
    5155
    5256        if(showlives == true)
    53           this->setCaption(multi_cast<std::string>(this->td->life));
     57          this->setCaption(multi_cast<std::string>(lifes));
    5458        else if(showcredits == true)
    55           this->setCaption(multi_cast<std::string>(this->td->credits));
     59          this->setCaption(multi_cast<std::string>(credits));
    5660        else if(showwaves == true)
    57           this->setCaption(multi_cast<std::string>(this->td->waves));
     61          this->setCaption(multi_cast<std::string>(waves));
    5862
    5963
     
    7478            SUPER(TowerDefenseHUDController, changedOwner);
    7579
    76             td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
    77 
     80            if (this->getOwner() && this->getOwner()->getGametype())
     81                    {
     82                        this->td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
     83                    }
     84                    else
     85                    {
     86                        this->td = 0;
     87                    }
     88                }
    7889            /*if (this->getOwner() != NULL && this->getOwner()->getGametype())
    7990            {
     
    8697        }
    8798
    88 }
Note: See TracChangeset for help on using the changeset viewer.