Changeset 11067
- Timestamp:
- Jan 17, 2016, 2:58:59 PM (9 years ago)
- Location:
- code/branches/cpp11_v3/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3/src/orxonox/controllers/SectionController.cc
r11065 r11067 174 174 this->setFormationMode( this->myDivisionLeader_->getFormationMode() ); 175 175 this->spread_ = this->myDivisionLeader_->getSpread(); 176 Vector3* targetRelativePosition;177 176 switch (this->formationMode_){ 178 177 case FormationMode::WALL: 179 { 180 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 0); 181 break; 182 } 178 return Vector3 (-2.0f*this->spread_, 0, 0); 179 183 180 case FormationMode::FINGER4: 184 { 185 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_); 186 break; 187 } 181 return Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_); 188 182 189 183 case FormationMode::DIAMOND: 190 { 191 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_); 192 break; 193 } 194 } 195 Vector3 result = *targetRelativePosition; 196 delete targetRelativePosition; 197 return result; 184 return Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_); 185 186 default: 187 return Vector3::ZERO; 188 } 198 189 } 199 190 -
code/branches/cpp11_v3/src/orxonox/controllers/WingmanController.cc
r11065 r11067 107 107 Vector3 WingmanController::getFormationPosition () 108 108 { 109 110 111 109 this->setFormationMode( this->myLeader_->getFormationMode() ); 112 Vector3* targetRelativePosition;113 110 this->spread_ = this->myLeader_->getSpread(); 114 111 if (this->myLeader_->getIdentifier()->getName() == "DivisionController") … … 116 113 switch (this->formationMode_){ 117 114 case FormationMode::WALL: 118 { 119 targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_); 120 break; 121 } 115 return Vector3 (2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_); 122 116 case FormationMode::FINGER4: 123 { 124 targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 125 break; 126 } 117 return Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 127 118 case FormationMode::DIAMOND: 128 { 129 targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 130 break; 131 } 119 return Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 120 default: 121 return Vector3::ZERO; 132 122 } 133 123 } … … 136 126 switch (this->formationMode_){ 137 127 case FormationMode::WALL: 138 { 139 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_); 140 break; 141 } 128 return Vector3 (-2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_); 142 129 case FormationMode::FINGER4: 143 { 144 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 145 break; 146 } 130 return Vector3 (-2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_); 147 131 case FormationMode::DIAMOND: 148 { 149 targetRelativePosition = new Vector3 (2.0f*this->spread_, -1.0f*this->spread_, 0 - 1.0f*this->tolerance_); 150 break; 151 } 132 return Vector3 (2.0f*this->spread_, -1.0f*this->spread_, 0 - 1.0f*this->tolerance_); 133 default: 134 return Vector3::ZERO; 152 135 } 153 136 } 154 Vector3 result = *targetRelativePosition;155 delete targetRelativePosition;156 return result;157 137 } 158 138 void WingmanController::keepFormation()
Note: See TracChangeset
for help on using the changeset viewer.