Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9495


Ignore:
Timestamp:
Dec 10, 2012, 2:48:10 PM (12 years ago)
Author:
mottetb
Message:

fertig

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

Legend:

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

    r9486 r9495  
    190190        bool closeEnough = false; // only display objects that are close enough to be relevant for the player
    191191
     192        // if the selected object doesn't exist any more or is now out of range select the closest object
     193        std::map<RadarViewable*, ObjectInfo>::iterator selectedActiveObject = this->activeObjectList_.find(this->selectedTarget_);
     194        if(selectedActiveObject == this->activeObjectList_.end())
     195        {
     196            this->closestTarget_ = true;
     197        }
     198        else if(this->detectionLimit_ < (this->selectedTarget_->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f)
     199        {
     200            this->closestTarget_ = true;
     201            selectedActiveObject->second.selected_ = false;
     202        }
     203
    192204        bool nextHasToBeSelected = false;
    193205
     
    223235                    {
    224236                        it->second.selected_ = true;
     237                        this->selectedTarget_ = it->first;
    225238                    }
    226239                    else if(it->second.selected_)
     
    235248                    if(nextHasToBeSelected){
    236249                        it->second.selected_ = true;
     250                        this->selectedTarget_ = it->first;
    237251                        nextHasToBeSelected = false;
    238252                    }
     
    252266                                // otherwise select the closest object
    253267                                this->activeObjectList_.find(this->sortedObjectList_.begin()->first)->second.selected_ = true;
     268                                this->selectedTarget_ = it->first;
    254269                                nextHasToBeSelected = false;
    255270                            }
     
    564579        {
    565580            HUDNavigation::localHUD_s->closestTarget_ = true;
    566             orxout() << "selectClosestTarget" << std::endl;
    567581        }
    568582    }
     
    573587        {
    574588            HUDNavigation::localHUD_s->nextTarget_ = true;
    575             orxout() << "selectNextTarget" << std::endl;
    576589        }
    577590    }
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h

    r9484 r9495  
    127127            bool showDistance_;
    128128
     129            RadarViewable* selectedTarget_;
     130
    129131            bool closestTarget_;
    130132            bool nextTarget_;
Note: See TracChangeset for help on using the changeset viewer.