Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 19, 2010, 11:14:32 AM (15 years ago)
Author:
rgrieder
Message:

Some more hackery for the PlayerInfo↔GUIOverlay relation.
Seems to work now mostly. But I still get a segfault when I pick up the red one and the PickupInventory doesn't disappear with the "Back" button.

Location:
code/trunk/src/modules/overlays
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/overlays/GUIOverlay.cc

    r6417 r6753  
    6464
    6565        //Setting player now.
    66         if( this->getOwner() )
    67             GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer());
     66        if (this->getOwner())
     67        {
     68            ControllableEntity* entity = orxonox_cast<ControllableEntity*>(this->getOwner());
     69            if (entity)
     70                GUIManager::getInstance().setPlayer(this->guiName_, entity->getPlayer());
     71        }
    6872
    6973        if (this->isVisible())
     
    8791    {
    8892        this->guiName_ = name;
    89         GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner())); //Set Player is going to be NULL, so it needs to be set in changedVisibility() as well.
     93        if (this->getOwner())
     94        {
     95            ControllableEntity* entity = orxonox_cast<ControllableEntity*>(this->getOwner());
     96            if (entity)
     97                GUIManager::getInstance().setPlayer(name, entity->getPlayer()); //Set Player is going to be NULL, so it needs to be set in changedVisibility() as well.
     98        }
     99    }
     100
     101    void GUIOverlay::changedOwner()
     102    {
     103        SUPER(GUIOverlay, changedOwner);
     104        if (!this->getGUIName().empty())
     105            this->setGUIName(this->getGUIName());
    90106    }
    91107}
  • code/trunk/src/modules/overlays/GUIOverlay.h

    r5781 r6753  
    5050
    5151            virtual void changedVisibility();
     52            virtual void changedOwner();
    5253
    5354        private:
Note: See TracChangeset for help on using the changeset viewer.