Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9486


Ignore:
Timestamp:
Dec 3, 2012, 4:14:08 PM (11 years ago)
Author:
mottetb
Message:

hallo

File:
1 edited

Legend:

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

    r9484 r9486  
    216216                }
    217217
    218                 // Selected object
    219                 if(this->closestTarget_) {
    220                     // select the closest object as target
     218                // select the object that aim-assistant indicates
     219                if(this->closestTarget_)
     220                // select the closest object
     221                {
    221222                    if(listIt == this->sortedObjectList_.begin())
    222223                    {
    223224                        it->second.selected_ = true;
    224                         orxout() << "Closest object selected" << std::endl;
    225225                    }
    226226                    else if(it->second.selected_)
    227227                    {
    228228                        it->second.selected_ = false;
    229                         orxout() << "Previous object unselected" << std::endl;
    230                     }
    231 
    232                 }
    233                 // select the next closest object
     229                    }
     230
     231                }
    234232                else if(this->nextTarget_)
     233                // select the next object in sortedObjectList
    235234                {
    236235                    if(nextHasToBeSelected){
    237236                        it->second.selected_ = true;
    238237                        nextHasToBeSelected = false;
    239                         orxout() << "Next object selected" << std::endl;
    240238                    }
    241239                    else if(it->second.selected_)
     
    243241                        nextHasToBeSelected = true;
    244242                        it->second.selected_ = false;
    245                         orxout() << "Previous object unselected" << std::endl;
    246 
     243
     244                        // check if there's a next object
    247245                        listIt++;
    248 
    249                         if (markerCount + 1 >= this->markerLimit_ ||
    250                                 (listIt->second > this->detectionLimit_
    251                                 && detectionLimit_ >= 0))
    252                         {
    253                             this->activeObjectList_.find(this->sortedObjectList_.begin()->first)->second.selected_ = true;
    254                             nextHasToBeSelected = false;
    255                         }
    256 
     246                        if(listIt != this->sortedObjectList_.end())
     247                        {
     248                            // and if the marker limit and max-distance are not exceeded for it
     249                            if (markerCount + 1 >= this->markerLimit_ ||
     250                                    (listIt->second > this->detectionLimit_ && detectionLimit_ >= 0))
     251                            {
     252                                // otherwise select the closest object
     253                                this->activeObjectList_.find(this->sortedObjectList_.begin()->first)->second.selected_ = true;
     254                                nextHasToBeSelected = false;
     255                            }
     256                        }
    257257                        listIt--;
    258258                    }
    259 
    260 
    261259                }
    262260
     
    373371                            || it->first->getRVVelocity().squaredLength() == 0
    374372                            || pawn == NULL
    375                             /*|| humanPawn == NULL
    376                             || pawn->getTeam() == humanPawn->getTeam()*/)
     373                            /* TODO : improve getTeam in such a way that it works
     374                             * || humanPawn == NULL
     375                             * || pawn->getTeam() == humanPawn->getTeam()*/)
    377376                    {
    378377                        // don't show marker for not selected enemies nor if the selected doesn't move
    379378                        it->second.target_->hide();
    380379                    }
    381                     else
    382                     {
     380                    else // object is selected and moves
     381                    {
     382                        // get the aim position
    383383                        Vector3* targetPos = this->toAimPosition(it->first);
     384                        // Transform to screen coordinates
    384385                        Vector3 screenPos = camTransform * (*targetPos);
    385386                        // Check if the target marker is in view too
     
    395396                            it->second.target_->show();
    396397                        }
    397 
    398398                        delete targetPos;
    399399                    }
Note: See TracChangeset for help on using the changeset viewer.