Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2009, 5:13:34 PM (16 years ago)
Author:
dafrick
Message:

Updated questsystem to current trunk. Synchronized it with my local state of things. The Notifications are not yet working, though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5/src/orxonox/overlays/OverlayGroup.cc

    r2662 r2779  
    107107    void OverlayGroup::addElement(OrxonoxOverlay* element)
    108108    {
    109         if (hudElements_.find(element->getName()) != hudElements_.end())
     109        this->insertElement(element, element->getName());
     110    }
     111
     112        /**
     113    @brief
     114        Adds an element to the map.
     115    @param element
     116        The element to be added.
     117    @param name
     118        The name of the element.
     119    @remarks
     120        The names of the OrxonoxOverlays have to be unique!
     121    */
     122    void OverlayGroup::insertElement(OrxonoxOverlay* element, const std::string & name)
     123    {
     124        element->setName(name);
     125        if (hudElements_.find(name) != hudElements_.end())
    110126        {
    111127            COUT(1) << "Ambiguous names encountered while load the HUD overlays" << std::endl;
     
    113129        else
    114130        {
    115             hudElements_[element->getName()] = element;
     131            hudElements_[name] = element;
    116132            element->setVisible(this->isVisible());
    117             if (this->owner_)
     133                        if (this->owner_)
    118134                element->setOwner(this->owner_);
    119135        }
     136    }
     137
     138        /**
     139    @brief
     140        Removes an element from the map.
     141    @param name
     142        The name of the element that is removed.
     143    @return
     144        Returns true if there was such an element to remove, false if not.
     145    */
     146    bool OverlayGroup::removeElement(const std::string & name)
     147    {
     148        if(this->hudElements_.erase(name) == 0)
     149            return false;
     150        return true;
    120151    }
    121152
Note: See TracChangeset for help on using the changeset viewer.