Changeset 6273
- Timestamp:
- Dec 8, 2009, 11:48:52 AM (15 years ago)
- Location:
- code/branches/presentation2/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc
r5929 r6273 41 41 #include "Scene.h" 42 42 #include "Radar.h" 43 #include "controllers/HumanController.h" 44 #include "worldentities/pawns/Pawn.h" 43 45 44 46 namespace orxonox … … 253 255 float HUDNavigation::getDist2Focus() const 254 256 { 255 /* 256 if (Radar::getInstance().getFocus()) 257 return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length(); 258 else 259 */ 257 Radar* radar = this->getOwner()->getScene()->getRadar(); 258 if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn()) 259 return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length(); 260 else 260 261 return 0; 261 262 } -
code/branches/presentation2/src/orxonox/Radar.cc
r5929 r6273 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 … … 46 48 Radar::Radar() 47 49 : focus_(0) 50 , itFocus_(0) 48 51 , objectTypeCounter_(0) 49 52 { … … 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.