- Timestamp:
- May 28, 2008, 7:12:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/hud/RadarOverlayElement.cc
r1454 r1456 81 81 currentDir_ = SpaceShip::getLocalShip()->getDir(); 82 82 currentOrth_ = SpaceShip::getLocalShip()->getOrth(); 83 RadarObject* ro = HUD::getSingleton().getFirstRadarObject();84 83 // iterate through all RadarObjects 85 while(ro != NULL){84 for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){ 86 85 // calc position on radar... 87 float radius = calcRadius(shipPos_, currentDir_, currentOrth_, ro);88 float phi = calcPhi(shipPos_, currentDir_, currentOrth_, ro);89 bool right = calcRight(shipPos_, currentDir_, currentOrth_, ro);86 float radius = calcRadius(shipPos_, currentDir_, currentOrth_, (*it)); 87 float phi = calcPhi(shipPos_, currentDir_, currentOrth_, (*it)); 88 bool right = calcRight(shipPos_, currentDir_, currentOrth_, (*it)); 90 89 91 90 // set size to fit distance... 92 float d = ( ro->getPosition()-shipPos_).length();93 if(d<4000) ro->panel_->setDimensions(4,4);94 else if(d<8000) ro->panel_->setDimensions(3,3);95 else if(d<16000) ro->panel_->setDimensions(2,2);96 else ro->panel_->setDimensions(1,1);91 float d = ((*it)->getPosition()-shipPos_).length(); 92 if(d<4000) (*it)->panel_->setDimensions(4,4); 93 else if(d<8000) (*it)->panel_->setDimensions(3,3); 94 else if(d<16000) (*it)->panel_->setDimensions(2,2); 95 else (*it)->panel_->setDimensions(1,1); 97 96 98 97 if (right){ 99 ro->panel_->setPosition(sin(phi)*radius/98 (*it)->panel_->setPosition(sin(phi)*radius/ 100 99 3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2); 101 100 } 102 101 else { 103 ro->panel_->setPosition(-sin(phi)*radius/102 (*it)->panel_->setPosition(-sin(phi)*radius/ 104 103 3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2); 105 104 } 106 ro = ro->next;107 105 } 108 106 } … … 110 108 void RadarOverlayElement::listObjects(){ 111 109 int i = 0; 112 RadarObject* ro = HUD::getSingleton().getFirstRadarObject();113 110 COUT(3) << "List of RadarObjects:\n"; 114 111 // iterate through all Radar Objects 115 while(ro != NULL) { 116 COUT(3) << i++ << ": " << ro->getPosition() << std::endl; 117 ro = ro->next; 112 for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){ 113 COUT(3) << i++ << ": " << (*it)->getPosition() << std::endl; 118 114 } 119 115 }
Note: See TracChangeset
for help on using the changeset viewer.