Changeset 9163 in orxonox.OLD for branches/presentation/src/world_entities/weapons/aiming_system.cc
- Timestamp:
- Jul 4, 2006, 6:16:00 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9160 r9163 76 76 /** 77 77 * get back the nearest target 78 * @returns the nerest target 78 79 */ 79 80 inline WorldEntity* AimingSystem::getNearestTarget() … … 84 85 return this->selectionList.back(); 85 86 86 // WorldEntity* nearestEntity = this->; 87 WorldEntity* nearestEntity = this->selectionList.back(); 88 float distance = 0.0f; 89 float smalestDistance = this->range * 5.0f; 90 87 91 88 92 for( int i = 0; i < this->selectionList.size(); i++) 89 93 { 94 distance = fabs((this->getAbsCoor() - this->selectionList[i]->getAbsCoor()).len()); 95 if( distance < smalestDistance) 96 { 97 nearestEntity = this->selectionList[i]; 98 smalestDistance = distance; 99 } 100 } 90 101 91 }102 return nearestEntity; 92 103 } 93 104 … … 111 122 void AimingSystem::tick(float dt) 112 123 { 124 125 this->selectionList.clear(); 113 126 } 114 127
Note: See TracChangeset
for help on using the changeset viewer.