Changeset 9495
- Timestamp:
- Dec 10, 2012, 2:48:10 PM (12 years ago)
- 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 190 190 bool closeEnough = false; // only display objects that are close enough to be relevant for the player 191 191 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 192 204 bool nextHasToBeSelected = false; 193 205 … … 223 235 { 224 236 it->second.selected_ = true; 237 this->selectedTarget_ = it->first; 225 238 } 226 239 else if(it->second.selected_) … … 235 248 if(nextHasToBeSelected){ 236 249 it->second.selected_ = true; 250 this->selectedTarget_ = it->first; 237 251 nextHasToBeSelected = false; 238 252 } … … 252 266 // otherwise select the closest object 253 267 this->activeObjectList_.find(this->sortedObjectList_.begin()->first)->second.selected_ = true; 268 this->selectedTarget_ = it->first; 254 269 nextHasToBeSelected = false; 255 270 } … … 564 579 { 565 580 HUDNavigation::localHUD_s->closestTarget_ = true; 566 orxout() << "selectClosestTarget" << std::endl;567 581 } 568 582 } … … 573 587 { 574 588 HUDNavigation::localHUD_s->nextTarget_ = true; 575 orxout() << "selectNextTarget" << std::endl;576 589 } 577 590 } -
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
r9484 r9495 127 127 bool showDistance_; 128 128 129 RadarViewable* selectedTarget_; 130 129 131 bool closestTarget_; 130 132 bool nextTarget_;
Note: See TracChangeset
for help on using the changeset viewer.