| 1657 | } |
| 1658 | |
| 1659 | void CStaticMapMain::FindUnit(AICenter* center, Vector3Par pt, SignInfo& info, float& minDist) |
| 1660 | { |
| 1661 | if (!center) |
| 1662 | { |
| 1663 | return; |
| 1664 | } |
| 1665 | |
| 1666 | for (int i = 0; i < center->NGroups(); i++) |
| 1667 | { |
| 1668 | AIGroup* grp = center->GetGroup(i); |
| 1669 | if (!grp) |
| 1670 | { |
| 1671 | continue; |
| 1672 | } |
| 1673 | for (int j = 0; j < MAX_UNITS_PER_GROUP; j++) |
| 1674 | { |
| 1675 | AIUnit* unit = grp->UnitWithID(j + 1); |
| 1676 | if (!unit) |
| 1677 | { |
| 1678 | continue; |
| 1679 | } |
| 1680 | float dist = (pt - unit->Position()).SquareSizeXZ(); |
| 1681 | if (dist < minDist) |
| 1682 | { |
| 1683 | minDist = dist; |
| 1684 | info._type = signUnit; |
| 1685 | info._unit = unit; |
| 1686 | } |
| 1687 | } |
| 1688 | } |
| 1689 | } |
| 1690 | |
| 1691 | void CStaticMapMain::FindWaypoint(AICenter* myCenter, AIGroup* myGroup, Vector3Par pt, SignInfo& info, float& minDist) |
| 1692 | { |
no test coverage detected