14 static const int DISPLAY_GRID_POS_MAX_CHARS_COUNT = 3;
15 static const int DISPLAY_ALT_MAX_CHARS_COUNT = 4;
17 protected static const string GRID_SIZE_CFG_PATH =
"CfgWorlds %1 Grid Zoom1 stepX";
53 if (item.IsInherited(ItemGPS))
62 if (item.IsInherited(ItemCompass))
74 if (item.IsInherited(ItemGPS))
83 if (item.IsInherited(ItemCompass))
102 if ((
Math.RandomIntInclusive(0, 10) % 2) == 0)
117 return randomizedPosition;
127 float gridSize =
GetGame().ConfigGetFloat(
string.Format(GRID_SIZE_CFG_PATH,
GetGame().GetWorldName()));
129 GetGame().GetWorld().GetGridCoords(pEntity.GetPosition(), gridSize, gridX, gridZ);
131 gridX =
Math.AbsInt(gridX);
132 gridZ =
Math.AbsInt(gridZ);
135 string gridXStr = gridX.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
136 string gridZStr = gridZ.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
140 for (i = 0; i < gridXStr.Length(); ++i)
142 gridCoordNumber = gridXStr.Get(i).ToInt();
143 if (IsOutOfMap(pEntity))
145 gridCoordNumber = -1;
148 positions.Insert(gridCoordNumber);
151 for (i = 0; i < gridZStr.Length(); ++i)
153 gridCoordNumber = gridZStr.Get(i).ToInt();
154 if (IsOutOfMap(pEntity))
156 gridCoordNumber = -1;
159 positions.Insert(gridCoordNumber);
168 float altF = pEntity.GetPosition()[1];
169 int altI =
Math.Round(altF);
170 string altString = altI.ToStringLen(DISPLAY_ALT_MAX_CHARS_COUNT);
172 for (
int i = 0; i < altString.Length(); ++i)
174 altArray.Insert(altString.Get(i).ToInt());
180 static bool IsOutOfMap(
EntityAI pEntity)
182 vector worldPos = pEntity.GetPosition();
184 if (worldPos[0] < 0 || worldPos[0] >
GetGame().GetWorld().GetWorldSize() || worldPos[2] < 0 || worldPos[2] >
GetGame().GetWorld().GetWorldSize())