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

Function PositionToAA11

engine/Poseidon/UI/Map/UIMap.cpp:189–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void PositionToAA11(Vector3Val pos, char* buffer)
190{
191 float sizeLand = LandGrid * LandRange;
192
193 const GridInfo* info = GWorld->GetGridInfo(0);
194 if (!info)
195 {
196 return;
197 }
198
199 float offsetX = GWorld->GetGridOffsetX();
200 float offsetY = GWorld->GetGridOffsetY();
201
202 *buffer = 0;
203 for (const char* p = info->format; *p != 0; p++)
204 {
205 if (*p == 'X' || *p == 'x')
206 {
207 float coefX = sizeLand * info->invStepX;
208 int x = TO_INT(coefX, (pos.X() - offsetX) * info->invStepX);
209 BString<32> buf;
210 GridFormat(buf, info->formatX, coefX >= 0 ? x : x - 1);
211 strcat(buffer, buf);
212 }
213 else if (*p == 'Y' || *p == 'y')
214 {
215 float coefY = sizeLand * info->invStepX;
216 int y = TO_INT(coefY, (sizeLand - pos.Z() - offsetY) * info->invStepY);
217 BString<32> buf;
218 GridFormat(buf, info->formatY, coefY >= 0 ? y : y - 1);
219 strcat(buffer, buf);
220 }
221 else
222 {
223 AddChar(buffer, *p);
224 }
225 }
226}
227
228void MapTypeInfo::Load(const ParamEntry& cls)
229{

Callers 6

ConnectMethod · 0.85
PrepareSentenceMethod · 0.85
OnVehicleDestroyedMethod · 0.85
PrepareSentenceMethod · 0.85
OnDrawMethod · 0.85
OnDrawMethod · 0.85

Calls 7

GridFormatFunction · 0.85
AddCharFunction · 0.85
GetGridInfoMethod · 0.80
GetGridOffsetXMethod · 0.80
GetGridOffsetYMethod · 0.80
XMethod · 0.45
ZMethod · 0.45

Tested by

no test coverage detected