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

Method UnlockPositionMan

engine/Poseidon/AI/AIUnit.cpp:296–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void AILocker::UnlockPositionMan(Vector3Val pos, float radius)
297{
298 int LockRange = toIntCeil(radius * InvOperItemGrid);
299 if (LockRange < 0)
300 {
301 LockRange = 0;
302 }
303
304 int xx, x = toIntFloor(pos.X() * InvOperItemGrid);
305 int zz, z = toIntFloor(pos.Z() * InvOperItemGrid);
306 for (xx = -LockRange; xx <= LockRange; xx++)
307 {
308 for (zz = -LockRange; zz <= LockRange; zz++)
309 {
310 float xr = (x + xx + 0.5f) * OperItemGrid - pos.X();
311 float zr = (z + zz + 0.5f) * OperItemGrid - pos.Z();
312 if (xr * xr + zr * zr < radius * radius || xx == 0 && zz == 0)
313 {
314 UnlockItem(x + xx, z + zz, false);
315 }
316 }
317 }
318}
319
320const Vector3 VUndefined(0, 1e9, 0);
321

Callers 1

PerformUnlockMethod · 0.80

Calls 2

XMethod · 0.45
ZMethod · 0.45

Tested by

no test coverage detected