MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FindSign

Method FindSign

engine/Poseidon/UI/Map/UIMapMain.cpp:1753–1907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1751}
1752
1753SignInfo CStaticMapMain::FindSign(float x, float y)
1754{
1755 AIUnit* me = GetMyUnit();
1756 AIGroup* myGroup = me ? me->GetGroup() : nullptr;
1757 AICenter* myCenter = GetMyCenter();
1758
1759 struct SignInfo info;
1760 info._type = signNone;
1761 info._unit = nullptr;
1762 info._id = nullptr;
1763 if (!myCenter)
1764 {
1765 return info;
1766 }
1767
1768 Point3 pt = ScreenToWorld(DrawCoord(x, y));
1769 float sizeLand = LandGrid * LandRange;
1770 float dist, minDist = 0.02 * sizeLand * _scaleX;
1771 minDist *= minDist;
1772
1773#if _ENABLE_CHEATS
1774 if (_showSensors)
1775 {
1776 for (int i = 0; i < sensorsMap.Size(); i++)
1777 {
1778 Vehicle* veh = sensorsMap[i];
1779 Detector* det = dyn_cast<Detector>(veh);
1780 if (!det)
1781 continue;
1782
1783 dist = (pt - det->Position()).SquareSizeXZ();
1784 if (dist < minDist)
1785 {
1786 minDist = dist;
1787 info._type = signArcadeSensor;
1788 info._index = i;
1789 }
1790 }
1791 }
1792
1793 if (_showUnits)
1794 {
1795 FindUnit(GWorld->GetWestCenter(), pt, info, minDist);
1796 FindUnit(GWorld->GetEastCenter(), pt, info, minDist);
1797 FindUnit(GWorld->GetGuerrilaCenter(), pt, info, minDist);
1798 FindUnit(GWorld->GetCivilianCenter(), pt, info, minDist);
1799 FindUnit(GWorld->GetLogicCenter(), pt, info, minDist);
1800 }
1801 else if (_showTargets)
1802 {
1803 // draw targets
1804 int n = myCenter->NTargets();
1805 for (int i = 0; i < n; i++)
1806 {
1807 const AITargetInfo& target = myCenter->GetTarget(i);
1808 if (target._vanished)
1809 continue;
1810 Object* objTgt = target._idExact;

Callers

nothing calls this directly

Calls 15

FindUnitFunction · 0.85
GetWestCenterMethod · 0.80
GetEastCenterMethod · 0.80
GetGuerrilaCenterMethod · 0.80
GetCivilianCenterMethod · 0.80
GetLogicCenterMethod · 0.80
NTargetsMethod · 0.80
FadingTypeAccuracyMethod · 0.80
IsKindOfMethod · 0.80
IsKnownByMethod · 0.80
FadingSpotabilityMethod · 0.80

Tested by

no test coverage detected