| 3218 | } |
| 3219 | |
| 3220 | bool MarineMicroBot::GetPosition(UNIT_TYPEID unit_type, Unit::Alliance alliace, Point2D& position) { |
| 3221 | const ObservationInterface* observation = Observation(); |
| 3222 | Units units = observation->GetUnits(alliace); |
| 3223 | |
| 3224 | if (units.empty()) { |
| 3225 | return false; |
| 3226 | } |
| 3227 | |
| 3228 | position = Point2D(0.0f, 0.0f); |
| 3229 | unsigned int count = 0; |
| 3230 | |
| 3231 | for (const auto& u : units) { |
| 3232 | if (u.unit_type == unit_type) { |
| 3233 | position.x += u.pos.x; |
| 3234 | position.y += u.pos.y; |
| 3235 | ++count; |
| 3236 | } |
| 3237 | } |
| 3238 | |
| 3239 | position.x /= count; |
| 3240 | position.y /= count; |
| 3241 | |
| 3242 | return true; |
| 3243 | } |
| 3244 | |
| 3245 | bool MarineMicroBot::GetNearestZergling(const Point2D& from) { |
| 3246 | const ObservationInterface* observation = Observation(); |
nothing calls this directly
no test coverage detected