Changeset 9486 for code/branches/spaceNavigation/src/modules/overlays
- Timestamp:
- Dec 3, 2012, 4:14:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
r9484 r9486 216 216 } 217 217 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 { 221 222 if(listIt == this->sortedObjectList_.begin()) 222 223 { 223 224 it->second.selected_ = true; 224 orxout() << "Closest object selected" << std::endl;225 225 } 226 226 else if(it->second.selected_) 227 227 { 228 228 it->second.selected_ = false; 229 orxout() << "Previous object unselected" << std::endl; 230 } 231 232 } 233 // select the next closest object 229 } 230 231 } 234 232 else if(this->nextTarget_) 233 // select the next object in sortedObjectList 235 234 { 236 235 if(nextHasToBeSelected){ 237 236 it->second.selected_ = true; 238 237 nextHasToBeSelected = false; 239 orxout() << "Next object selected" << std::endl;240 238 } 241 239 else if(it->second.selected_) … … 243 241 nextHasToBeSelected = true; 244 242 it->second.selected_ = false; 245 orxout() << "Previous object unselected" << std::endl; 246 243 244 // check if there's a next object 247 245 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 } 257 257 listIt--; 258 258 } 259 260 261 259 } 262 260 … … 373 371 || it->first->getRVVelocity().squaredLength() == 0 374 372 || 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()*/) 377 376 { 378 377 // don't show marker for not selected enemies nor if the selected doesn't move 379 378 it->second.target_->hide(); 380 379 } 381 else 382 { 380 else // object is selected and moves 381 { 382 // get the aim position 383 383 Vector3* targetPos = this->toAimPosition(it->first); 384 // Transform to screen coordinates 384 385 Vector3 screenPos = camTransform * (*targetPos); 385 386 // Check if the target marker is in view too … … 395 396 it->second.target_->show(); 396 397 } 397 398 398 delete targetPos; 399 399 }
Note: See TracChangeset
for help on using the changeset viewer.