Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2011, 12:35:33 AM (12 years ago)
Author:
jo
Message:

Repairing the radar.

Location:
code/branches/presentation2011/src/modules/overlays/hud
Files:
2 edited

Legend:

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

    r8988 r8993  
    7676
    7777    // Set default values
    78     setFont ( "Monofur" );
    79     setTextSize ( 0.05f );
    80     setNavMarkerSize ( 0.05f );
     78    this->setFont ( "Monofur" );
     79    this->setTextSize ( 0.05f );
     80    this->setNavMarkerSize ( 0.05f );
     81    this->setDetectionLimit( 10000.0f );
    8182}
    8283
     
    100101    XMLPortParam ( HUDNavigation, "textSize",      setTextSize,      getTextSize,      xmlelement, mode );
    101102    XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode );
     103    XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode );
    102104}
    103105
     
    175177
    176178    unsigned int markerCount_ = 0;
     179    bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
    177180
    178181//         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
     
    180183    {
    181184        ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
    182 
    183         if ( markerCount_ < markerLimit_ )
     185        closeEnough_ = listIt->second < detectionLimit_ ;
     186        // display radarviewables on HUD if the marker limit and max-distance is not exceeded
     187        if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) )
    184188        {
    185189
     
    307311            it->second.text_->show();
    308312        }
    309         else
     313        else // do not display on HUD
    310314        {
    311315            it->second.panel_->hide();
  • code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h

    r8988 r8993  
    8585    // XMLPort accessors
    8686    void setNavMarkerSize ( float size )
    87     { navMarkerSize_ = size; this->sizeChanged(); }
     87        { navMarkerSize_ = size; this->sizeChanged(); }
    8888    float getNavMarkerSize() const
    89     { return navMarkerSize_; }
    90 
     89        { return navMarkerSize_; }
     90    void setDetectionLimit( float limit )
     91        { this->detectionLimit_ = limit; }
     92    float getDetectionLimit() const
     93        { return this->detectionLimit_; }
    9194
    9295    void setTextSize ( float size );
     
    110113    bool showDistance;
    111114
    112     unsigned int markerLimit_;;
    113 
     115    unsigned int markerLimit_;
     116    float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
    114117
    115118};
Note: See TracChangeset for help on using the changeset viewer.