| 1761 | _path[0]._cost = 0; |
| 1762 | _path[1]._pos = GLandscape->PointOnSurface(_expPosition[0], combatHeight, _expPosition[2]); |
| 1763 | _path[1]._cost = cost; |
| 1764 | } |
| 1765 | _path.SetMaxIndex(2); |
| 1766 | _path.SetOperIndex(1); |
| 1767 | _path.SetOnRoad(false); |
| 1768 | _path.SetSearchTime(Glob.time); |
| 1769 | } |
| 1770 | |
| 1771 | static const IPaths* InsideBuilding(Vector3Val pos) |
| 1772 | { |
| 1773 | int xMin, xMax, zMin, zMax; |
| 1774 | ObjRadiusRectangle(xMin, xMax, zMin, zMax, pos, pos, 50); |
| 1775 | int x, z; |
| 1776 | for (x = xMin; x <= xMax; x++) |
| 1777 | { |
| 1778 | for (z = zMin; z <= zMax; z++) |
| 1779 | { |
| 1780 | const ObjectList& list = GLandscape->GetObjects(z, x); |
| 1781 | int n = list.Size(); |
| 1782 | for (int i = 0; i < n; i++) |
| 1783 | { |
| 1784 | Object* obj = list[i]; |
| 1785 | |
| 1786 | if (!obj->GetShape()) |
| 1787 | { |
| 1788 | continue; |
| 1789 | } |
| 1790 | if (obj->GetShape()->FindPaths() < 0) |
| 1791 | { |
| 1792 | continue; |
| 1793 | } |
| 1794 | // vehicle with paths - must be building |
| 1795 | float dist2 = obj->Position().Distance2(pos); |
| 1796 | if (dist2 > Square(obj->GetShape()->BoundingSphere())) |
| 1797 | { |
| 1798 | continue; |
| 1799 | } |
| 1800 | // pos is inside vehicle's bounding |
| 1801 | |
| 1802 | const IPaths* building = obj->GetIPaths(); |
| 1803 | if (!building) |
| 1804 | { |
| 1805 | continue; |
| 1806 | } |
| 1807 | |
| 1808 | // check if point is near of some path in building |
| 1809 | Vector3 nearest; |
| 1810 | int nearestIndex = building->FindNearestPoint(pos, nearest, Square(2.5)); |
| 1811 | if (nearestIndex >= 0) |
| 1812 | { |
| 1813 | return building; |
| 1814 | } |
no test coverage detected