Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8875 for code/branches/ai2/src


Ignore:
Timestamp:
Sep 4, 2011, 10:27:17 PM (13 years ago)
Author:
jo
Message:

Radar fix: pawns were not displayed when their visibility/activity changed from 'invisible' to 'visible'.

Location:
code/branches/ai2/src
Files:
6 edited

Legend:

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

    r8874 r8875  
    164164
    165165    unsigned int markerCount_ = 0;
    166     bool closeEnough_ = false; //inly display objects that are close enough to be relevant for the player
     166    bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
    167167//         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
    168168    for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
    169169    {
    170170        ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
    171         if( detectionLimit_ < 0 )
    172             closeEnough_ = true ;
    173         else
    174             closeEnough_ = listIt->second < detectionLimit_ ;
    175         if ( markerCount_ < markerLimit_ && closeEnough_ ) // display on HUD íf statement is true
     171        closeEnough_ = listIt->second < detectionLimit_ ;
     172        if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) ) // display on HUD if the statement is true
    176173        {
    177174
  • code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc

    r8874 r8875  
    124124
    125125    void HUDRadar::objectChanged( RadarViewable* rv )
    126     {
    127         if(rv == dynamic_cast<RadarViewable*>(this->owner_)) //case: player changed
    128             return;
    129         if( showObject(rv) == false ) //case: (radar) invisible object changed
    130             return;
    131         if( this->radarObjects_.find(rv) == this->radarObjects_.end() ) // if (radar) invisibility becomes (radar) visible
    132             this->addObject(rv);
    133         assert( this->radarObjects_.find(rv) != this->radarObjects_.end() );
    134         Ogre::PanelOverlayElement* panel = this->radarObjects_[rv];
    135         panel->setMaterialName(TextureGenerator::getMaterialName(
    136             shapeMaterials_[rv->getRadarObjectShape()], rv->getRadarObjectColour()));
     126    {// The new implementation behaves more precisely, since inactive RadarViewables are not displayed anymore.
     127        this->removeObject(rv);
     128        this->addObject(rv);
    137129    }
    138130
  • code/branches/ai2/src/orxonox/LevelManager.cc

    r8706 r8875  
    8787    void LevelManager::setConfigValues()
    8888    {
    89         SetConfigValue(defaultLevelName_, "presentationDM.oxw")
     89        SetConfigValue(defaultLevelName_, "missionOne.oxw")
    9090            .description("Sets the pre selection of the level in the main menu.");
    9191    }
     
    158158        if (this->levels_.size() > 0)
    159159        {
    160             // Activate the level that is the first in the list of levels whose activity has been requested. 
     160            // Activate the level that is the first in the list of levels whose activity has been requested.
    161161            this->levels_.front()->setActive(true);
    162162            // Make every player enter the newly activated level.
     
    272272                Loader::unload(&file);
    273273
    274                 if(info == NULL) 
     274                if(info == NULL)
    275275                {
    276276                    // Create a default LevelInfoItem object that merely contains the name
  • code/branches/ai2/src/orxonox/interfaces/RadarViewable.h

    r7163 r8875  
    3838#include "core/OrxonoxClass.h"
    3939#include "core/SmartPtr.h"
    40 
     40//TODO: if a RadarViewable changes visibility or activity, the event is not correctly working
    4141namespace orxonox
    4242{
  • code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc

    r8758 r8875  
    452452        this->isHumanShip_ = true;
    453453    }
     454
     455    void Pawn::changedActivity(void)
     456    {
     457        SUPER(Pawn, changedActivity);
     458
     459        this->setRadarVisibility(this->isActive());
     460    }
     461
     462    void Pawn::changedVisibility(void)
     463    {
     464        SUPER(Pawn, changedVisibility);
     465        //this->setVisible(this->isVisible());
     466        this->setRadarVisibility(this->isVisible());
     467    }
     468
    454469}
  • code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.h

    r8852 r8875  
    170170            virtual const Vector3& getCarrierPosition(void) const
    171171                { return this->getWorldPosition(); };
     172            virtual void changedActivity(void); //!< To enable radarviewability when the activity is changed
     173            virtual void changedVisibility(void); //!< To enable proper radarviewability when the visibility is changed
    172174
    173175        protected:
Note: See TracChangeset for help on using the changeset viewer.