Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2010, 2:56:32 PM (15 years ago)
Author:
sfluecki
Message:

Updates in der reinitialisierung von HUDNavigation → changes in constructor & destructor of HUDNavigation.cc / apparently there is still a segfault when starting the game.

Location:
code/branches/hudelements/src/modules/overlays/hud
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc

    r6886 r6897  
    4646#include "worldentities/pawns/Pawn.h"
    4747#include "worldentities/WorldEntity.h"
     48#include "interfaces/RadarViewable.h"
    4849
    4950namespace orxonox
     
    5556{
    5657    RegisterObject(HUDNavigation);
    57    
    58      
    59      const std::set<RadarViewable*>& respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects();
    60      std::set<RadarViewable*>::const_iterator respawnObjectSetIt_;
    61      
    62      if(!respawnObjectSet_.empty()){
    63      for(respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end();
    64          ++respawnObjectSetIt_){ addObject(*respawnObjectSetIt_);}
    65      }
     58
     59    setFont("Monofur");
     60    setTextSize(0.05f);
     61    setNavMarkerSize(0.05f);
     62
     63    respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 
     64
     65    for (respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end();
     66            ++respawnObjectSetIt_)
     67    {
     68        if (!(*respawnObjectSetIt_)->isHumanShip_)  addObject(*respawnObjectSetIt_);
     69    }
    6670   
    6771//         // create nav text
     
    7478//         navMarker_->setMaterialName("Orxonox/NavArrows");
    7579
    76     /*
    77             // create aim marker
    78             aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
    79                 .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString()));
    80             aimMarker_->setMaterialName("Orxonox/NavCrosshair");
    81             this->wasOutOfView_ = true; // Ensure the material is changed right the first time..
    82 
    83 
    84     */
    85     /*
    86             background_->addChild(navMarker_);*/
     80        /*
     81                // create aim marker
     82                aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     83                    .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString()));
     84                aimMarker_->setMaterialName("Orxonox/NavCrosshair");
     85                this->wasOutOfView_ = true; // Ensure the material is changed right the first time..
     86
     87
     88        */
     89        /*
     90                background_->addChild(navMarker_);*/
    8791//        background_->addChild(aimMarker_);
    8892//         background_->addChild(navText_);
    8993
    90     // hide at first
     94        // hide at first
    9195//         this->setVisible(false);
    9296
    9397
    94     setFont("Monofur");
    95     setTextSize(0.05f);
    96     setNavMarkerSize(0.05f);
     98
    9799//         setAimMarkerSize(0.04f);
    98 }
    99 
    100 HUDNavigation::~HUDNavigation()
    101 {
     100   
     101}
     102
     103HUDNavigation::~HUDNavigation() {
    102104
    103105    if (this->isInitialized())
    104106    {
    105         if (!activeObjectList_.empty())
    106         {
    107             for (tempRadarViewable = activeObjectList_.begin(); tempRadarViewable!=activeObjectList_.end(); ++tempRadarViewable)
    108             {
    109                 Ogre::OverlayManager::getSingleton().destroyOverlayElement(tempRadarViewable->second.first);
    110                 Ogre::OverlayManager::getSingleton().destroyOverlayElement(tempRadarViewable->second.second);
    111 //            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
    112             }
    113         }
    114     }
    115 }
    116 
    117 void HUDNavigation::XMLPort(Element& xmlElement, XMLPort::Mode mode)
    118 {
     107        activeObjectList_.clear();
     108        respawnObjectSet_.clear();
     109    }
     110}
     111
     112void HUDNavigation::XMLPort(Element& xmlElement, XMLPort::Mode mode) {
    119113    SUPER(HUDNavigation, XMLPort, xmlElement, mode);
    120114
     
    304298                tempRadarViewable->second.second->setTop((-pos.y + 1.0f + tempRadarViewable->second.first->getHeight()) * 0.5f);
    305299            }
    306                  
    307     tempRadarViewable->second.first->show();
    308     tempRadarViewable->second.second->show();
    309     }
     300
     301            tempRadarViewable->second.first->show();
     302            tempRadarViewable->second.second->show();
     303        }
    310304
    311305    }
     
    398392}
    399393
     394// void HUDRadar::changedOwner() {
     395//     SUPER(HUDRadar, changedOwner);
     396//
     397//     this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
     398//     assert(this->radarObjects_.size()==0);
     399//     this->gatherObjects();
     400// }
     401
    400402//      void updateActiveObjectList(map activeObjectList_){}
    401403//
  • code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.h

    r6874 r6897  
    3333#include <map>
    3434#include "overlays/OverlaysPrereqs.h"
     35#include "interfaces/RadarViewable.h"
    3536
    3637#include "interfaces/RadarListener.h"
     
    5758    inline float getRadarSensitivity() const {return 1.0f;}
    5859    inline void radarTick(float dt) {}
     60//     virtual void changedOwner();
    5961
    6062
     
    111113    activeObjectListType activeObjectList_;
    112114    activeObjectListType::iterator tempRadarViewable;
     115   
     116    typedef std::set<RadarViewable*> respawnObjectSetType;
     117    respawnObjectSetType respawnObjectSet_;
     118    respawnObjectSetType::iterator respawnObjectSetIt_;
    113119
    114120    std::string fontName_;
  • code/branches/hudelements/src/modules/overlays/hud/HUDRadar.cc

    r6849 r6897  
    188188    void HUDRadar::changedOwner()
    189189    {
    190         SUPER(HUDRadar, changedOwner);
     190    SUPER(HUDRadar, changedOwner);
    191191
    192         this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
    193         assert(this->radarObjects_.size()==0);
    194         this->gatherObjects();
    195     }
     192    this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
     193    assert(this->radarObjects_.size()==0);
     194    this->gatherObjects();
    196195}
     196}
Note: See TracChangeset for help on using the changeset viewer.