Changeset 6417 for code/trunk/src/orxonox/Radar.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Radar.cc
r5929 r6417 40 40 #include "core/ObjectList.h" 41 41 #include "interfaces/RadarListener.h" 42 #include "controllers/HumanController.h" 43 #include "worldentities/pawns/Pawn.h" 42 44 43 45 namespace orxonox … … 45 47 46 48 Radar::Radar() 47 : focus_(0) 49 : itFocus_(0) 50 , focus_(0) 48 51 , objectTypeCounter_(0) 49 52 { … … 82 85 } 83 86 84 RadarViewable::Shape Radar::addObjectDescription(const std::string name)87 RadarViewable::Shape Radar::addObjectDescription(const std::string& name) 85 88 { 86 89 std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name); … … 118 121 void Radar::cycleFocus() 119 122 { 120 if (ObjectList<RadarViewable>::begin() == 0)123 if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end()) 121 124 { 122 125 // list is empty … … 124 127 this->focus_ = 0; 125 128 } 126 /* 127 else if ( this->owner_)129 130 else if (HumanController::getLocalControllerEntityAsPawn()) 128 131 { 129 Vector3 localPosition = this->owner_->getPosition();132 Vector3 localPosition = HumanController::getLocalControllerEntityAsPawn()->getWorldPosition(); 130 133 Vector3 targetPosition = localPosition; 131 if ( *(this->itFocus_))134 if (this->itFocus_ && *(this->itFocus_)) 132 135 targetPosition = this->itFocus_->getRVWorldPosition(); 133 136 134 // find the close dobject further away than targetPosition137 // find the closest object further away than targetPosition 135 138 float currentDistance = localPosition.squaredDistance(targetPosition); 136 139 float nextDistance = FLT_MAX; … … 140 143 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it) 141 144 { 142 if (*it == static_cast<RadarViewable*>( this)->owner_)145 if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn())) 143 146 continue; 144 147 … … 167 170 } 168 171 } 169 */170 172 } 171 173
Note: See TracChangeset
for help on using the changeset viewer.