Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 127.08 KB | None | 0 0
  1. Index: 0ad/build/workspaces/update-workspaces.sh
  2. ===================================================================
  3. --- 0ad/build/workspaces/update-workspaces.sh (revision 24769)
  4. +++ 0ad/build/workspaces/update-workspaces.sh (working copy)
  5. @@ -130,7 +130,8 @@
  6.  
  7. echo "Premake args: ${premake_args}"
  8. if [ "`uname -s`" != "Darwin" ]; then
  9. - ${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
  10. + # ${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args}
  11. + ${premake_command} --file="premake5.lua" --outpath="../workspaces/codelite/" ${premake_args} codelite || die "Premake failed"
  12. else
  13. ${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} gmake || die "Premake failed"
  14. # Also generate xcode workspaces if on OS X
  15. Index: 0ad/source/graphics/CinemaManager.cpp
  16. ===================================================================
  17. --- 0ad/source/graphics/CinemaManager.cpp (revision 24769)
  18. +++ 0ad/source/graphics/CinemaManager.cpp (working copy)
  19. @@ -174,7 +174,7 @@
  20. glBegin(GL_POINTS);
  21.  
  22. for (const SplineData& node : spline.GetAllNodes())
  23. - glVertex3f(node.Position.X.ToFloat(), node.Position.Y.ToFloat(), node.Position.Z.ToFloat());
  24. + glVertex3f(node.Position.getX().ToFloat(), node.Position.getY().ToFloat(), node.Position.getZ().ToFloat());
  25.  
  26. glEnd();
  27. glPointSize(1.0f);
  28. Index: 0ad/source/graphics/MapReader.cpp
  29. ===================================================================
  30. --- 0ad/source/graphics/MapReader.cpp (revision 24769)
  31. +++ 0ad/source/graphics/MapReader.cpp (working copy)
  32. @@ -321,7 +321,7 @@
  33. {
  34. // Use player starting camera
  35. CFixedVector3D pos = cmpPlayer->GetStartingCameraPos();
  36. - pGameView->ResetCameraTarget(CVector3D(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat()));
  37. + pGameView->ResetCameraTarget(CVector3D(pos.getX().ToFloat(), pos.getY().ToFloat(), pos.getZ().ToFloat()));
  38. }
  39. else if (m_StartingCameraTarget != INVALID_ENTITY)
  40. {
  41. @@ -330,7 +330,7 @@
  42. if (cmpPosition)
  43. {
  44. CFixedVector3D pos = cmpPosition->GetPosition();
  45. - pGameView->ResetCameraTarget(CVector3D(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat()));
  46. + pGameView->ResetCameraTarget(CVector3D(pos.getX().ToFloat(), pos.getY().ToFloat(), pos.getZ().ToFloat()));
  47. }
  48. }
  49. }
  50. @@ -1053,8 +1053,8 @@
  51. CmpPtr<ICmpPosition> cmpPosition(sim, ent);
  52. if (cmpPosition)
  53. {
  54. - cmpPosition->JumpTo(Position.X, Position.Z);
  55. - cmpPosition->SetYRotation(Orientation.Y);
  56. + cmpPosition->JumpTo(Position.getX(), Position.getZ());
  57. + cmpPosition->SetYRotation(Orientation.getY());
  58. // TODO: other parts of the position
  59. }
  60.  
  61. @@ -1432,8 +1432,8 @@
  62. CmpPtr<ICmpPosition> cmpPosition(sim, ent);
  63. if (cmpPosition)
  64. {
  65. - cmpPosition->JumpTo(currEnt.position.X * (int)TERRAIN_TILE_SIZE, currEnt.position.Z * (int)TERRAIN_TILE_SIZE);
  66. - cmpPosition->SetYRotation(currEnt.rotation.Y);
  67. + cmpPosition->JumpTo(currEnt.position.getX() * (int)TERRAIN_TILE_SIZE, currEnt.position.getZ() * (int)TERRAIN_TILE_SIZE);
  68. + cmpPosition->SetYRotation(currEnt.rotation.getY());
  69. // TODO: other parts of the position
  70. }
  71.  
  72. Index: 0ad/source/graphics/MapWriter.cpp
  73. ===================================================================
  74. --- 0ad/source/graphics/MapWriter.cpp (revision 24769)
  75. +++ 0ad/source/graphics/MapWriter.cpp (working copy)
  76. @@ -378,13 +378,13 @@
  77. CFixedVector3D rot = cmpPosition->GetRotation();
  78. {
  79. XMLWriter_Element positionTag(xmlMapFile, "Position");
  80. - positionTag.Attribute("x", pos.X);
  81. - positionTag.Attribute("z", pos.Z);
  82. + positionTag.Attribute("x", pos.getX());
  83. + positionTag.Attribute("z", pos.getZ());
  84. // TODO: height offset etc
  85. }
  86. {
  87. XMLWriter_Element orientationTag(xmlMapFile, "Orientation");
  88. - orientationTag.Attribute("y", rot.Y);
  89. + orientationTag.Attribute("y", rot.getY());
  90. // TODO: X, Z maybe
  91. }
  92. }
  93. @@ -491,9 +491,9 @@
  94. {
  95. // Types: Position/Rotation/Target
  96. XMLWriter_Element eventTypeTag(xmlMapFile, events[j].type);
  97. - eventTypeTag.Attribute("x", events[j].value.X);
  98. - eventTypeTag.Attribute("y", events[j].value.Y);
  99. - eventTypeTag.Attribute("z", events[j].value.Z);
  100. + eventTypeTag.Attribute("x", events[j].value.getX());
  101. + eventTypeTag.Attribute("y", events[j].value.getY());
  102. + eventTypeTag.Attribute("z", events[j].value.getZ());
  103. }
  104. i = j;
  105. }
  106. Index: 0ad/source/graphics/Terrain.cpp
  107. ===================================================================
  108. --- 0ad/source/graphics/Terrain.cpp (revision 24769)
  109. +++ 0ad/source/graphics/Terrain.cpp (working copy)
  110. @@ -133,10 +133,10 @@
  111. ssize_t hi = Clamp(i, static_cast<ssize_t>(0), m_MapSize - 1);
  112. ssize_t hj = Clamp(j, static_cast<ssize_t>(0), m_MapSize - 1);
  113. u16 height = m_Heightmap[hj*m_MapSize + hi];
  114. - pos.X = fixed::FromInt(i) * (int)TERRAIN_TILE_SIZE;
  115. + pos.Xref() = fixed::FromInt(i) * (int)TERRAIN_TILE_SIZE;
  116. // fixed max value is 32767, but height is a u16, so divide by two to avoid overflow
  117. - pos.Y = fixed::FromInt(height/ 2 ) / ((int)HEIGHT_UNITS_PER_METRE / 2);
  118. - pos.Z = fixed::FromInt(j) * (int)TERRAIN_TILE_SIZE;
  119. + pos.Yref() = fixed::FromInt(height/ 2 ) / ((int)HEIGHT_UNITS_PER_METRE / 2);
  120. + pos.Zref() = fixed::FromInt(j) * (int)TERRAIN_TILE_SIZE;
  121. }
  122.  
  123.  
  124. Index: 0ad/source/graphics/tests/test_Terrain.h
  125. ===================================================================
  126. --- 0ad/source/graphics/tests/test_Terrain.h (revision 24769)
  127. +++ 0ad/source/graphics/tests/test_Terrain.h (working copy)
  128. @@ -181,19 +181,19 @@
  129. CFixedVector3D vec;
  130.  
  131. terrain.CalcNormalFixed(1, 1, vec);
  132. - TS_ASSERT_DELTA(vec.X.ToFloat(), -1.f/sqrt(2.f), 0.01f);
  133. - TS_ASSERT_DELTA(vec.Y.ToFloat(), 1.f/sqrt(2.f), 0.01f);
  134. - TS_ASSERT_EQUALS(vec.Z.ToFloat(), 0.f);
  135. + TS_ASSERT_DELTA(vec.getX().ToFloat(), -1.f/sqrt(2.f), 0.01f);
  136. + TS_ASSERT_DELTA(vec.getY().ToFloat(), 1.f/sqrt(2.f), 0.01f);
  137. + TS_ASSERT_EQUALS(vec.getZ().ToFloat(), 0.f);
  138.  
  139. terrain.CalcNormalFixed(2, 1, vec);
  140. - TS_ASSERT_DELTA(vec.X.ToFloat(), (-1.f/sqrt(2.f)) / sqrt(2.f+sqrt(2.f)), 0.01f);
  141. - TS_ASSERT_DELTA(vec.Y.ToFloat(), (1.f+1.f/sqrt(2.f)) / sqrt(2.f+sqrt(2.f)), 0.01f);
  142. - TS_ASSERT_EQUALS(vec.Z.ToFloat(), 0);
  143. + TS_ASSERT_DELTA(vec.getX().ToFloat(), (-1.f/sqrt(2.f)) / sqrt(2.f+sqrt(2.f)), 0.01f);
  144. + TS_ASSERT_DELTA(vec.getY().ToFloat(), (1.f+1.f/sqrt(2.f)) / sqrt(2.f+sqrt(2.f)), 0.01f);
  145. + TS_ASSERT_EQUALS(vec.getZ().ToFloat(), 0);
  146.  
  147. terrain.CalcNormalFixed(5, 1, vec);
  148. - TS_ASSERT_EQUALS(vec.X.ToFloat(), 0.f);
  149. - TS_ASSERT_EQUALS(vec.Y.ToFloat(), 1.f);
  150. - TS_ASSERT_EQUALS(vec.Z.ToFloat(), 0.f);
  151. + TS_ASSERT_EQUALS(vec.getX().ToFloat(), 0.f);
  152. + TS_ASSERT_EQUALS(vec.getY().ToFloat(), 1.f);
  153. + TS_ASSERT_EQUALS(vec.getZ().ToFloat(), 0.f);
  154. }
  155.  
  156. void test_Resize()
  157. Index: 0ad/source/lib/self_test.h
  158. ===================================================================
  159. --- 0ad/source/lib/self_test.h (revision 24769)
  160. +++ 0ad/source/lib/self_test.h (working copy)
  161. @@ -75,7 +75,7 @@
  162. ValueTraits(const CFixedVector3D& v)
  163. {
  164. std::stringstream s;
  165. - s << "[" << v.X.ToDouble() << ", " << v.Y.ToDouble() << ", " << v.Z.ToDouble() << "]";
  166. + s << "[" << v.getX().ToDouble() << ", " << v.getY().ToDouble() << ", " << v.getZ().ToDouble() << "]";
  167. m_StringRepr = s.str();
  168. }
  169. const char* asString() const
  170. Index: 0ad/source/maths/FixedVector2D.h
  171. ===================================================================
  172. --- 0ad/source/maths/FixedVector2D.h (revision 24769)
  173. +++ 0ad/source/maths/FixedVector2D.h (working copy)
  174. @@ -21,14 +21,64 @@
  175. #include "maths/Fixed.h"
  176. #include "maths/Sqrt.h"
  177.  
  178. +/**
  179. + * @class CFixedVector3D
  180. + * @mod by DanW58
  181. + * @date 21/01/21
  182. + * @file FixedVector3D.h
  183. + * @brief: The proposed changes to this class may result in a performance increase
  184. + * by reducing the frequency of calls to isqrt64. The basic idea here is that a
  185. + * fourth member variable is introduced, mutable fixed L, which stores the length
  186. + * of the vector. All non-const functions clear its value to signal its needing to
  187. + * be re-computed. The function Length(), as well as Normalize() will respectively
  188. + * return or use the value of this variable, -unless it is zero, in which case they
  189. + * will call the (private) ComputeLength() function first, to update L. Note that
  190. + * the function Length() is a const function as it should be; but by the same token
  191. + * it should not be able to trigger a recomputation of private member L... This is
  192. + * why L is declared mutable.
  193. + * Why not, you might ask, recompute L within every non-const function? The reason
  194. + * is that, for some vectors, the length may never be needed; so this lazy approach
  195. + * only computes L if and when it is actually needed.
  196. + * And why do I use the value of zero to signal the need to re-update? Ans.:
  197. + * 1) an extra bool would make the size of the class alignment unfriendly
  198. + * 2) all representable values are valid, but zero is an unlikely value, and its
  199. + * triggering a recomputation upon a call to Length() should not be big issue.
  200. + * 3) of all representative values, zero/non-zero takes less cycles to test for.
  201. + */
  202. +
  203. class CFixedVector2D
  204. {
  205. + fixed X, Y; //made private; returning const reference should be fastER
  206. + mutable fixed L; //cache for Length() computation; must be mutable...
  207. + fixed padding; //dummy fill for 128-bit alignment
  208. +
  209. public:
  210. - fixed X, Y;
  211.  
  212. + ///constructors, etc.
  213. CFixedVector2D() { }
  214. - CFixedVector2D(fixed X, fixed Y) : X(X), Y(Y) { }
  215. + CFixedVector2D(fixed X, fixed Y) : X(X), Y(Y)
  216. + {
  217. + MarkLengthUpdateIsRequired(); //this boils to a quick inline reg clear op
  218. + }
  219. + /*virtual*/ ~CFixedVector2D() { padding.SetInternalValue(0); } //do not inherit
  220.  
  221. + ///get functions
  222. + fixed const & getX() const { return X; }
  223. + fixed const & getY() const { return Y; }
  224. +
  225. + ///set functions, only used by deserializer, CTerrain::CalcPositionFixed,
  226. + ///Pathfinding::NavcellCenter, and VertexPathfinder::ComputeShortPath
  227. + fixed& Xref()
  228. + {
  229. + MarkLengthUpdateIsRequired(); //this boils to a quick inline reg clear op
  230. + return X;
  231. + }
  232. + fixed& Yref()
  233. + {
  234. + MarkLengthUpdateIsRequired();
  235. + return Y;
  236. + }
  237. +
  238. /// Vector equality
  239. bool operator==(const CFixedVector2D& v) const
  240. {
  241. @@ -63,6 +113,7 @@
  242. CFixedVector2D& operator+=(const CFixedVector2D& v)
  243. {
  244. *this = *this + v;
  245. + MarkLengthUpdateIsRequired();
  246. return *this;
  247. }
  248.  
  249. @@ -70,6 +121,7 @@
  250. CFixedVector2D& operator-=(const CFixedVector2D& v)
  251. {
  252. *this = *this - v;
  253. + MarkLengthUpdateIsRequired();
  254. return *this;
  255. }
  256.  
  257. @@ -93,12 +145,15 @@
  258. {
  259. return CFixedVector2D(X.Multiply(n), Y.Multiply(n));
  260. }
  261. -
  262. +
  263. +private:
  264. +
  265. /**
  266. - * Returns the length of the vector.
  267. + * Updates the stored value of the length of the vector.
  268. * Will not overflow if the result can be represented as type 'fixed'.
  269. + * Needs to be const to auto-update upon const function call; but L is mutable
  270. */
  271. - fixed Length() const
  272. + void UnconditionallyUpdateLength() const //see note above
  273. {
  274. // Do intermediate calculations with 64-bit ints to avoid overflows
  275. u64 xx = SQUARE_U64_FIXED(X);
  276. @@ -107,14 +162,32 @@
  277. CheckUnsignedAdditionOverflow(d2, xx, L"Overflow in CFixedVector2D::Length() part 1")
  278.  
  279. u32 d = isqrt64(d2);
  280. + CheckU32CastOverflow(d, i32, L"Overflow in CFixedVector2D::Length() part 2")
  281.  
  282. - CheckU32CastOverflow(d, i32, L"Overflow in CFixedVector2D::Length() part 2")
  283. - fixed r;
  284. - r.SetInternalValue(static_cast<i32>(d));
  285. - return r;
  286. + L.SetInternalValue(static_cast<i32>(d)); //Store the length in L
  287. }
  288. + void ConditionallyUpdateLength() const //L/L2 are mutable
  289. + {
  290. + if( L.IsZero() && !(X.IsZero() && Y.IsZero()) )
  291. + UnconditionallyUpdateLength();
  292. + }
  293. + void MarkLengthUpdateIsRequired() const //L is mutable
  294. + {
  295. + L.SetInternalValue(0);
  296. + }
  297.  
  298. +public:
  299. +
  300. /**
  301. + * Returns the cached length of the vector.
  302. + */
  303. + fixed const & Length() const
  304. + {
  305. + ConditionallyUpdateLength();
  306. + return L;
  307. + }
  308. +
  309. + /**
  310. * Returns -1, 0, +1 depending on whether length is less/equal/greater
  311. * than the argument.
  312. * Avoids sqrting and overflowing.
  313. @@ -121,21 +194,17 @@
  314. */
  315. int CompareLength(fixed cmp) const
  316. {
  317. - u64 d2 = SQUARE_U64_FIXED(X) + SQUARE_U64_FIXED(Y); // d2 <= 2^63 (no overflow)
  318. - u64 cmpSquared = SQUARE_U64_FIXED(cmp);
  319. -
  320. - if (d2 < cmpSquared)
  321. - return -1;
  322. -
  323. - if (d2 > cmpSquared)
  324. - return +1;
  325. -
  326. - return 0;
  327. + ConditionallyUpdateLength();
  328. + int result = 0;
  329. + if (Length() < cmp) result = -1;
  330. + if (cmp < L) result = 1; //already updated
  331. + return result;
  332. }
  333.  
  334. /**
  335. * Same as above, but avoids squaring the compared value.
  336. * The argument must be the result of an SQUARE_U64_FIXED operation.
  337. + * DanW says: This function should be obsolete now.
  338. */
  339. int CompareLengthSquared(u64 cmpSquared) const
  340. {
  341. @@ -153,20 +222,17 @@
  342. /**
  343. * Returns -1, 0, +1 depending on whether length is less/equal/greater
  344. * than the argument's length.
  345. - * Avoids sqrting and overflowing.
  346. + * Uses the stored value of length squared if possible; otherwise
  347. + * it recalculates it.
  348. */
  349. int CompareLength(const CFixedVector2D& other) const
  350. {
  351. - u64 d2 = SQUARE_U64_FIXED(X) + SQUARE_U64_FIXED(Y);
  352. - u64 od2 = SQUARE_U64_FIXED(other.X) + SQUARE_U64_FIXED(other.Y);
  353. -
  354. - if (d2 < od2)
  355. - return -1;
  356. -
  357. - if (d2 > od2)
  358. - return +1;
  359. -
  360. - return 0;
  361. + ConditionallyUpdateLength();
  362. + other.ConditionallyUpdateLength();
  363. + int result = 0;
  364. + if ( L < other.L ) result = -1;
  365. + if ( other.L < L ) result = 1;
  366. + return result;
  367. }
  368.  
  369. bool IsZero() const
  370. @@ -180,11 +246,12 @@
  371. */
  372. void Normalize()
  373. {
  374. - if (!IsZero())
  375. + ConditionallyUpdateLength();
  376. + if (!L.IsZero())
  377. {
  378. - fixed l = Length();
  379. - X = X / l;
  380. - Y = Y / l;
  381. + X = X / L;
  382. + Y = Y / L;
  383. + UnconditionallyUpdateLength(); //L will be pretty close to one
  384. }
  385. }
  386.  
  387. @@ -194,11 +261,12 @@
  388. */
  389. void Normalize(fixed n)
  390. {
  391. - fixed l = Length();
  392. - if (!l.IsZero())
  393. + ConditionallyUpdateLength();
  394. + if (!L.IsZero())
  395. {
  396. - X = X.MulDiv(n, l);
  397. - Y = Y.MulDiv(n, l);
  398. + X = X.MulDiv(n, L);
  399. + Y = Y.MulDiv(n, L);
  400. + UnconditionallyUpdateLength(); //L will be pretty close to n
  401. }
  402. }
  403.  
  404. Index: 0ad/source/maths/FixedVector3D.h
  405. ===================================================================
  406. --- 0ad/source/maths/FixedVector3D.h (revision 24769)
  407. +++ 0ad/source/maths/FixedVector3D.h (working copy)
  408. @@ -21,14 +21,68 @@
  409. #include "maths/Fixed.h"
  410. #include "maths/Sqrt.h"
  411.  
  412. +
  413. +/**
  414. + * @class CFixedVector3D
  415. + * @mod by DanW58
  416. + * @date 21/01/21
  417. + * @file FixedVector3D.h
  418. + * @brief: The proposed changes to this class may result in a performance increase
  419. + * by reducing the frequency of calls to isqrt64. The basic idea here is that a
  420. + * fourth member variable is introduced, mutable fixed L, which stores the length
  421. + * of the vector. All non-const functions clear its value to signal its needing to
  422. + * be re-computed. The function Length(), as well as Normalize() will respectively
  423. + * return or use the value of this variable, -unless it is zero, in which case they
  424. + * will call the (private) ComputeLength() function first, to update L. Note that
  425. + * the function Length() is a const function as it should be; but by the same token
  426. + * it should not be able to trigger a recomputation of private member L... This is
  427. + * why L is declared mutable.
  428. + * Why not, you might ask, recompute L within every non-const function? The reason
  429. + * is that, for some vectors, the length may never be needed; so this lazy approach
  430. + * only computes L if and when it is actually needed.
  431. + * And why do I use the value of zero to signal the need to re-update? Ans.:
  432. + * 1) an extra bool would make the size of the class alignment unfriendly
  433. + * 2) all representable values are valid, but zero is an unlikely value, and its
  434. + * triggering a recomputation upon a call to Length() should not be big issue.
  435. + * 3) of all representative values, zero/non-zero takes less cycles to test for.
  436. + */
  437. +
  438. class CFixedVector3D
  439. {
  440. + fixed X, Y, Z; //made private; returning const reference should be fastER
  441. + mutable fixed L; //cache for Length() computation; must be mutable...
  442. +
  443. public:
  444. - fixed X, Y, Z;
  445. -
  446. + ///constructors, etc.
  447. CFixedVector3D() { }
  448. + CFixedVector3D(fixed X, fixed Y, fixed Z) : X(X), Y(Y), Z(Z)
  449. + {
  450. + MarkLengthUpdateIsRequired(); //this boils to a quick inline reg clear op
  451. + }
  452. + //virtual ~CFixedVector2D() {} //do not inherit
  453.  
  454. - CFixedVector3D(fixed X, fixed Y, fixed Z) : X(X), Y(Y), Z(Z) { }
  455. + ///get functions
  456. + fixed const & getX() const { return X; } //this should be fastER than making
  457. + fixed const & getY() const { return Y; } //the members public, as many engine
  458. + fixed const & getZ() const { return Z; } //optimizations are subverted otherwise
  459. +
  460. + //"set functions" (ref's), only used by deserializer, CTerrain::CalcPositionFixed
  461. + //and some javascript initializer, I forget now...
  462. + fixed& Xref()
  463. + {
  464. + MarkLengthUpdateIsRequired(); //this boils to a quick inline reg clear op
  465. + return X;
  466. + }
  467. + fixed& Yref()
  468. + {
  469. + MarkLengthUpdateIsRequired();
  470. + return Y;
  471. + }
  472. + fixed& Zref()
  473. + {
  474. + MarkLengthUpdateIsRequired();
  475. + return Z;
  476. + }
  477.  
  478. /// Vector equality
  479. bool operator==(const CFixedVector3D& v) const
  480. @@ -64,6 +118,7 @@
  481. CFixedVector3D& operator+=(const CFixedVector3D& v)
  482. {
  483. *this = *this + v;
  484. + MarkLengthUpdateIsRequired();
  485. return *this;
  486. }
  487.  
  488. @@ -71,15 +126,45 @@
  489. CFixedVector3D& operator-=(const CFixedVector3D& v)
  490. {
  491. *this = *this - v;
  492. + MarkLengthUpdateIsRequired();
  493. return *this;
  494. }
  495.  
  496.  
  497. /**
  498. - * Returns the length of the vector.
  499. + * Returns the cached length of the vector.
  500. + */
  501. + fixed const & Length() const
  502. + {
  503. + ConditionallyUpdateLength();
  504. + return L;
  505. + }
  506. +
  507. + /**
  508. + * This function added by DanW58, to match CFixedVector2D's interface
  509. + * Returns -1, 0, +1 depending on whether length is less/equal/greater
  510. + * than the argument's length.
  511. + * Uses the stored value of length squared if possible; otherwise
  512. + * it recalculates it.
  513. + */
  514. + int CompareLength(const CFixedVector3D& other) const
  515. + {
  516. + ConditionallyUpdateLength();
  517. + other.ConditionallyUpdateLength();
  518. + int result = 0;
  519. + if ( L < other.L ) result = -1;
  520. + if ( other.L < L ) result = 1;
  521. + return result;
  522. + }
  523. +
  524. +private:
  525. +
  526. + /**
  527. + * Computes and caches the length of the vector.
  528. * Will not overflow if the result can be represented as type 'fixed'.
  529. + * Needs to be const to auto-update upon const function call; but L is mutable
  530. */
  531. - fixed Length() const
  532. + void UnconditionallyUpdateLength() const //see note above
  533. {
  534. // Do intermediate calculations with 64-bit ints to avoid overflows
  535. u64 xx = SQUARE_U64_FIXED(X);
  536. @@ -92,13 +177,22 @@
  537. CheckUnsignedAdditionOverflow(d2, t, L"Overflow in CFixedVector3D::Length() part 2")
  538.  
  539. u32 d = isqrt64(d2);
  540. -
  541. CheckU32CastOverflow(d, i32, L"Overflow in CFixedVector3D::Length() part 3")
  542. - fixed r;
  543. - r.SetInternalValue((i32)d);
  544. - return r;
  545. +
  546. + L.SetInternalValue((i32)d);
  547. }
  548. + void ConditionallyUpdateLength() const //L is mutable
  549. + {
  550. + if( L.IsZero() && !(X.IsZero() && Y.IsZero() && Z.IsZero()) )
  551. + UnconditionallyUpdateLength();
  552. + }
  553. + void MarkLengthUpdateIsRequired() const //L is mutable
  554. + {
  555. + L.SetInternalValue(0);
  556. + }
  557.  
  558. +public:
  559. +
  560. /**
  561. * Normalize the vector so that length is close to 1.
  562. * If length is 0, does nothing.
  563. @@ -105,12 +199,13 @@
  564. */
  565. void Normalize()
  566. {
  567. - fixed l = Length();
  568. - if (!l.IsZero())
  569. + ConditionallyUpdateLength();
  570. + if (!L.IsZero())
  571. {
  572. - X = X / l;
  573. - Y = Y / l;
  574. - Z = Z / l;
  575. + X = X/L;
  576. + Y = Y/L;
  577. + Z = Z/L;
  578. + UnconditionallyUpdateLength(); //L will be pretty close to one
  579. }
  580. }
  581.  
  582. @@ -120,12 +215,13 @@
  583. */
  584. void Normalize(fixed n)
  585. {
  586. - fixed l = Length();
  587. - if (!l.IsZero())
  588. + ConditionallyUpdateLength();
  589. + if (!L.IsZero())
  590. {
  591. - X = X.MulDiv(n, l);
  592. - Y = Y.MulDiv(n, l);
  593. - Z = Z.MulDiv(n, l);
  594. + X = X.MulDiv(n, L);
  595. + Y = Y.MulDiv(n, L);
  596. + Z = Z.MulDiv(n, L);
  597. + UnconditionallyUpdateLength(); //L will be pretty close to n
  598. }
  599. }
  600.  
  601. @@ -132,7 +228,7 @@
  602. /**
  603. * Compute the cross product of this vector with another.
  604. */
  605. - CFixedVector3D Cross(const CFixedVector3D& v)
  606. + CFixedVector3D Cross(const CFixedVector3D& v) const //DanW58: const added; it was missing
  607. {
  608. i64 y_vz = MUL_I64_I32_I32(Y.GetInternalValue(), v.Z.GetInternalValue());
  609. i64 z_vy = MUL_I64_I32_I32(Z.GetInternalValue(), v.Y.GetInternalValue());
  610. @@ -165,7 +261,7 @@
  611. /**
  612. * Compute the dot product of this vector with another.
  613. */
  614. - fixed Dot(const CFixedVector3D& v)
  615. + fixed Dot(const CFixedVector3D& v) const //DanW58: const added; it was missing
  616. {
  617. i64 x = MUL_I64_I32_I32(X.GetInternalValue(), v.X.GetInternalValue());
  618. i64 y = MUL_I64_I32_I32(Y.GetInternalValue(), v.Y.GetInternalValue());
  619. @@ -184,4 +280,5 @@
  620. }
  621. };
  622.  
  623. +
  624. #endif // INCLUDED_FIXED_VECTOR3D
  625. Index: 0ad/source/maths/Vector3D.cpp
  626. ===================================================================
  627. --- 0ad/source/maths/Vector3D.cpp (revision 24769)
  628. +++ 0ad/source/maths/Vector3D.cpp (working copy)
  629. @@ -32,7 +32,7 @@
  630. #include <limits>
  631.  
  632. CVector3D::CVector3D(const CFixedVector3D& v) :
  633. - X(v.X.ToFloat()), Y(v.Y.ToFloat()), Z(v.Z.ToFloat())
  634. + X(v.getX().ToFloat()), Y(v.getY().ToFloat()), Z(v.getZ().ToFloat())
  635. {
  636. }
  637.  
  638. Index: 0ad/source/maths/tests/test_FixedVector2D.h
  639. ===================================================================
  640. --- 0ad/source/maths/tests/test_FixedVector2D.h (revision 24769)
  641. +++ 0ad/source/maths/tests/test_FixedVector2D.h (working copy)
  642. @@ -20,12 +20,12 @@
  643. #include "maths/FixedVector2D.h"
  644.  
  645. #define TS_ASSERT_VEC_EQUALS(v, x, y) \
  646. - TS_ASSERT_EQUALS(v.X.ToDouble(), x); \
  647. - TS_ASSERT_EQUALS(v.Y.ToDouble(), y);
  648. + TS_ASSERT_EQUALS(v.getX().ToDouble(), x); \
  649. + TS_ASSERT_EQUALS(v.getY().ToDouble(), y);
  650.  
  651. #define TS_ASSERT_VEC_DELTA(v, x, y, delta) \
  652. - TS_ASSERT_DELTA(v.X.ToDouble(), x, delta); \
  653. - TS_ASSERT_DELTA(v.Y.ToDouble(), y, delta);
  654. + TS_ASSERT_DELTA(v.getX().ToDouble(), x, delta); \
  655. + TS_ASSERT_DELTA(v.getY().ToDouble(), y, delta);
  656.  
  657. class TestFixedVector2D : public CxxTest::TestSuite
  658. {
  659. Index: 0ad/source/maths/tests/test_FixedVector3D.h
  660. ===================================================================
  661. --- 0ad/source/maths/tests/test_FixedVector3D.h (revision 24769)
  662. +++ 0ad/source/maths/tests/test_FixedVector3D.h (working copy)
  663. @@ -20,14 +20,14 @@
  664. #include "maths/FixedVector3D.h"
  665.  
  666. #define TS_ASSERT_VEC_EQUALS(v, x, y, z) \
  667. - TS_ASSERT_EQUALS(v.X.ToDouble(), x); \
  668. - TS_ASSERT_EQUALS(v.Y.ToDouble(), y); \
  669. - TS_ASSERT_EQUALS(v.Z.ToDouble(), z);
  670. + TS_ASSERT_EQUALS(v.getX().ToDouble(), x); \
  671. + TS_ASSERT_EQUALS(v.getY().ToDouble(), y); \
  672. + TS_ASSERT_EQUALS(v.getZ().ToDouble(), z);
  673.  
  674. #define TS_ASSERT_VEC_DELTA(v, x, y, z, delta) \
  675. - TS_ASSERT_DELTA(v.X.ToDouble(), x, delta); \
  676. - TS_ASSERT_DELTA(v.Y.ToDouble(), y, delta); \
  677. - TS_ASSERT_DELTA(v.Z.ToDouble(), z, delta);
  678. + TS_ASSERT_DELTA(v.getX().ToDouble(), x, delta); \
  679. + TS_ASSERT_DELTA(v.getY().ToDouble(), y, delta); \
  680. + TS_ASSERT_DELTA(v.getZ().ToDouble(), z, delta);
  681.  
  682. class TestFixedVector3D : public CxxTest::TestSuite
  683. {
  684. Index: 0ad/source/ps/Replay.cpp
  685. ===================================================================
  686. --- 0ad/source/ps/Replay.cpp (revision 24769)
  687. +++ 0ad/source/ps/Replay.cpp (working copy)
  688. @@ -201,6 +201,8 @@
  689. new CProfileManager;
  690. g_ScriptStatsTable = new CScriptStatsTable;
  691. g_ProfileViewer.AddRootTable(g_ScriptStatsTable);
  692. +
  693. + g_Profiler2.EnableHTTP();
  694.  
  695. const int contextSize = 384 * 1024 * 1024;
  696. const int heapGrowthBytesGCTrigger = 20 * 1024 * 1024;
  697. Index: 0ad/source/simulation2/components/CCmpAIManager.cpp
  698. ===================================================================
  699. --- 0ad/source/simulation2/components/CCmpAIManager.cpp (revision 24769)
  700. +++ 0ad/source/simulation2/components/CCmpAIManager.cpp (working copy)
  701. @@ -330,8 +330,8 @@
  702. void ComputePath(const CFixedVector2D& pos, const CFixedVector2D& goal, pass_class_t passClass, std::vector<CFixedVector2D>& waypoints)
  703. {
  704. WaypointPath ret;
  705. - PathGoal pathGoal = { PathGoal::POINT, goal.X, goal.Y };
  706. - m_LongPathfinder.ComputePath(m_HierarchicalPathfinder, pos.X, pos.Y, pathGoal, passClass, ret);
  707. + PathGoal pathGoal = { PathGoal::POINT, goal.getX(), goal.getY() };
  708. + m_LongPathfinder.ComputePath(m_HierarchicalPathfinder, pos.getX(), pos.getY(), pathGoal, passClass, ret);
  709.  
  710. for (Waypoint& wp : ret.m_Waypoints)
  711. waypoints.emplace_back(wp.x, wp.z);
  712. Index: 0ad/source/simulation2/components/CCmpCinemaManager.cpp
  713. ===================================================================
  714. --- 0ad/source/simulation2/components/CCmpCinemaManager.cpp (revision 24769)
  715. +++ 0ad/source/simulation2/components/CCmpCinemaManager.cpp (working copy)
  716. @@ -275,13 +275,13 @@
  717. else
  718. serializer.NumberFixed_Unbounded("NodeDeltaTime", fixed::Zero());
  719.  
  720. - serializer.NumberFixed_Unbounded("PositionX", nodes[i].Position.X);
  721. - serializer.NumberFixed_Unbounded("PositionY", nodes[i].Position.Y);
  722. - serializer.NumberFixed_Unbounded("PositionZ", nodes[i].Position.Z);
  723. + serializer.NumberFixed_Unbounded("PositionX", nodes[i].Position.getX());
  724. + serializer.NumberFixed_Unbounded("PositionY", nodes[i].Position.getY());
  725. + serializer.NumberFixed_Unbounded("PositionZ", nodes[i].Position.getZ());
  726.  
  727. - serializer.NumberFixed_Unbounded("RotationX", nodes[i].Rotation.X);
  728. - serializer.NumberFixed_Unbounded("RotationY", nodes[i].Rotation.Y);
  729. - serializer.NumberFixed_Unbounded("RotationZ", nodes[i].Rotation.Z);
  730. + serializer.NumberFixed_Unbounded("RotationX", nodes[i].Rotation.getX());
  731. + serializer.NumberFixed_Unbounded("RotationY", nodes[i].Rotation.getY());
  732. + serializer.NumberFixed_Unbounded("RotationZ", nodes[i].Rotation.getZ());
  733. }
  734.  
  735. if (!data->m_LookAtTarget)
  736. @@ -295,9 +295,9 @@
  737. serializer.NumberFixed_Unbounded("NodeDeltaTime", targetNodes[i - 1].Distance);
  738. else
  739. serializer.NumberFixed_Unbounded("NodeDeltaTime", fixed::Zero());
  740. - serializer.NumberFixed_Unbounded("PositionX", targetNodes[i].Position.X);
  741. - serializer.NumberFixed_Unbounded("PositionY", targetNodes[i].Position.Y);
  742. - serializer.NumberFixed_Unbounded("PositionZ", targetNodes[i].Position.Z);
  743. + serializer.NumberFixed_Unbounded("PositionX", targetNodes[i].Position.getX());
  744. + serializer.NumberFixed_Unbounded("PositionY", targetNodes[i].Position.getY());
  745. + serializer.NumberFixed_Unbounded("PositionZ", targetNodes[i].Position.getZ());
  746. }
  747. }
  748.  
  749. @@ -320,13 +320,13 @@
  750. SplineData node;
  751. deserializer.NumberFixed_Unbounded("NodeDeltaTime", node.Distance);
  752.  
  753. - deserializer.NumberFixed_Unbounded("PositionX", node.Position.X);
  754. - deserializer.NumberFixed_Unbounded("PositionY", node.Position.Y);
  755. - deserializer.NumberFixed_Unbounded("PositionZ", node.Position.Z);
  756. + deserializer.NumberFixed_Unbounded("PositionX", node.Position.Xref());
  757. + deserializer.NumberFixed_Unbounded("PositionY", node.Position.Yref());
  758. + deserializer.NumberFixed_Unbounded("PositionZ", node.Position.Zref());
  759.  
  760. - deserializer.NumberFixed_Unbounded("RotationX", node.Rotation.X);
  761. - deserializer.NumberFixed_Unbounded("RotationY", node.Rotation.Y);
  762. - deserializer.NumberFixed_Unbounded("RotationZ", node.Rotation.Z);
  763. + deserializer.NumberFixed_Unbounded("RotationX", node.Rotation.Xref());
  764. + deserializer.NumberFixed_Unbounded("RotationY", node.Rotation.Yref());
  765. + deserializer.NumberFixed_Unbounded("RotationZ", node.Rotation.Zref());
  766.  
  767. pathSpline.AddNode(node.Position, node.Rotation, node.Distance);
  768. }
  769. @@ -340,9 +340,9 @@
  770. SplineData node;
  771. deserializer.NumberFixed_Unbounded("NodeDeltaTime", node.Distance);
  772.  
  773. - deserializer.NumberFixed_Unbounded("PositionX", node.Position.X);
  774. - deserializer.NumberFixed_Unbounded("PositionY", node.Position.Y);
  775. - deserializer.NumberFixed_Unbounded("PositionZ", node.Position.Z);
  776. + deserializer.NumberFixed_Unbounded("PositionX", node.Position.Xref());
  777. + deserializer.NumberFixed_Unbounded("PositionY", node.Position.Yref());
  778. + deserializer.NumberFixed_Unbounded("PositionZ", node.Position.Zref());
  779.  
  780. targetSpline.AddNode(node.Position, CFixedVector3D(), node.Distance);
  781. }
  782. Index: 0ad/source/simulation2/components/CCmpDecay.cpp
  783. ===================================================================
  784. --- 0ad/source/simulation2/components/CCmpDecay.cpp (revision 24769)
  785. +++ 0ad/source/simulation2/components/CCmpDecay.cpp (working copy)
  786. @@ -168,8 +168,8 @@
  787. CmpPtr<ICmpTerrain> cmpTerrain(GetSystemEntity());
  788. if (cmpTerrain)
  789. {
  790. - fixed ground = cmpTerrain->GetGroundLevel(pos.X, pos.Z);
  791. - m_TotalSinkDepth += std::max(0.f, (pos.Y - ground).ToFloat());
  792. + fixed ground = cmpTerrain->GetGroundLevel(pos.getX(), pos.getZ());
  793. + m_TotalSinkDepth += std::max(0.f, (pos.getY() - ground).ToFloat());
  794. }
  795.  
  796. // Sink it further down if it sinks like a ship, as it will rotate.
  797. @@ -176,13 +176,13 @@
  798. if (m_ShipSink)
  799. {
  800. // lacking randomness we'll trick
  801. - m_SinkingAngleX = (pos.X.ToInt_RoundToNearest() % 30 - 15) / 15.0;
  802. - m_SinkingAngleZ = (pos.Z.ToInt_RoundToNearest() % 30) / 40.0;
  803. + m_SinkingAngleX = (pos.getX().ToInt_RoundToNearest() % 30 - 15) / 15.0;
  804. + m_SinkingAngleZ = (pos.getZ().ToInt_RoundToNearest() % 30) / 40.0;
  805. m_TotalSinkDepth += 10.f;
  806. }
  807. // probably 0 in both cases but we'll remember it anyway.
  808. - m_InitialXRotation = cmpPosition->GetRotation().X;
  809. - m_InitialZRotation = cmpPosition->GetRotation().Z;
  810. + m_InitialXRotation = cmpPosition->GetRotation().getX();
  811. + m_InitialZRotation = cmpPosition->GetRotation().getZ();
  812. }
  813.  
  814. m_CurrentTime += msgData.deltaSimTime;
  815. Index: 0ad/source/simulation2/components/CCmpFootprint.cpp
  816. ===================================================================
  817. --- 0ad/source/simulation2/components/CCmpFootprint.cpp (revision 24769)
  818. +++ 0ad/source/simulation2/components/CCmpFootprint.cpp (working copy)
  819. @@ -187,7 +187,7 @@
  820. SkipTagRequireFlagsObstructionFilter filter(spawnedTag, ICmpObstructionManager::FLAG_BLOCK_MOVEMENT);
  821.  
  822. CFixedVector2D initialPos = cmpPosition->GetPosition2D();
  823. - entity_angle_t initialAngle = cmpPosition->GetRotation().Y;
  824. + entity_angle_t initialAngle = cmpPosition->GetRotation().getY();
  825.  
  826. CFixedVector2D u = CFixedVector2D(fixed::Zero(), fixed::FromInt(1)).Rotate(initialAngle);
  827. CFixedVector2D v = u.Perpendicular();
  828. @@ -203,8 +203,8 @@
  829.  
  830. // Figure out how many units can fit on each halfside of the rectangle.
  831. // Since 2*pi/6 ~= 1, this is also how many units can fit on a sixth of the circle.
  832. - int distX = std::max(1, (halfSize.X / gap).ToInt_RoundToNegInfinity());
  833. - int distY = std::max(1, (halfSize.Y / gap).ToInt_RoundToNegInfinity());
  834. + int distX = std::max(1, (halfSize.getX() / gap).ToInt_RoundToNegInfinity());
  835. + int distY = std::max(1, (halfSize.getY() / gap).ToInt_RoundToNegInfinity());
  836.  
  837. // Try more spawning points for large units in case some of them are partially blocked.
  838. if (rows == 1)
  839. @@ -222,7 +222,7 @@
  840. CFixedVector2D rallyPointPos = cmpRallyPoint->GetFirstPosition();
  841. if (m_Shape == CIRCLE)
  842. {
  843. - entity_angle_t offsetAngle = atan2_approx(rallyPointPos.X - initialPos.X, rallyPointPos.Y - initialPos.Y) - initialAngle;
  844. + entity_angle_t offsetAngle = atan2_approx(rallyPointPos.getX() - initialPos.getX(), rallyPointPos.getY() - initialPos.getY()) - initialAngle;
  845.  
  846. // There are 6*(distX+r) points in row r, so multiply that by angle/2pi to find the offset within the row.
  847. for (int r = 0; r < rows; ++r)
  848. @@ -233,8 +233,8 @@
  849. CFixedVector2D offsetPos = Geometry::NearestPointOnSquare(rallyPointPos - initialPos, u, v, halfSize);
  850.  
  851. // Scale and convert the perimeter coordinates of the point to its offset within the row.
  852. - int x = (offsetPos.Dot(u) * distX / halfSize.X).ToInt_RoundToNearest();
  853. - int y = (offsetPos.Dot(v) * distY / halfSize.Y).ToInt_RoundToNearest();
  854. + int x = (offsetPos.Dot(u) * distX / halfSize.getX()).ToInt_RoundToNearest();
  855. + int y = (offsetPos.Dot(v) * distY / halfSize.getY()).ToInt_RoundToNearest();
  856. for (int r = 0; r < rows; ++r)
  857. offsetPoints[r] = Geometry::GetPerimeterDistance(
  858. distX + r,
  859. @@ -250,17 +250,17 @@
  860. CFixedVector2D pos = initialPos;
  861. if (m_Shape == CIRCLE)
  862. // Multiply the point by 2pi / 6*(distX+r) to get the angle.
  863. - pos += u.Rotate(fixed::Pi() * (offsetPoints[r] + k) / (3 * (distX + r))).Multiply(halfSize.X + gap * r );
  864. + pos += u.Rotate(fixed::Pi() * (offsetPoints[r] + k) / (3 * (distX + r))).Multiply(halfSize.getX() + gap * r );
  865. else
  866. {
  867. // Convert the point to coordinates and scale.
  868. std::pair<int, int> p = Geometry::GetPerimeterCoordinates(distX + r, distY + r, offsetPoints[r] + k);
  869. - pos += u.Multiply((halfSize.X + gap * r) * p.first / (distX + r)) +
  870. - v.Multiply((halfSize.Y + gap * r) * p.second / (distY + r));
  871. + pos += u.Multiply((halfSize.getX() + gap * r) * p.first / (distX + r)) +
  872. + v.Multiply((halfSize.getY() + gap * r) * p.second / (distY + r));
  873. }
  874.  
  875. - if (cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Y, spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  876. - return CFixedVector3D(pos.X, fixed::Zero(), pos.Y);
  877. + if (cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getY(), spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  878. + return CFixedVector3D(pos.getX(), fixed::Zero(), pos.getY());
  879. }
  880.  
  881. return error;
  882. @@ -314,7 +314,7 @@
  883. pass_class_t entityPass = cmpEntityMotion->GetPassabilityClass();
  884.  
  885. CFixedVector2D initialPos = cmpPosition->GetPosition2D();
  886. - entity_angle_t initialAngle = cmpPosition->GetRotation().Y;
  887. + entity_angle_t initialAngle = cmpPosition->GetRotation().getY();
  888.  
  889. // Max spawning distance + 1 (in meters)
  890. const i32 maxSpawningDistance = 13;
  891. @@ -337,11 +337,11 @@
  892. fixed s, c;
  893. sincos_approx(angle, s, c);
  894.  
  895. - CFixedVector3D pos (initialPos.X + s.Multiply(radius), fixed::Zero(), initialPos.Y + c.Multiply(radius));
  896. + CFixedVector3D pos (initialPos.getX() + s.Multiply(radius), fixed::Zero(), initialPos.getY() + c.Multiply(radius));
  897.  
  898. SkipTagObstructionFilter filter(spawnedTag); // ignore collisions with the spawned entity
  899. - if (cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Z, spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS &&
  900. - cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Z, spawnedRadius, entityPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  901. + if (cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getZ(), spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS &&
  902. + cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getZ(), spawnedRadius, entityPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  903. return pos; // this position is okay, so return it
  904. }
  905. }
  906. @@ -395,9 +395,9 @@
  907. CFixedVector2D pos (center + dir*i);
  908.  
  909. SkipTagObstructionFilter filter(spawnedTag); // ignore collisions with the spawned entity
  910. - if (cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Y, spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS &&
  911. - cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Y, spawnedRadius, entityPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  912. - return CFixedVector3D(pos.X, fixed::Zero(), pos.Y); // this position is okay, so return it
  913. + if (cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getY(), spawnedRadius, spawnedPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS &&
  914. + cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getY(), spawnedRadius, entityPass) == ICmpObstruction::FOUNDATION_CHECK_SUCCESS)
  915. + return CFixedVector3D(pos.getX(), fixed::Zero(), pos.getY()); // this position is okay, so return it
  916. }
  917. }
  918. }
  919. Index: 0ad/source/simulation2/components/CCmpMotionBall.cpp
  920. ===================================================================
  921. --- 0ad/source/simulation2/components/CCmpMotionBall.cpp (revision 24769)
  922. +++ 0ad/source/simulation2/components/CCmpMotionBall.cpp (working copy)
  923. @@ -91,8 +91,8 @@
  924. // TODO: this is all FP-unsafe
  925.  
  926. CFixedVector3D pos = cmpPosition->GetPosition();
  927. - float x = pos.X.ToFloat();
  928. - float z = pos.Z.ToFloat();
  929. + float x = pos.getX().ToFloat();
  930. + float z = pos.getZ().ToFloat();
  931.  
  932. CVector3D normal = GetSimContext().GetTerrain().CalcExactNormal(x, z);
  933. // Flatten the vector, to get the downhill force
  934. Index: 0ad/source/simulation2/components/CCmpObstruction.cpp
  935. ===================================================================
  936. --- 0ad/source/simulation2/components/CCmpObstruction.cpp (revision 24769)
  937. +++ 0ad/source/simulation2/components/CCmpObstruction.cpp (working copy)
  938. @@ -248,13 +248,13 @@
  939. b.da = entity_angle_t::FromInt(0);
  940. b.flags = m_Flags;
  941. m_Shapes.push_back(b);
  942. - max.X = std::max(max.X, b.dx + b.size0/2);
  943. - max.Y = std::max(max.Y, b.dz + b.size1/2);
  944. - min.X = std::min(min.X, b.dx - b.size0/2);
  945. - min.Y = std::min(min.Y, b.dz - b.size1/2);
  946. + max.Xref() = std::max(max.getX(), b.dx + b.size0/2);
  947. + max.Yref() = std::max(max.getY(), b.dz + b.size1/2);
  948. + min.Xref() = std::min(min.getX(), b.dx - b.size0/2);
  949. + min.Yref() = std::min(min.getY(), b.dz - b.size1/2);
  950. }
  951. - m_Size0 = fixed::FromInt(2).Multiply(std::max(max.X, -min.X));
  952. - m_Size1 = fixed::FromInt(2).Multiply(std::max(max.Y, -min.Y));
  953. + m_Size0 = fixed::FromInt(2).Multiply(std::max(max.getX(), -min.getX()));
  954. + m_Size1 = fixed::FromInt(2).Multiply(std::max(max.getY(), -min.getY()));
  955. }
  956.  
  957. m_Active = paramNode.GetChild("Active").ToBool();
  958. @@ -396,12 +396,12 @@
  959. CFixedVector2D pos = cmpPosition->GetPosition2D();
  960. if (m_Type == STATIC)
  961. m_Tag = cmpObstructionManager->AddStaticShape(GetEntityId(),
  962. - pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1, m_Flags, m_ControlGroup, m_ControlGroup2);
  963. + pos.getX(), pos.getY(), cmpPosition->GetRotation().getY(), m_Size0, m_Size1, m_Flags, m_ControlGroup, m_ControlGroup2);
  964. else if (m_Type == UNIT)
  965. m_Tag = cmpObstructionManager->AddUnitShape(GetEntityId(),
  966. - pos.X, pos.Y, m_Clearance, (flags_t)(m_Flags | (m_Moving ? ICmpObstructionManager::FLAG_MOVING : 0)), m_ControlGroup);
  967. + pos.getX(), pos.getY(), m_Clearance, (flags_t)(m_Flags | (m_Moving ? ICmpObstructionManager::FLAG_MOVING : 0)), m_ControlGroup);
  968. else
  969. - AddClusterShapes(pos.X, pos.Y, cmpPosition->GetRotation().Y);
  970. + AddClusterShapes(pos.getX(), pos.getY(), cmpPosition->GetRotation().getY());
  971. }
  972. else if (!active && m_Active)
  973. {
  974. @@ -499,9 +499,9 @@
  975. else
  976. pos = cmpPosition->GetPosition2D();
  977. if (m_Type == UNIT)
  978. - out = cmpObstructionManager->GetUnitShapeObstruction(pos.X, pos.Y, m_Clearance);
  979. + out = cmpObstructionManager->GetUnitShapeObstruction(pos.getX(), pos.getY(), m_Clearance);
  980. else
  981. - out = cmpObstructionManager->GetStaticShapeObstruction(pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1);
  982. + out = cmpObstructionManager->GetStaticShapeObstruction(pos.getX(), pos.getY(), cmpPosition->GetRotation().getY(), m_Size0, m_Size1);
  983. return true;
  984. }
  985.  
  986. @@ -544,8 +544,8 @@
  987. return false;
  988.  
  989. // Keep these constants in agreement with the pathfinder.
  990. - return cmpWaterManager->GetWaterLevel(front.X, front.Y) - cmpTerrain->GetGroundLevel(front.X, front.Y) > fixed::FromInt(1) &&
  991. - cmpWaterManager->GetWaterLevel( back.X, back.Y) - cmpTerrain->GetGroundLevel( back.X, back.Y) < fixed::FromInt(2);
  992. + return cmpWaterManager->GetWaterLevel(front.getX(), front.getY()) - cmpTerrain->GetGroundLevel(front.getX(), front.getY()) > fixed::FromInt(1) &&
  993. + cmpWaterManager->GetWaterLevel( back.getX(), back.getY()) - cmpTerrain->GetGroundLevel( back.getX(), back.getY()) < fixed::FromInt(2);
  994. }
  995.  
  996. virtual EFoundationCheck CheckFoundation(const std::string& className) const
  997. @@ -585,9 +585,9 @@
  998. ICmpObstructionManager::FLAG_BLOCK_FOUNDATION);
  999.  
  1000. if (m_Type == UNIT)
  1001. - return cmpPathfinder->CheckUnitPlacement(filter, pos.X, pos.Y, m_Clearance, passClass, onlyCenterPoint);
  1002. + return cmpPathfinder->CheckUnitPlacement(filter, pos.getX(), pos.getY(), m_Clearance, passClass, onlyCenterPoint);
  1003. else
  1004. - return cmpPathfinder->CheckBuildingPlacement(filter, pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1, GetEntityId(), passClass, onlyCenterPoint);
  1005. + return cmpPathfinder->CheckBuildingPlacement(filter, pos.getX(), pos.getY(), cmpPosition->GetRotation().getY(), m_Size0, m_Size1, GetEntityId(), passClass, onlyCenterPoint);
  1006. }
  1007.  
  1008. virtual bool CheckDuplicateFoundation() const
  1009. @@ -617,9 +617,9 @@
  1010. ICmpObstructionManager::FLAG_BLOCK_FOUNDATION);
  1011.  
  1012. if (m_Type == UNIT)
  1013. - return !cmpObstructionManager->TestUnitShape(filter, pos.X, pos.Y, m_Clearance, NULL);
  1014. + return !cmpObstructionManager->TestUnitShape(filter, pos.getX(), pos.getY(), m_Clearance, NULL);
  1015. else
  1016. - return !cmpObstructionManager->TestStaticShape(filter, pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1, NULL );
  1017. + return !cmpObstructionManager->TestStaticShape(filter, pos.getX(), pos.getY(), cmpPosition->GetRotation().getY(), m_Size0, m_Size1, NULL );
  1018. }
  1019.  
  1020. virtual std::vector<entity_id_t> GetEntitiesByFlags(flags_t flags) const
  1021. @@ -746,7 +746,7 @@
  1022. ICmpObstructionManager::FLAG_BLOCK_FOUNDATION);
  1023.  
  1024. std::vector<entity_id_t> collisions;
  1025. - if (cmpObstructionManager->TestStaticShape(filter, pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1, &collisions))
  1026. + if (cmpObstructionManager->TestStaticShape(filter, pos.getX(), pos.getY(), cmpPosition->GetRotation().getY(), m_Size0, m_Size1, &collisions))
  1027. {
  1028. std::vector<entity_id_t> persistentEnts, normalEnts;
  1029.  
  1030. Index: 0ad/source/simulation2/components/CCmpObstructionManager.cpp
  1031. ===================================================================
  1032. --- 0ad/source/simulation2/components/CCmpObstructionManager.cpp (revision 24769)
  1033. +++ 0ad/source/simulation2/components/CCmpObstructionManager.cpp (working copy)
  1034. @@ -104,10 +104,10 @@
  1035. serialize.NumberU32_Unbounded("entity", value.entity);
  1036. serialize.NumberFixed_Unbounded("x", value.x);
  1037. serialize.NumberFixed_Unbounded("z", value.z);
  1038. - serialize.NumberFixed_Unbounded("u.x", value.u.X);
  1039. - serialize.NumberFixed_Unbounded("u.y", value.u.Y);
  1040. - serialize.NumberFixed_Unbounded("v.x", value.v.X);
  1041. - serialize.NumberFixed_Unbounded("v.y", value.v.Y);
  1042. + serialize.NumberFixed_Unbounded("u.x", value.u.Xref());
  1043. + serialize.NumberFixed_Unbounded("u.y", value.u.Yref());
  1044. + serialize.NumberFixed_Unbounded("v.x", value.v.Xref());
  1045. + serialize.NumberFixed_Unbounded("v.y", value.v.Yref());
  1046. serialize.NumberFixed_Unbounded("hw", value.hw);
  1047. serialize.NumberFixed_Unbounded("hh", value.hh);
  1048. serialize.NumberU8_Unbounded("flags", value.flags);
  1049. @@ -563,8 +563,8 @@
  1050. return;
  1051.  
  1052. u16 j0, j1, i0, i1;
  1053. - Pathfinding::NearestNavcell(x - hbox.X, z - hbox.Y, i0, j0, m_UpdateInformations.dirtinessGrid.m_W, m_UpdateInformations.dirtinessGrid.m_H);
  1054. - Pathfinding::NearestNavcell(x + hbox.X, z + hbox.Y, i1, j1, m_UpdateInformations.dirtinessGrid.m_W, m_UpdateInformations.dirtinessGrid.m_H);
  1055. + Pathfinding::NearestNavcell(x - hbox.getX(), z - hbox.getY(), i0, j0, m_UpdateInformations.dirtinessGrid.m_W, m_UpdateInformations.dirtinessGrid.m_H);
  1056. + Pathfinding::NearestNavcell(x + hbox.getX(), z + hbox.getY(), i1, j1, m_UpdateInformations.dirtinessGrid.m_W, m_UpdateInformations.dirtinessGrid.m_H);
  1057.  
  1058. for (int j = j0; j < j1; ++j)
  1059. for (int i = i0; i < i1; ++i)
  1060. @@ -662,7 +662,7 @@
  1061. */
  1062. inline bool IsInWorld(const CFixedVector2D& p) const
  1063. {
  1064. - return (m_WorldX0 <= p.X && p.X <= m_WorldX1 && m_WorldZ0 <= p.Y && p.Y <= m_WorldZ1);
  1065. + return (m_WorldX0 <= p.getX() && p.getX() <= m_WorldX1 && m_WorldZ0 <= p.getY() && p.getY() <= m_WorldZ1);
  1066. }
  1067.  
  1068. void RasterizeHelper(Grid<NavcellData>& grid, ICmpObstructionManager::flags_t requireMask, bool fullUpdate, pass_class_t appliedMask, entity_pos_t clearance = fixed::Zero()) const;
  1069. @@ -691,7 +691,7 @@
  1070. if (!cmpPosition || !cmpPosition->IsInWorld())
  1071. return fixed::FromInt(-1);
  1072.  
  1073. - return (CFixedVector2D(cmpPosition->GetPosition2D().X, cmpPosition->GetPosition2D().Y) - CFixedVector2D(px, pz)).Length();
  1074. + return (CFixedVector2D(cmpPosition->GetPosition2D().getX(), cmpPosition->GetPosition2D().getY()) - CFixedVector2D(px, pz)).Length();
  1075. }
  1076.  
  1077. fixed CCmpObstructionManager::MaxDistanceToPoint(entity_id_t ent, entity_pos_t px, entity_pos_t pz) const
  1078. @@ -710,7 +710,7 @@
  1079. if (!cmpPosition || !cmpPosition->IsInWorld())
  1080. return fixed::FromInt(-1);
  1081.  
  1082. - return (CFixedVector2D(cmpPosition->GetPosition2D().X, cmpPosition->GetPosition2D().Y) - CFixedVector2D(px, pz)).Length();
  1083. + return (CFixedVector2D(cmpPosition->GetPosition2D().getX(), cmpPosition->GetPosition2D().getY()) - CFixedVector2D(px, pz)).Length();
  1084. }
  1085.  
  1086. fixed CCmpObstructionManager::DistanceToTarget(entity_id_t ent, entity_id_t target) const
  1087. @@ -722,7 +722,7 @@
  1088. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), ent);
  1089. if (!cmpPosition || !cmpPosition->IsInWorld())
  1090. return fixed::FromInt(-1);
  1091. - return DistanceToPoint(target, cmpPosition->GetPosition2D().X, cmpPosition->GetPosition2D().Y);
  1092. + return DistanceToPoint(target, cmpPosition->GetPosition2D().getX(), cmpPosition->GetPosition2D().getY());
  1093. }
  1094.  
  1095. ObstructionSquare target_obstruction;
  1096. @@ -732,7 +732,7 @@
  1097. CmpPtr<ICmpPosition> cmpPositionTarget(GetSimContext(), target);
  1098. if (!cmpPositionTarget || !cmpPositionTarget->IsInWorld())
  1099. return fixed::FromInt(-1);
  1100. - return DistanceToPoint(ent, cmpPositionTarget->GetPosition2D().X, cmpPositionTarget->GetPosition2D().Y);
  1101. + return DistanceToPoint(ent, cmpPositionTarget->GetPosition2D().getX(), cmpPositionTarget->GetPosition2D().getY());
  1102. }
  1103.  
  1104. return DistanceBetweenShapes(obstruction, target_obstruction);
  1105. @@ -747,7 +747,7 @@
  1106. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), ent);
  1107. if (!cmpPosition || !cmpPosition->IsInWorld())
  1108. return fixed::FromInt(-1);
  1109. - return MaxDistanceToPoint(target, cmpPosition->GetPosition2D().X, cmpPosition->GetPosition2D().Y);
  1110. + return MaxDistanceToPoint(target, cmpPosition->GetPosition2D().getX(), cmpPosition->GetPosition2D().getY());
  1111. }
  1112.  
  1113. ObstructionSquare target_obstruction;
  1114. @@ -757,7 +757,7 @@
  1115. CmpPtr<ICmpPosition> cmpPositionTarget(GetSimContext(), target);
  1116. if (!cmpPositionTarget || !cmpPositionTarget->IsInWorld())
  1117. return fixed::FromInt(-1);
  1118. - return MaxDistanceToPoint(ent, cmpPositionTarget->GetPosition2D().X, cmpPositionTarget->GetPosition2D().Y);
  1119. + return MaxDistanceToPoint(ent, cmpPositionTarget->GetPosition2D().getX(), cmpPositionTarget->GetPosition2D().getY());
  1120. }
  1121.  
  1122. return MaxDistanceBetweenShapes(obstruction, target_obstruction);
  1123. @@ -922,8 +922,8 @@
  1124. CFixedVector2D v(s, c);
  1125. CFixedVector2D center(x, z);
  1126. CFixedVector2D halfSize(w/2, h/2);
  1127. - CFixedVector2D corner1 = u.Multiply(halfSize.X) + v.Multiply(halfSize.Y);
  1128. - CFixedVector2D corner2 = u.Multiply(halfSize.X) - v.Multiply(halfSize.Y);
  1129. + CFixedVector2D corner1 = u.Multiply(halfSize.getX()) + v.Multiply(halfSize.getY());
  1130. + CFixedVector2D corner2 = u.Multiply(halfSize.getX()) - v.Multiply(halfSize.getY());
  1131.  
  1132. // Check that all corners are within the world (which means the whole shape must be)
  1133. if (!IsInWorld(center + corner1) || !IsInWorld(center + corner2) ||
  1134. @@ -935,8 +935,8 @@
  1135. return true;
  1136. }
  1137.  
  1138. - fixed bbHalfWidth = std::max(corner1.X.Absolute(), corner2.X.Absolute());
  1139. - fixed bbHalfHeight = std::max(corner1.Y.Absolute(), corner2.Y.Absolute());
  1140. + fixed bbHalfWidth = std::max(corner1.getX().Absolute(), corner2.getX().Absolute());
  1141. + fixed bbHalfHeight = std::max(corner1.getY().Absolute(), corner2.getY().Absolute());
  1142. CFixedVector2D posMin(x - bbHalfWidth, z - bbHalfHeight);
  1143. CFixedVector2D posMax(x + bbHalfWidth, z + bbHalfHeight);
  1144.  
  1145. @@ -952,7 +952,7 @@
  1146.  
  1147. CFixedVector2D center1(it->second.x, it->second.z);
  1148.  
  1149. - if (Geometry::PointIsInSquare(center1 - center, u, v, CFixedVector2D(halfSize.X + it->second.clearance, halfSize.Y + it->second.clearance)))
  1150. + if (Geometry::PointIsInSquare(center1 - center, u, v, CFixedVector2D(halfSize.getX() + it->second.clearance, halfSize.getY() + it->second.clearance)))
  1151. {
  1152. if (out)
  1153. out->push_back(it->second.entity);
  1154. @@ -1141,8 +1141,8 @@
  1155. entity_pos_t r = pair.second.clearance + clearance;
  1156.  
  1157. u16 i0, j0, i1, j1;
  1158. - Pathfinding::NearestNavcell(center.X - r, center.Y - r, i0, j0, grid.m_W, grid.m_H);
  1159. - Pathfinding::NearestNavcell(center.X + r, center.Y + r, i1, j1, grid.m_W, grid.m_H);
  1160. + Pathfinding::NearestNavcell(center.getX() - r, center.getY() - r, i0, j0, grid.m_W, grid.m_H);
  1161. + Pathfinding::NearestNavcell(center.getX() + r, center.getY() + r, i1, j1, grid.m_W, grid.m_H);
  1162. for (u16 j = j0+1; j < j1; ++j)
  1163. for (u16 i = i0+1; i < i1; ++i)
  1164. grid.set(i, j, grid.get(i, j) | appliedMask);
  1165. @@ -1338,7 +1338,7 @@
  1166. {
  1167. m_DebugOverlayLines.push_back(SOverlayLine());
  1168. m_DebugOverlayLines.back().m_Color = defaultColor;
  1169. - float a = atan2f(it->second.v.X.ToFloat(), it->second.v.Y.ToFloat());
  1170. + float a = atan2f(it->second.v.getX().ToFloat(), it->second.v.getY().ToFloat());
  1171. SimRender::ConstructSquareOnGround(GetSimContext(), it->second.x.ToFloat(), it->second.z.ToFloat(), it->second.hw.ToFloat()*2, it->second.hh.ToFloat()*2, a, m_DebugOverlayLines.back(), true);
  1172. }
  1173.  
  1174. Index: 0ad/source/simulation2/components/CCmpOverlayRenderer.cpp
  1175. ===================================================================
  1176. --- 0ad/source/simulation2/components/CCmpOverlayRenderer.cpp (revision 24769)
  1177. +++ 0ad/source/simulation2/components/CCmpOverlayRenderer.cpp (working copy)
  1178. @@ -125,10 +125,10 @@
  1179.  
  1180. SOverlaySprite sprite;
  1181. sprite.m_Texture = g_Renderer.GetTextureManager().CreateTexture(textureProps);
  1182. - sprite.m_X0 = corner0.X.ToFloat();
  1183. - sprite.m_Y0 = corner0.Y.ToFloat();
  1184. - sprite.m_X1 = corner1.X.ToFloat();
  1185. - sprite.m_Y1 = corner1.Y.ToFloat();
  1186. + sprite.m_X0 = corner0.getX().ToFloat();
  1187. + sprite.m_Y0 = corner0.getY().ToFloat();
  1188. + sprite.m_X1 = corner1.getX().ToFloat();
  1189. + sprite.m_Y1 = corner1.getY().ToFloat();
  1190. sprite.m_Color = colorObj;
  1191.  
  1192. m_Sprites.push_back(sprite);
  1193. Index: 0ad/source/simulation2/components/CCmpPosition.cpp
  1194. ===================================================================
  1195. --- 0ad/source/simulation2/components/CCmpPosition.cpp (revision 24769)
  1196. +++ 0ad/source/simulation2/components/CCmpPosition.cpp (working copy)
  1197. @@ -224,9 +224,9 @@
  1198. serialize.NumberU32_Unbounded("turret parent", m_TurretParent);
  1199. if (m_TurretParent != INVALID_ENTITY)
  1200. {
  1201. - serialize.NumberFixed_Unbounded("x", m_TurretPosition.X);
  1202. - serialize.NumberFixed_Unbounded("y", m_TurretPosition.Y);
  1203. - serialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
  1204. + serialize.NumberFixed_Unbounded("x", m_TurretPosition.getX());
  1205. + serialize.NumberFixed_Unbounded("y", m_TurretPosition.getY());
  1206. + serialize.NumberFixed_Unbounded("z", m_TurretPosition.getZ());
  1207. }
  1208. }
  1209.  
  1210. @@ -261,9 +261,9 @@
  1211. deserialize.NumberU32_Unbounded("turret parent", m_TurretParent);
  1212. if (m_TurretParent != INVALID_ENTITY)
  1213. {
  1214. - deserialize.NumberFixed_Unbounded("x", m_TurretPosition.X);
  1215. - deserialize.NumberFixed_Unbounded("y", m_TurretPosition.Y);
  1216. - deserialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
  1217. + deserialize.NumberFixed_Unbounded("x", m_TurretPosition.Xref());
  1218. + deserialize.NumberFixed_Unbounded("y", m_TurretPosition.Yref());
  1219. + deserialize.NumberFixed_Unbounded("z", m_TurretPosition.Zref());
  1220. }
  1221.  
  1222. if (m_InWorld)
  1223. @@ -291,14 +291,14 @@
  1224. MoveOutOfWorld();
  1225. else
  1226. {
  1227. - CFixedVector2D rotatedPosition = CFixedVector2D(m_TurretPosition.X, m_TurretPosition.Z);
  1228. - rotatedPosition = rotatedPosition.Rotate(cmpPosition->GetRotation().Y);
  1229. + CFixedVector2D rotatedPosition = CFixedVector2D(m_TurretPosition.getX(), m_TurretPosition.getZ());
  1230. + rotatedPosition = rotatedPosition.Rotate(cmpPosition->GetRotation().getY());
  1231. CFixedVector2D rootPosition = cmpPosition->GetPosition2D();
  1232. - entity_pos_t x = rootPosition.X + rotatedPosition.X;
  1233. - entity_pos_t z = rootPosition.Y + rotatedPosition.Y;
  1234. + entity_pos_t x = rootPosition.getX() + rotatedPosition.getX();
  1235. + entity_pos_t z = rootPosition.getY() + rotatedPosition.getY();
  1236. if (!m_InWorld || m_X != x || m_Z != z)
  1237. MoveTo(x, z);
  1238. - entity_pos_t y = cmpPosition->GetHeightOffset() + m_TurretPosition.Y;
  1239. + entity_pos_t y = cmpPosition->GetHeightOffset() + m_TurretPosition.getY();
  1240. if (!m_InWorld || GetHeightOffset() != y)
  1241. SetHeightOffset(y);
  1242. m_InWorld = true;
  1243. @@ -312,7 +312,7 @@
  1244.  
  1245. virtual void SetTurretParent(entity_id_t id, const CFixedVector3D& offset)
  1246. {
  1247. - entity_angle_t angle = GetRotation().Y;
  1248. + entity_angle_t angle = GetRotation().getY();
  1249. if (m_TurretParent != INVALID_ENTITY)
  1250. {
  1251. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent);
  1252. @@ -555,7 +555,7 @@
  1253. {
  1254. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent);
  1255. if (cmpPosition)
  1256. - y -= cmpPosition->GetRotation().Y;
  1257. + y -= cmpPosition->GetRotation().getY();
  1258. }
  1259. m_RotY = y;
  1260.  
  1261. @@ -569,7 +569,7 @@
  1262. {
  1263. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent);
  1264. if (cmpPosition)
  1265. - y -= cmpPosition->GetRotation().Y;
  1266. + y -= cmpPosition->GetRotation().getY();
  1267. }
  1268. m_RotY = y;
  1269. m_InterpolatedRotY = m_RotY.ToFloat();
  1270. @@ -607,7 +607,7 @@
  1271. {
  1272. CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent);
  1273. if (cmpPosition)
  1274. - y += cmpPosition->GetRotation().Y;
  1275. + y += cmpPosition->GetRotation().getY();
  1276. }
  1277. return CFixedVector3D(m_RotX, y, m_RotZ);
  1278. }
  1279. @@ -691,7 +691,7 @@
  1280. CMatrix3D parentTransformMatrix = cmpPosition->GetInterpolatedTransform(frameOffset);
  1281. CMatrix3D ownTransformation = CMatrix3D();
  1282. ownTransformation.SetYRotation(m_InterpolatedRotY);
  1283. - ownTransformation.Translate(-m_TurretPosition.X.ToFloat(), m_TurretPosition.Y.ToFloat(), -m_TurretPosition.Z.ToFloat());
  1284. + ownTransformation.Translate(-m_TurretPosition.getX().ToFloat(), m_TurretPosition.getY().ToFloat(), -m_TurretPosition.getZ().ToFloat());
  1285. return parentTransformMatrix * ownTransformation;
  1286. }
  1287. }
  1288. Index: 0ad/source/simulation2/components/CCmpRallyPointRenderer.cpp
  1289. ===================================================================
  1290. --- 0ad/source/simulation2/components/CCmpRallyPointRenderer.cpp (revision 24769)
  1291. +++ 0ad/source/simulation2/components/CCmpRallyPointRenderer.cpp (working copy)
  1292. @@ -244,7 +244,7 @@
  1293. {
  1294. if (m_Displayed && IsSet())
  1295. {
  1296. - markerCmpPosition->MoveTo(m_RallyPoints[i].X, m_RallyPoints[i].Y);
  1297. + markerCmpPosition->MoveTo(m_RallyPoints[i].getX(), m_RallyPoints[i].getY());
  1298. }
  1299. else
  1300. {
  1301. @@ -367,22 +367,22 @@
  1302. std::vector<Waypoint>& waypoints = path.m_Waypoints;
  1303.  
  1304. CFixedVector2D start(cmpPosition->GetPosition2D());
  1305. - PathGoal goal = { PathGoal::POINT, m_RallyPoints[index].X, m_RallyPoints[index].Y };
  1306. + PathGoal goal = { PathGoal::POINT, m_RallyPoints[index].getX(), m_RallyPoints[index].getY() };
  1307.  
  1308. if (index == 0)
  1309. GetClosestsEdgePointFrom(start,m_RallyPoints[index], cmpPosition, cmpFootprint);
  1310. else
  1311. {
  1312. - start.X = m_RallyPoints[index-1].X;
  1313. - start.Y = m_RallyPoints[index-1].Y;
  1314. + start.Xref() = m_RallyPoints[index-1].getX();
  1315. + start.Yref() = m_RallyPoints[index-1].getY();
  1316. }
  1317. - cmpPathfinder->ComputePathImmediate(start.X, start.Y, goal, cmpPathfinder->GetPassabilityClass(m_LinePassabilityClass), path);
  1318. + cmpPathfinder->ComputePathImmediate(start.getX(), start.getY(), goal, cmpPathfinder->GetPassabilityClass(m_LinePassabilityClass), path);
  1319.  
  1320. // Check if we got a path back; if not we probably have two markers less than one tile apart.
  1321. if (path.m_Waypoints.size() < 2)
  1322. {
  1323. - m_Path[index].emplace_back(start.X.ToFloat(), start.Y.ToFloat());
  1324. - m_Path[index].emplace_back(m_RallyPoints[index].X.ToFloat(), m_RallyPoints[index].Y.ToFloat());
  1325. + m_Path[index].emplace_back(start.getX().ToFloat(), start.getY().ToFloat());
  1326. + m_Path[index].emplace_back(m_RallyPoints[index].getX().ToFloat(), m_RallyPoints[index].getY().ToFloat());
  1327. return;
  1328. }
  1329. else if (index == 0)
  1330. @@ -390,19 +390,19 @@
  1331. // Sometimes this ends up not being optimal if you asked for a long path, so improve.
  1332. CFixedVector2D newend(waypoints[waypoints.size()-2].x,waypoints[waypoints.size()-2].z);
  1333. GetClosestsEdgePointFrom(newend,newend, cmpPosition, cmpFootprint);
  1334. - waypoints.back().x = newend.X;
  1335. - waypoints.back().z = newend.Y;
  1336. + waypoints.back().x = newend.getX();
  1337. + waypoints.back().z = newend.getY();
  1338. }
  1339. else
  1340. {
  1341. // Make sure we actually start at the rallypoint because the pathfinder moves us to a usable tile.
  1342. - waypoints.back().x = m_RallyPoints[index-1].X;
  1343. - waypoints.back().z = m_RallyPoints[index-1].Y;
  1344. + waypoints.back().x = m_RallyPoints[index-1].getX();
  1345. + waypoints.back().z = m_RallyPoints[index-1].getY();
  1346. }
  1347.  
  1348. // Pathfinder makes us go to the nearest passable cell which isn't always what we want
  1349. - waypoints[0].x = m_RallyPoints[index].X;
  1350. - waypoints[0].z = m_RallyPoints[index].Y;
  1351. + waypoints[0].x = m_RallyPoints[index].getX();
  1352. + waypoints[0].z = m_RallyPoints[index].getY();
  1353.  
  1354. // From here on, we choose to represent the waypoints as CVector2D floats to avoid to have to convert back and forth
  1355. // between fixed-point Waypoint/CFixedVector2D and various other float-based formats used by interpolation and whatnot.
  1356. @@ -677,7 +677,7 @@
  1357.  
  1358. // Sinus and cosinus of the Y axis rotation angle (aka the yaw)
  1359. fixed s, c;
  1360. - fixed a = cmpPosition->GetRotation().Y;
  1361. + fixed a = cmpPosition->GetRotation().getY();
  1362. sincos_approx(a, s, c);
  1363. // Unit vector along the rotated X axis
  1364. CFixedVector2D u(c, -s);
  1365. @@ -693,7 +693,7 @@
  1366. {
  1367. // In this case, both footprintSize0 and 1 indicate the circle's radius
  1368. // Transform target to the point nearest on the edge.
  1369. - CFixedVector2D centerVec2D(center.X, center.Y);
  1370. + CFixedVector2D centerVec2D(center.getX(), center.getY());
  1371. CFixedVector2D centerToLast(start - centerVec2D);
  1372. centerToLast.Normalize();
  1373. result = centerVec2D + (centerToLast.Multiply(footprintSize0));
  1374. Index: 0ad/source/simulation2/components/CCmpRangeManager.cpp
  1375. ===================================================================
  1376. --- 0ad/source/simulation2/components/CCmpRangeManager.cpp (revision 24769)
  1377. +++ 0ad/source/simulation2/components/CCmpRangeManager.cpp (working copy)
  1378. @@ -166,11 +166,11 @@
  1379. */
  1380. static bool InParabolicRange(CFixedVector3D v, fixed range)
  1381. {
  1382. - u64 xx = SQUARE_U64_FIXED(v.X); // xx <= 2^62
  1383. - u64 zz = SQUARE_U64_FIXED(v.Z);
  1384. + u64 xx = SQUARE_U64_FIXED(v.getX()); // xx <= 2^62
  1385. + u64 zz = SQUARE_U64_FIXED(v.getZ());
  1386. i64 d2 = (xx + zz) >> 1; // d2 <= 2^62 (no overflow)
  1387.  
  1388. - i32 y = v.Y.GetInternalValue();
  1389. + i32 y = v.getY().GetInternalValue();
  1390. i32 c = range.GetInternalValue();
  1391. i32 c_2 = c >> 1;
  1392.  
  1393. @@ -1221,7 +1221,7 @@
  1394. // they have an intersection after which the former grows slower, and then use that to prove the above.
  1395. // Note that this is only true because we do not account for vertical size here,
  1396. // if we did, we would also need to artificially 'raise' the source over the target.
  1397. - if (!InParabolicRange(CFixedVector3D(it->second.x, secondPosition.Y, it->second.z) - pos3d,
  1398. + if (!InParabolicRange(CFixedVector3D(it->second.x, secondPosition.getY(), it->second.z) - pos3d,
  1399. q.maxRange + fixed::FromInt(it->second.size)))
  1400. continue;
  1401.  
  1402. @@ -1267,8 +1267,8 @@
  1403. entity_pos_t r = entity_pos_t::Zero();
  1404. CFixedVector3D pos(pos1);
  1405.  
  1406. - pos.Y += elevationBonus;
  1407. - entity_pos_t orientation = rot.Y;
  1408. + pos.Yref() += elevationBonus;
  1409. + entity_pos_t orientation = rot.getY();
  1410.  
  1411. entity_pos_t maxAngle = orientation + angle/2;
  1412. entity_pos_t minAngle = orientation - angle/2;
  1413. @@ -1301,8 +1301,8 @@
  1414. u64 precisionSquared = SQUARE_U64_FIXED(entity_pos_t::FromInt(static_cast<int>(TERRAIN_TILE_SIZE)) / 8);
  1415.  
  1416. CmpPtr<ICmpWaterManager> cmpWaterManager(GetSystemEntity());
  1417. - entity_pos_t waterLevel = cmpWaterManager ? cmpWaterManager->GetWaterLevel(pos.X, pos.Z) : entity_pos_t::Zero();
  1418. - entity_pos_t thisHeight = pos.Y > waterLevel ? pos.Y : waterLevel;
  1419. + entity_pos_t waterLevel = cmpWaterManager ? cmpWaterManager->GetWaterLevel(pos.getX(), pos.getZ()) : entity_pos_t::Zero();
  1420. + entity_pos_t thisHeight = pos.getY() > waterLevel ? pos.getY() : waterLevel;
  1421.  
  1422. for (int i = 0; i < numberOfSteps; ++i)
  1423. {
  1424. @@ -1315,14 +1315,14 @@
  1425.  
  1426. CFixedVector2D minVector = CFixedVector2D(entity_pos_t::Zero(), entity_pos_t::Zero());
  1427. CFixedVector2D maxVector = CFixedVector2D(sin, cos).Multiply(cutoff);
  1428. - entity_pos_t targetHeight = cmpTerrain->GetGroundLevel(pos.X+maxVector.X, pos.Z+maxVector.Y);
  1429. + entity_pos_t targetHeight = cmpTerrain->GetGroundLevel(pos.getX()+maxVector.getX(), pos.getZ()+maxVector.getY());
  1430. // use water level to display range on water
  1431. targetHeight = targetHeight > waterLevel ? targetHeight : waterLevel;
  1432.  
  1433. - if (InParabolicRange(CFixedVector3D(maxVector.X, targetHeight-thisHeight, maxVector.Y), maxRange))
  1434. + if (InParabolicRange(CFixedVector3D(maxVector.getX(), targetHeight-thisHeight, maxVector.getY()), maxRange))
  1435. {
  1436. - r.push_back(maxVector.X);
  1437. - r.push_back(maxVector.Y);
  1438. + r.push_back(maxVector.getX());
  1439. + r.push_back(maxVector.getY());
  1440. continue;
  1441. }
  1442.  
  1443. @@ -1335,10 +1335,10 @@
  1444. CFixedVector2D newVector = CFixedVector2D(sin, cos).Multiply(newDistance);
  1445.  
  1446. // get the height of the ground
  1447. - targetHeight = cmpTerrain->GetGroundLevel(pos.X+newVector.X, pos.Z+newVector.Y);
  1448. + targetHeight = cmpTerrain->GetGroundLevel(pos.getX()+newVector.getX(), pos.getZ()+newVector.getY());
  1449. targetHeight = targetHeight > waterLevel ? targetHeight : waterLevel;
  1450.  
  1451. - if (InParabolicRange(CFixedVector3D(newVector.X, targetHeight-thisHeight, newVector.Y), maxRange))
  1452. + if (InParabolicRange(CFixedVector3D(newVector.getX(), targetHeight-thisHeight, newVector.getY()), maxRange))
  1453. {
  1454. // new vector is in parabolic range, so this is a new minVector
  1455. minVector = newVector;
  1456. @@ -1352,8 +1352,8 @@
  1457. }
  1458.  
  1459. }
  1460. - r.push_back(maxVector.X);
  1461. - r.push_back(maxVector.Y);
  1462. + r.push_back(maxVector.getX());
  1463. + r.push_back(maxVector.getY());
  1464.  
  1465. }
  1466. r.push_back(r[0]);
  1467. @@ -1453,13 +1453,13 @@
  1468. {
  1469. m_DebugOverlayLines.push_back(SOverlayLine());
  1470. m_DebugOverlayLines.back().m_Color = (q.enabled ? enabledRingColor : disabledRingColor);
  1471. - SimRender::ConstructCircleOnGround(GetSimContext(), pos.X.ToFloat(), pos.Y.ToFloat(), q.maxRange.ToFloat(), m_DebugOverlayLines.back(), true);
  1472. + SimRender::ConstructCircleOnGround(GetSimContext(), pos.getX().ToFloat(), pos.getY().ToFloat(), q.maxRange.ToFloat(), m_DebugOverlayLines.back(), true);
  1473. }
  1474. else
  1475. {
  1476. // elevation bonus is part of the 3D position. As if the unit is really that much higher
  1477. CFixedVector3D pos3D = cmpSourcePosition->GetPosition();
  1478. - pos3D.Y += q.elevationBonus;
  1479. + pos3D.Yref() += q.elevationBonus;
  1480.  
  1481. std::vector<entity_pos_t> coords;
  1482.  
  1483. @@ -1504,10 +1504,10 @@
  1484. for (size_t i = 3; i < coords.size(); i += 2)
  1485. {
  1486. std::vector<float> c;
  1487. - c.push_back((coords[i - 3] + pos3D.X).ToFloat());
  1488. - c.push_back((coords[i - 2] + pos3D.Z).ToFloat());
  1489. - c.push_back((coords[i - 1] + pos3D.X).ToFloat());
  1490. - c.push_back((coords[i] + pos3D.Z).ToFloat());
  1491. + c.push_back((coords[i - 3] + pos3D.getX()).ToFloat());
  1492. + c.push_back((coords[i - 2] + pos3D.getZ()).ToFloat());
  1493. + c.push_back((coords[i - 1] + pos3D.getX()).ToFloat());
  1494. + c.push_back((coords[i] + pos3D.getZ()).ToFloat());
  1495. m_DebugOverlayLines.push_back(SOverlayLine());
  1496. m_DebugOverlayLines.back().m_Color = thiscolor;
  1497. SimRender::ConstructLineOnGround(GetSimContext(), c, m_DebugOverlayLines.back(), true);
  1498. @@ -1516,7 +1516,7 @@
  1499.  
  1500. // Draw the min range circle
  1501. if (!q.minRange.IsZero())
  1502. - SimRender::ConstructCircleOnGround(GetSimContext(), pos.X.ToFloat(), pos.Y.ToFloat(), q.minRange.ToFloat(), m_DebugOverlayLines.back(), true);
  1503. + SimRender::ConstructCircleOnGround(GetSimContext(), pos.getX().ToFloat(), pos.getY().ToFloat(), q.minRange.ToFloat(), m_DebugOverlayLines.back(), true);
  1504.  
  1505. // Draw a ray from the source to each matched entity
  1506. for (size_t i = 0; i < q.lastMatch.size(); ++i)
  1507. @@ -1527,10 +1527,10 @@
  1508. CFixedVector2D targetPos = cmpTargetPosition->GetPosition2D();
  1509.  
  1510. std::vector<float> coords;
  1511. - coords.push_back(pos.X.ToFloat());
  1512. - coords.push_back(pos.Y.ToFloat());
  1513. - coords.push_back(targetPos.X.ToFloat());
  1514. - coords.push_back(targetPos.Y.ToFloat());
  1515. + coords.push_back(pos.getX().ToFloat());
  1516. + coords.push_back(pos.getY().ToFloat());
  1517. + coords.push_back(targetPos.getX().ToFloat());
  1518. + coords.push_back(targetPos.getY().ToFloat());
  1519.  
  1520. m_DebugOverlayLines.push_back(SOverlayLine());
  1521. m_DebugOverlayLines.back().m_Color = rayColor;
  1522. @@ -1623,8 +1623,8 @@
  1523. return LosVisibility::HIDDEN;
  1524.  
  1525. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1526. - int i = (pos.X / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1527. - int j = (pos.Y / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1528. + int i = (pos.getX() / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1529. + int j = (pos.getY() / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1530.  
  1531. // Reveal flag makes all positioned entities visible and all mirages useless
  1532. if (GetLosRevealAll(player))
  1533. @@ -1729,7 +1729,7 @@
  1534.  
  1535. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1536.  
  1537. - if (IsVisibilityDirty(m_DirtyVisibility[PosToLosTilesHelper(pos.X, pos.Y)], player))
  1538. + if (IsVisibilityDirty(m_DirtyVisibility[PosToLosTilesHelper(pos.getX(), pos.getY())], player))
  1539. return ComputeLosVisibility(ent, player);
  1540.  
  1541. if (std::find(m_ModifiedEntities.begin(), m_ModifiedEntities.end(), entId) != m_ModifiedEntities.end())
  1542. @@ -2017,8 +2017,8 @@
  1543. continue;
  1544.  
  1545. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1546. - int i = (pos.X / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1547. - int j = (pos.Y / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1548. + int i = (pos.getX() / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1549. + int j = (pos.getY() / (int)TERRAIN_TILE_SIZE).ToInt_RoundToNearest();
  1550.  
  1551. CLosQuerier los(GetSharedLosMask(p), m_LosState, m_TerrainVerticesPerSide);
  1552. if (!los.IsExplored(i,j) || los.IsVisible(i,j))
  1553. @@ -2203,14 +2203,14 @@
  1554.  
  1555. // Compute top/bottom coordinates, and clamp to exclude the 1-tile border around the map
  1556. // (so that we never render the sharp edge of the map)
  1557. - i32 j0 = ((pos.Y - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1558. - i32 j1 = ((pos.Y + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1559. + i32 j0 = ((pos.getY() - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1560. + i32 j1 = ((pos.getY() + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1561. i32 j0clamp = std::max(j0, 1);
  1562. i32 j1clamp = std::min(j1, m_TerrainVerticesPerSide-2);
  1563.  
  1564. // Translate world coordinates into fractional tile-space coordinates
  1565. - entity_pos_t x = pos.X / (int)TERRAIN_TILE_SIZE;
  1566. - entity_pos_t y = pos.Y / (int)TERRAIN_TILE_SIZE;
  1567. + entity_pos_t x = pos.getX() / (int)TERRAIN_TILE_SIZE;
  1568. + entity_pos_t y = pos.getY() / (int)TERRAIN_TILE_SIZE;
  1569. entity_pos_t r = visionRange / (int)TERRAIN_TILE_SIZE;
  1570. entity_pos_t r2 = r.Square();
  1571.  
  1572. @@ -2286,17 +2286,17 @@
  1573. // so we can compute the difference between the removed/added strips
  1574. // and only have to touch tiles that have a net change.)
  1575.  
  1576. - i32 j0_from = ((from.Y - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1577. - i32 j1_from = ((from.Y + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1578. - i32 j0_to = ((to.Y - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1579. - i32 j1_to = ((to.Y + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1580. + i32 j0_from = ((from.getY() - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1581. + i32 j1_from = ((from.getY() + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1582. + i32 j0_to = ((to.getY() - visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
  1583. + i32 j1_to = ((to.getY() + visionRange)/(int)TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
  1584. i32 j0clamp = std::max(std::min(j0_from, j0_to), 1);
  1585. i32 j1clamp = std::min(std::max(j1_from, j1_to), m_TerrainVerticesPerSide-2);
  1586.  
  1587. - entity_pos_t x_from = from.X / (int)TERRAIN_TILE_SIZE;
  1588. - entity_pos_t y_from = from.Y / (int)TERRAIN_TILE_SIZE;
  1589. - entity_pos_t x_to = to.X / (int)TERRAIN_TILE_SIZE;
  1590. - entity_pos_t y_to = to.Y / (int)TERRAIN_TILE_SIZE;
  1591. + entity_pos_t x_from = from.getX() / (int)TERRAIN_TILE_SIZE;
  1592. + entity_pos_t y_from = from.getY() / (int)TERRAIN_TILE_SIZE;
  1593. + entity_pos_t x_to = to.getX() / (int)TERRAIN_TILE_SIZE;
  1594. + entity_pos_t y_to = to.getY() / (int)TERRAIN_TILE_SIZE;
  1595. entity_pos_t r = visionRange / (int)TERRAIN_TILE_SIZE;
  1596. entity_pos_t r2 = r.Square();
  1597.  
  1598. Index: 0ad/source/simulation2/components/CCmpTerritoryManager.cpp
  1599. ===================================================================
  1600. --- 0ad/source/simulation2/components/CCmpTerritoryManager.cpp (revision 24769)
  1601. +++ 0ad/source/simulation2/components/CCmpTerritoryManager.cpp (working copy)
  1602. @@ -486,7 +486,7 @@
  1603.  
  1604. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1605. u16 i, j;
  1606. - NearestTerritoryTile(pos.X, pos.Y, i, j, tilesW, tilesH);
  1607. + NearestTerritoryTile(pos.getX(), pos.getY(), i, j, tilesW, tilesH);
  1608.  
  1609. if (cmpTerritoryInfluence->IsRoot())
  1610. rootInfluenceEntities.push_back(ent);
  1611. @@ -539,7 +539,7 @@
  1612.  
  1613. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1614. u16 i, j;
  1615. - NearestTerritoryTile(pos.X, pos.Y, i, j, tilesW, tilesH);
  1616. + NearestTerritoryTile(pos.getX(), pos.getY(), i, j, tilesW, tilesH);
  1617.  
  1618. u8 owner = (u8)cmpOwnership->GetOwner();
  1619.  
  1620. Index: 0ad/source/simulation2/components/CCmpUnitMotion.cpp
  1621. ===================================================================
  1622. --- 0ad/source/simulation2/components/CCmpUnitMotion.cpp (revision 24769)
  1623. +++ 0ad/source/simulation2/components/CCmpUnitMotion.cpp (working copy)
  1624. @@ -276,8 +276,8 @@
  1625.  
  1626. Serializer(serialize, "target type", m_MoveRequest.m_Type, MoveRequest::Type::OFFSET);
  1627. serialize.NumberU32_Unbounded("target entity", m_MoveRequest.m_Entity);
  1628. - serialize.NumberFixed_Unbounded("target pos x", m_MoveRequest.m_Position.X);
  1629. - serialize.NumberFixed_Unbounded("target pos y", m_MoveRequest.m_Position.Y);
  1630. + serialize.NumberFixed_Unbounded("target pos x", m_MoveRequest.m_Position.Xref());
  1631. + serialize.NumberFixed_Unbounded("target pos y", m_MoveRequest.m_Position.Yref());
  1632. serialize.NumberFixed_Unbounded("target min range", m_MoveRequest.m_MinRange);
  1633. serialize.NumberFixed_Unbounded("target max range", m_MoveRequest.m_MaxRange);
  1634.  
  1635. @@ -415,7 +415,7 @@
  1636. // TODO: formation members should perhaps try to use the controller's position.
  1637.  
  1638. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1639. - entity_angle_t angle = cmpPosition->GetRotation().Y;
  1640. + entity_angle_t angle = cmpPosition->GetRotation().getY();
  1641.  
  1642. // Copy the path so we don't change it.
  1643. WaypointPath shortPath = m_ShortPath;
  1644. @@ -497,7 +497,7 @@
  1645. {
  1646. CFixedVector2D targetPos;
  1647. if (ComputeTargetPosition(targetPos))
  1648. - FaceTowardsPointFromPos(cmpPosition->GetPosition2D(), targetPos.X, targetPos.Y);
  1649. + FaceTowardsPointFromPos(cmpPosition->GetPosition2D(), targetPos.getX(), targetPos.getY());
  1650. }
  1651. }
  1652.  
  1653. @@ -819,7 +819,7 @@
  1654.  
  1655. CFixedVector2D targetPos;
  1656. if (ComputeTargetPosition(targetPos))
  1657. - m_LongPath.m_Waypoints.emplace_back(Waypoint{ targetPos.X, targetPos.Y });
  1658. + m_LongPath.m_Waypoints.emplace_back(Waypoint{ targetPos.getX(), targetPos.getY() });
  1659. return;
  1660. }
  1661.  
  1662. @@ -882,7 +882,7 @@
  1663. return;
  1664.  
  1665. CFixedVector2D initialPos = cmpPosition->GetPosition2D();
  1666. - entity_angle_t initialAngle = cmpPosition->GetRotation().Y;
  1667. + entity_angle_t initialAngle = cmpPosition->GetRotation().getY();
  1668.  
  1669. // Keep track of the current unit's position and rotation during the update.
  1670. CFixedVector2D pos = initialPos;
  1671. @@ -907,8 +907,8 @@
  1672. // Update the Position component after our movement (if we actually moved anywhere)
  1673. // When moving always set the angle in the direction of the movement.
  1674. CFixedVector2D offset = pos - initialPos;
  1675. - angle = atan2_approx(offset.X, offset.Y);
  1676. - cmpPosition->MoveAndTurnTo(pos.X, pos.Y, angle);
  1677. + angle = atan2_approx(offset.getX(), offset.getY());
  1678. + cmpPosition->MoveAndTurnTo(pos.getX(), pos.getY(), angle);
  1679.  
  1680. // Calculate the mean speed over this past turn.
  1681. UpdateMovementState(offset.Length() / dt);
  1682. @@ -940,7 +940,7 @@
  1683. ENSURE(cmpObstructionManager);
  1684.  
  1685. if (m_MoveRequest.m_Type == MoveRequest::POINT)
  1686. - return cmpObstructionManager->IsInPointRange(GetEntityId(), m_MoveRequest.m_Position.X, m_MoveRequest.m_Position.Y, m_MoveRequest.m_MinRange, m_MoveRequest.m_MaxRange, false);
  1687. + return cmpObstructionManager->IsInPointRange(GetEntityId(), m_MoveRequest.m_Position.getX(), m_MoveRequest.m_Position.getY(), m_MoveRequest.m_MinRange, m_MoveRequest.m_MaxRange, false);
  1688. if (m_MoveRequest.m_Type == MoveRequest::ENTITY)
  1689. return cmpObstructionManager->IsInTargetRange(GetEntityId(), m_MoveRequest.m_Entity, m_MoveRequest.m_MinRange, m_MoveRequest.m_MaxRange, false);
  1690. if (m_MoveRequest.m_Type == MoveRequest::OFFSET)
  1691. @@ -952,7 +952,7 @@
  1692. CFixedVector2D targetPos;
  1693. ComputeTargetPosition(targetPos);
  1694. CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
  1695. - return cmpObstructionManager->IsInPointRange(GetEntityId(), targetPos.X, targetPos.Y, m_MoveRequest.m_MinRange, m_MoveRequest.m_MaxRange, false);
  1696. + return cmpObstructionManager->IsInPointRange(GetEntityId(), targetPos.getX(), targetPos.getY(), m_MoveRequest.m_MinRange, m_MoveRequest.m_MaxRange, false);
  1697. }
  1698. return false;
  1699. }
  1700. @@ -1009,7 +1009,7 @@
  1701. if (turnRate > zero)
  1702. {
  1703. fixed maxRotation = turnRate.Multiply(timeLeft);
  1704. - fixed angleDiff = angle - atan2_approx(offset.X, offset.Y);
  1705. + fixed angleDiff = angle - atan2_approx(offset.getX(), offset.getY());
  1706. if (angleDiff != zero)
  1707. {
  1708. fixed absoluteAngleDiff = angleDiff.Absolute();
  1709. @@ -1028,7 +1028,7 @@
  1710. break;
  1711. }
  1712. // Rotate towards the next waypoint and continue moving.
  1713. - angle = atan2_approx(offset.X, offset.Y);
  1714. + angle = atan2_approx(offset.getX(), offset.getY());
  1715. // Give some 'free' rotation for angles below 0.5 radians.
  1716. timeLeft = (std::min(maxRotation, maxRotation - absoluteAngleDiff + fixed::FromInt(1)/2)) / turnRate;
  1717. }
  1718. @@ -1041,7 +1041,7 @@
  1719. fixed offsetLength = offset.Length();
  1720. if (offsetLength <= maxdist)
  1721. {
  1722. - if (cmpPathfinder->CheckMovement(GetObstructionFilter(), pos.X, pos.Y, target.X, target.Y, m_Clearance, m_PassClass))
  1723. + if (cmpPathfinder->CheckMovement(GetObstructionFilter(), pos.getX(), pos.getY(), target.getX(), target.getY(), m_Clearance, m_PassClass))
  1724. {
  1725. pos = target;
  1726.  
  1727. @@ -1067,7 +1067,7 @@
  1728. offset.Normalize(maxdist);
  1729. target = pos + offset;
  1730.  
  1731. - if (cmpPathfinder->CheckMovement(GetObstructionFilter(), pos.X, pos.Y, target.X, target.Y, m_Clearance, m_PassClass))
  1732. + if (cmpPathfinder->CheckMovement(GetObstructionFilter(), pos.getX(), pos.getY(), target.getX(), target.getY(), m_Clearance, m_PassClass))
  1733. pos = target;
  1734. else
  1735. return true;
  1736. @@ -1195,7 +1195,7 @@
  1737. if (moveRequest.m_Type == MoveRequest::OFFSET)
  1738. {
  1739. // There is an offset, so compute it relative to orientation
  1740. - entity_angle_t angle = cmpTargetPosition->GetRotation().Y;
  1741. + entity_angle_t angle = cmpTargetPosition->GetRotation().getY();
  1742. CFixedVector2D offset = moveRequest.GetOffset().Rotate(angle);
  1743. out = cmpTargetPosition->GetPosition2D() + offset;
  1744. }
  1745. @@ -1244,8 +1244,8 @@
  1746. PathGoal goal;
  1747. if (!ComputeGoal(goal, m_MoveRequest))
  1748. return false;
  1749. - goal.x = targetPos.X;
  1750. - goal.z = targetPos.Y;
  1751. + goal.x = targetPos.getX();
  1752. + goal.z = targetPos.getY();
  1753. // (we ignore changes to the target's rotation, since only buildings are
  1754. // square and buildings don't move)
  1755.  
  1756. @@ -1264,10 +1264,10 @@
  1757.  
  1758. if (specificIgnore.valid())
  1759. {
  1760. - if (!cmpPathfinder->CheckMovement(SkipTagObstructionFilter(specificIgnore), from.X, from.Y, goalPos.X, goalPos.Y, m_Clearance, m_PassClass))
  1761. + if (!cmpPathfinder->CheckMovement(SkipTagObstructionFilter(specificIgnore), from.getX(), from.getY(), goalPos.getX(), goalPos.getY(), m_Clearance, m_PassClass))
  1762. return false;
  1763. }
  1764. - else if (!cmpPathfinder->CheckMovement(GetObstructionFilter(), from.X, from.Y, goalPos.X, goalPos.Y, m_Clearance, m_PassClass))
  1765. + else if (!cmpPathfinder->CheckMovement(GetObstructionFilter(), from.getX(), from.getY(), goalPos.getX(), goalPos.getY(), m_Clearance, m_PassClass))
  1766. return false;
  1767.  
  1768.  
  1769. @@ -1274,7 +1274,7 @@
  1770. // That route is okay, so update our path
  1771. m_LongPath.m_Waypoints.clear();
  1772. m_ShortPath.m_Waypoints.clear();
  1773. - m_ShortPath.m_Waypoints.emplace_back(Waypoint{ goalPos.X, goalPos.Y });
  1774. + m_ShortPath.m_Waypoints.emplace_back(Waypoint{ goalPos.getX(), goalPos.getY() });
  1775. return true;
  1776. }
  1777.  
  1778. @@ -1302,8 +1302,8 @@
  1779. cmpTargetObstruction->GetObstructionSquare(estimatedTargetShape);
  1780. }
  1781.  
  1782. - estimatedTargetShape.x = targetPos.X;
  1783. - estimatedTargetShape.z = targetPos.Y;
  1784. + estimatedTargetShape.x = targetPos.getX();
  1785. + estimatedTargetShape.z = targetPos.getY();
  1786.  
  1787. CmpPtr<ICmpObstruction> cmpObstruction(GetEntityHandle());
  1788. ICmpObstructionManager::ObstructionSquare shape;
  1789. @@ -1313,8 +1313,8 @@
  1790. // Translate our own obstruction shape to our last waypoint or our current position, lacking that.
  1791. if (m_LongPath.m_Waypoints.empty() && m_ShortPath.m_Waypoints.empty())
  1792. {
  1793. - shape.x = from.X;
  1794. - shape.z = from.Y;
  1795. + shape.x = from.getX();
  1796. + shape.z = from.getY();
  1797. }
  1798. else
  1799. {
  1800. @@ -1358,7 +1358,7 @@
  1801. CFixedVector2D offset = target - pos;
  1802. if (!offset.IsZero())
  1803. {
  1804. - entity_angle_t angle = atan2_approx(offset.X, offset.Y);
  1805. + entity_angle_t angle = atan2_approx(offset.getX(), offset.getY());
  1806.  
  1807. CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
  1808. if (!cmpPosition)
  1809. @@ -1407,8 +1407,8 @@
  1810. if (cmpTargetObstruction)
  1811. cmpTargetObstruction->GetObstructionSquare(targetObstruction);
  1812. }
  1813. - targetObstruction.x = targetPosition.X;
  1814. - targetObstruction.z = targetPosition.Y;
  1815. + targetObstruction.x = targetPosition.getX();
  1816. + targetObstruction.z = targetPosition.getY();
  1817.  
  1818. ICmpObstructionManager::ObstructionSquare obstruction;
  1819. CmpPtr<ICmpObstruction> cmpObstruction(GetEntityHandle());
  1820. @@ -1416,8 +1416,8 @@
  1821. cmpObstruction->GetObstructionSquare(obstruction);
  1822. else
  1823. {
  1824. - obstruction.x = pos.X;
  1825. - obstruction.z = pos.Y;
  1826. + obstruction.x = pos.getX();
  1827. + obstruction.z = pos.getY();
  1828. }
  1829.  
  1830. CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
  1831. @@ -1552,10 +1552,10 @@
  1832. PathGoal improvedGoal = goal;
  1833. improvedGoal.maxdist = SHORT_PATH_MIN_SEARCH_RANGE - entity_pos_t::FromInt(1);
  1834.  
  1835. - cmpPathfinder->SetDebugPath(from.X, from.Y, improvedGoal, m_PassClass);
  1836. + cmpPathfinder->SetDebugPath(from.getX(), from.getY(), improvedGoal, m_PassClass);
  1837.  
  1838. m_ExpectedPathTicket.m_Type = Ticket::LONG_PATH;
  1839. - m_ExpectedPathTicket.m_Ticket = cmpPathfinder->ComputePathAsync(from.X, from.Y, improvedGoal, m_PassClass, GetEntityId());
  1840. + m_ExpectedPathTicket.m_Ticket = cmpPathfinder->ComputePathAsync(from.getX(), from.getY(), improvedGoal, m_PassClass, GetEntityId());
  1841. }
  1842.  
  1843. void CCmpUnitMotion::RequestShortPath(const CFixedVector2D &from, const PathGoal& goal, bool extendRange)
  1844. @@ -1567,13 +1567,13 @@
  1845. entity_pos_t searchRange = ShortPathSearchRange();
  1846. if (extendRange)
  1847. {
  1848. - CFixedVector2D dist(from.X - goal.x, from.Y - goal.z);
  1849. + CFixedVector2D dist(from.getX() - goal.x, from.getY() - goal.z);
  1850. if (dist.CompareLength(searchRange - entity_pos_t::FromInt(1)) >= 0)
  1851. searchRange = dist.Length() + fixed::FromInt(1);
  1852. }
  1853.  
  1854. m_ExpectedPathTicket.m_Type = Ticket::SHORT_PATH;
  1855. - m_ExpectedPathTicket.m_Ticket = cmpPathfinder->ComputeShortPathAsync(from.X, from.Y, m_Clearance, searchRange, goal, m_PassClass, true, GetGroup(), GetEntityId());
  1856. + m_ExpectedPathTicket.m_Ticket = cmpPathfinder->ComputeShortPathAsync(from.getX(), from.getY(), m_Clearance, searchRange, goal, m_PassClass, true, GetGroup(), GetEntityId());
  1857. }
  1858.  
  1859. bool CCmpUnitMotion::MoveTo(MoveRequest request)
  1860. @@ -1612,7 +1612,7 @@
  1861.  
  1862. CmpPtr<ICmpPathfinder> cmpPathfinder(GetSimContext(), SYSTEM_ENTITY);
  1863. CFixedVector2D pos = cmpPosition->GetPosition2D();
  1864. - return cmpPathfinder->IsGoalReachable(pos.X, pos.Y, goal, m_PassClass);
  1865. + return cmpPathfinder->IsGoalReachable(pos.getX(), pos.getY(), goal, m_PassClass);
  1866. }
  1867.  
  1868.  
  1869. @@ -1635,8 +1635,8 @@
  1870. lines.back().m_Color = color;
  1871. SimRender::ConstructSquareOnGround(GetSimContext(), x, z, 1.0f, 1.0f, 0.0f, lines.back(), floating);
  1872. }
  1873. - float x = cmpPosition->GetPosition2D().X.ToFloat();
  1874. - float z = cmpPosition->GetPosition2D().Y.ToFloat();
  1875. + float x = cmpPosition->GetPosition2D().getX().ToFloat();
  1876. + float z = cmpPosition->GetPosition2D().getY().ToFloat();
  1877. waypointCoords.push_back(x);
  1878. waypointCoords.push_back(z);
  1879. lines.push_back(SOverlayLine());
  1880. Index: 0ad/source/simulation2/components/tests/test_RangeManager.h
  1881. ===================================================================
  1882. --- 0ad/source/simulation2/components/tests/test_RangeManager.h (revision 24769)
  1883. +++ 0ad/source/simulation2/components/tests/test_RangeManager.h (working copy)
  1884. @@ -60,7 +60,7 @@
  1885. virtual void SetActorFloating(bool UNUSED(flag)) { }
  1886. virtual void SetConstructionProgress(fixed UNUSED(progress)) { }
  1887. virtual CFixedVector3D GetPosition() const { return m_Pos; }
  1888. - virtual CFixedVector2D GetPosition2D() const { return CFixedVector2D(m_Pos.X, m_Pos.Z); }
  1889. + virtual CFixedVector2D GetPosition2D() const { return CFixedVector2D(m_Pos.getX(), m_Pos.getZ()); }
  1890. virtual CFixedVector3D GetPreviousPosition() const { return CFixedVector3D(); }
  1891. virtual CFixedVector2D GetPreviousPosition2D() const { return CFixedVector2D(); }
  1892. virtual fixed GetTurnRate() const { return fixed::Zero(); }
  1893. Index: 0ad/source/simulation2/helpers/Geometry.cpp
  1894. ===================================================================
  1895. --- 0ad/source/simulation2/helpers/Geometry.cpp (revision 24769)
  1896. +++ 0ad/source/simulation2/helpers/Geometry.cpp (working copy)
  1897. @@ -27,8 +27,8 @@
  1898. CFixedVector2D GetHalfBoundingBox(const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize)
  1899. {
  1900. return CFixedVector2D(
  1901. - u.X.Multiply(halfSize.X).Absolute() + v.X.Multiply(halfSize.Y).Absolute(),
  1902. - u.Y.Multiply(halfSize.X).Absolute() + v.Y.Multiply(halfSize.Y).Absolute()
  1903. + u.getX().Multiply(halfSize.getX()).Absolute() + v.getX().Multiply(halfSize.getY()).Absolute(),
  1904. + u.getY().Multiply(halfSize.getX()).Absolute() + v.getY().Multiply(halfSize.getY()).Absolute()
  1905. );
  1906. }
  1907.  
  1908. @@ -65,8 +65,8 @@
  1909. fixed du = point.Dot(u).Absolute();
  1910. fixed dv = point.Dot(v).Absolute();
  1911.  
  1912. - fixed hw = halfSize.X;
  1913. - fixed hh = halfSize.Y;
  1914. + fixed hw = halfSize.getX();
  1915. + fixed hh = halfSize.getY();
  1916.  
  1917. if (du < hw) // regions B, I, G
  1918. {
  1919. @@ -93,8 +93,8 @@
  1920. fixed du = point.Dot(u).Absolute();
  1921. fixed dv = point.Dot(v).Absolute();
  1922.  
  1923. - fixed hw = halfSize.X;
  1924. - fixed hh = halfSize.Y;
  1925. + fixed hw = halfSize.getX();
  1926. + fixed hh = halfSize.getY();
  1927.  
  1928. if (du < hw) // regions B, I, G
  1929. {
  1930. @@ -144,8 +144,8 @@
  1931. fixed du = point.Dot(u);
  1932. fixed dv = point.Dot(v);
  1933.  
  1934. - fixed hw = halfSize.X;
  1935. - fixed hh = halfSize.Y;
  1936. + fixed hw = halfSize.getX();
  1937. + fixed hh = halfSize.getY();
  1938.  
  1939. if (-hw < du && du < hw) // regions B, G; or regions D, E inside the square
  1940. {
  1941. @@ -196,10 +196,10 @@
  1942. * we depend on DistanceToSquare's countInsideAsZero. When no point is inside the other square,
  1943. * it is enough to check that two adjacent edges of one square does not collide with the other square.
  1944. */
  1945. - fixed hw1 = halfSize1.X;
  1946. - fixed hh1 = halfSize1.Y;
  1947. - fixed hw2 = halfSize2.X;
  1948. - fixed hh2 = halfSize2.Y;
  1949. + fixed hw1 = halfSize1.getX();
  1950. + fixed hh1 = halfSize1.getY();
  1951. + fixed hw2 = halfSize2.getX();
  1952. + fixed hh2 = halfSize2.getY();
  1953. if (TestRaySquare(relativePos + u1.Multiply(hw1) + v1.Multiply(hh1), relativePos - u1.Multiply(hw1) + v1.Multiply(hh1), u2, v2, halfSize2) ||
  1954. TestRaySquare(relativePos + u1.Multiply(hw1) + v1.Multiply(hh1), relativePos + u1.Multiply(hw1) - v1.Multiply(hh1), u2, v2, halfSize2))
  1955. return fixed::Zero();
  1956. @@ -220,8 +220,8 @@
  1957.  
  1958. fixed MaxDistanceToSquare(const CFixedVector2D& point, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize, bool countInsideAsZero)
  1959. {
  1960. - fixed hw = halfSize.X;
  1961. - fixed hh = halfSize.Y;
  1962. + fixed hw = halfSize.getX();
  1963. + fixed hh = halfSize.getY();
  1964.  
  1965. if (point.Dot(u).Absolute() < hw && point.Dot(v).Absolute() < hh && countInsideAsZero)
  1966. return fixed::Zero();
  1967. @@ -244,8 +244,8 @@
  1968. * The maximum distance from an edge of a square to the edge of another square
  1969. * equals the greatest distance from the any of the 16 corner corner distances.
  1970. */
  1971. - fixed hw1 = halfSize1.X;
  1972. - fixed hh1 = halfSize1.Y;
  1973. + fixed hw1 = halfSize1.getX();
  1974. + fixed hh1 = halfSize1.getY();
  1975.  
  1976. return std::max(std::max(
  1977. MaxDistanceToSquare(relativePos + u1.Multiply(hw1) + v1.Multiply(hh1), u2, v2, halfSize2, true),
  1978. @@ -269,8 +269,8 @@
  1979. * (Points on the edge are considered 'inside'.)
  1980. */
  1981.  
  1982. - fixed hw = halfSize.X;
  1983. - fixed hh = halfSize.Y;
  1984. + fixed hw = halfSize.getX();
  1985. + fixed hh = halfSize.getY();
  1986.  
  1987. fixed au = a.Dot(u);
  1988. fixed av = a.Dot(v);
  1989. @@ -305,16 +305,16 @@
  1990. // Exactly like TestRaySquare with u=(1,0), v=(0,1)
  1991. bool TestRayAASquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& halfSize)
  1992. {
  1993. - fixed hw = halfSize.X;
  1994. - fixed hh = halfSize.Y;
  1995. + fixed hw = halfSize.getX();
  1996. + fixed hh = halfSize.getY();
  1997.  
  1998. - if (-hw <= a.X && a.X <= hw && -hh <= a.Y && a.Y <= hh)
  1999. + if (-hw <= a.getX() && a.getX() <= hw && -hh <= a.getY() && a.getY() <= hh)
  2000. return false; // a is inside
  2001.  
  2002. - if (-hw <= b.X && b.X <= hw && -hh <= b.Y && b.Y <= hh) // TODO: isn't this subsumed by the next checks?
  2003. + if (-hw <= b.getX() && b.getX() <= hw && -hh <= b.getY() && b.getY() <= hh) // TODO: isn't this subsumed by the next checks?
  2004. return true; // a is outside, b is inside
  2005.  
  2006. - if ((a.X < -hw && b.X < -hw) || (a.X > hw && b.X > hw) || (a.Y < -hh && b.Y < -hh) || (a.Y > hh && b.Y > hh))
  2007. + if ((a.getX() < -hw && b.getX() < -hw) || (a.getX() > hw && b.getX() > hw) || (a.getY() < -hh && b.getY() < -hh) || (a.getY() > hh && b.getY() > hh))
  2008. return false; // ab is entirely above/below/side the square
  2009.  
  2010. CFixedVector2D abp = (b - a).Perpendicular();
  2011. @@ -338,8 +338,8 @@
  2012. */
  2013. static bool SquareSAT(const CFixedVector2D& a, const CFixedVector2D& axis, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize)
  2014. {
  2015. - fixed hw = halfSize.X;
  2016. - fixed hh = halfSize.Y;
  2017. + fixed hw = halfSize.getX();
  2018. + fixed hh = halfSize.getY();
  2019.  
  2020. CFixedVector2D p = axis.Perpendicular();
  2021. if (p.RelativeOrientation(u.Multiply(hw) + v.Multiply(hh) - a) <= 0)
  2022. @@ -360,10 +360,10 @@
  2023. {
  2024. // TODO: need to test this carefully
  2025.  
  2026. - CFixedVector2D corner0a = c0 + u0.Multiply(halfSize0.X) + v0.Multiply(halfSize0.Y);
  2027. - CFixedVector2D corner0b = c0 - u0.Multiply(halfSize0.X) - v0.Multiply(halfSize0.Y);
  2028. - CFixedVector2D corner1a = c1 + u1.Multiply(halfSize1.X) + v1.Multiply(halfSize1.Y);
  2029. - CFixedVector2D corner1b = c1 - u1.Multiply(halfSize1.X) - v1.Multiply(halfSize1.Y);
  2030. + CFixedVector2D corner0a = c0 + u0.Multiply(halfSize0.getX()) + v0.Multiply(halfSize0.getY());
  2031. + CFixedVector2D corner0b = c0 - u0.Multiply(halfSize0.getX()) - v0.Multiply(halfSize0.getY());
  2032. + CFixedVector2D corner1a = c1 + u1.Multiply(halfSize1.getX()) + v1.Multiply(halfSize1.getY());
  2033. + CFixedVector2D corner1b = c1 - u1.Multiply(halfSize1.getX()) - v1.Multiply(halfSize1.getY());
  2034.  
  2035. // Do a SAT test for each square vs each edge of the other square
  2036. if (!SquareSAT(corner0a - c1, -u0, u1, v1, halfSize1))
  2037. Index: 0ad/source/simulation2/helpers/Geometry.h
  2038. ===================================================================
  2039. --- 0ad/source/simulation2/helpers/Geometry.h (revision 24769)
  2040. +++ 0ad/source/simulation2/helpers/Geometry.h (working copy)
  2041. @@ -41,7 +41,7 @@
  2042. */
  2043. inline bool PointIsInSquare(const CFixedVector2D& point, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize)
  2044. {
  2045. - return point.Dot(u).Absolute() <= halfSize.X && point.Dot(v).Absolute() <= halfSize.Y;
  2046. + return point.Dot(u).Absolute() <= halfSize.getX() && point.Dot(v).Absolute() <= halfSize.getY();
  2047. }
  2048.  
  2049. /**
  2050. Index: 0ad/source/simulation2/helpers/HierarchicalPathfinder.cpp
  2051. ===================================================================
  2052. --- 0ad/source/simulation2/helpers/HierarchicalPathfinder.cpp (revision 24769)
  2053. +++ 0ad/source/simulation2/helpers/HierarchicalPathfinder.cpp (working copy)
  2054. @@ -601,8 +601,8 @@
  2055. chunks[region.cj * m_ChunksW + region.ci].RegionCenter(region.r, i1, j1);
  2056.  
  2057. CFixedVector2D a, b;
  2058. - Pathfinding::NavcellCenter(i0, j0, a.X, a.Y);
  2059. - Pathfinding::NavcellCenter(i1, j1, b.X, b.Y);
  2060. + Pathfinding::NavcellCenter(i0, j0, a.Xref(), a.Yref());
  2061. + Pathfinding::NavcellCenter(i1, j1, b.Xref(), b.Yref());
  2062.  
  2063. // Push the endpoints inwards a little to avoid overlaps
  2064. CFixedVector2D d = b - a;
  2065. @@ -611,10 +611,10 @@
  2066. b -= d;
  2067.  
  2068. std::vector<float> xz;
  2069. - xz.push_back(a.X.ToFloat());
  2070. - xz.push_back(a.Y.ToFloat());
  2071. - xz.push_back(b.X.ToFloat());
  2072. - xz.push_back(b.Y.ToFloat());
  2073. + xz.push_back(a.getX().ToFloat());
  2074. + xz.push_back(a.getY().ToFloat());
  2075. + xz.push_back(b.getX().ToFloat());
  2076. + xz.push_back(b.getY().ToFloat());
  2077.  
  2078. m_DebugOverlayLines.emplace_back();
  2079. m_DebugOverlayLines.back().m_Color = CColor(1.0, 1.0, 1.0, 1.0);
  2080. Index: 0ad/source/simulation2/helpers/LongPathfinder.cpp
  2081. ===================================================================
  2082. --- 0ad/source/simulation2/helpers/LongPathfinder.cpp (revision 24769)
  2083. +++ 0ad/source/simulation2/helpers/LongPathfinder.cpp (working copy)
  2084. @@ -922,7 +922,7 @@
  2085. if (offset.CompareLength(maxDist) > 0)
  2086. {
  2087. offset.Normalize(maxDist);
  2088. - path.m_Waypoints.emplace_back(Waypoint{ (start + offset).X, (start + offset).Y });
  2089. + path.m_Waypoints.emplace_back(Waypoint{ (start + offset).getX(), (start + offset).getY() });
  2090. }
  2091. }
  2092.  
  2093. @@ -944,7 +944,7 @@
  2094. // We are too far away from the previous waypoint, so create one in
  2095. // between and continue with the improvement of the path
  2096. prev = prev + (curr - prev) / 2;
  2097. - newWaypoints.emplace_back(Waypoint{ prev.X, prev.Y });
  2098. + newWaypoints.emplace_back(Waypoint{ prev.getX(), prev.getY() });
  2099. }
  2100.  
  2101. // If we're mostly straight, don't even bother.
  2102. @@ -951,7 +951,7 @@
  2103. if ((ahead - curr).Perpendicular().Dot(curr - prev).Absolute() <= fixed::Epsilon() * 100)
  2104. continue;
  2105.  
  2106. - if (!Pathfinding::CheckLineMovement(prev.X, prev.Y, ahead.X, ahead.Y, passClass, *m_Grid))
  2107. + if (!Pathfinding::CheckLineMovement(prev.getX(), prev.getY(), ahead.getX(), ahead.getY(), passClass, *m_Grid))
  2108. {
  2109. prev = CFixedVector2D(waypoints[k].x, waypoints[k].z);
  2110. newWaypoints.push_back(waypoints[k]);
  2111. Index: 0ad/source/simulation2/helpers/PathGoal.cpp
  2112. ===================================================================
  2113. --- 0ad/source/simulation2/helpers/PathGoal.cpp (revision 24769)
  2114. +++ 0ad/source/simulation2/helpers/PathGoal.cpp (working copy)
  2115. @@ -293,7 +293,7 @@
  2116.  
  2117. fixed PathGoal::DistanceToPoint(CFixedVector2D pos) const
  2118. {
  2119. - CFixedVector2D d(pos.X - x, pos.Y - z);
  2120. + CFixedVector2D d(pos.getX() - x, pos.getY() - z);
  2121.  
  2122. switch (type)
  2123. {
  2124. @@ -335,7 +335,7 @@
  2125.  
  2126. case CIRCLE:
  2127. {
  2128. - CFixedVector2D d(pos.X - x, pos.Y - z);
  2129. + CFixedVector2D d(pos.getX() - x, pos.getY() - z);
  2130. if (d.CompareLength(hw) <= 0)
  2131. return pos;
  2132.  
  2133. @@ -345,7 +345,7 @@
  2134.  
  2135. case INVERTED_CIRCLE:
  2136. {
  2137. - CFixedVector2D d(pos.X - x, pos.Y - z);
  2138. + CFixedVector2D d(pos.getX() - x, pos.getY() - z);
  2139. if (d.CompareLength(hw) >= 0)
  2140. return pos;
  2141.  
  2142. @@ -358,7 +358,7 @@
  2143. case SQUARE:
  2144. {
  2145. CFixedVector2D halfSize(hw, hh);
  2146. - CFixedVector2D d(pos.X - x, pos.Y - z);
  2147. + CFixedVector2D d(pos.getX() - x, pos.getY() - z);
  2148. return Geometry::PointIsInSquare(d, u, v, halfSize) ?
  2149. pos : g + Geometry::NearestPointOnSquare(d, u, v, halfSize);
  2150. }
  2151. @@ -366,7 +366,7 @@
  2152. case INVERTED_SQUARE:
  2153. {
  2154. CFixedVector2D halfSize(hw, hh);
  2155. - CFixedVector2D d(pos.X - x, pos.Y - z);
  2156. + CFixedVector2D d(pos.getX() - x, pos.getY() - z);
  2157. return !Geometry::PointIsInSquare(d, u, v, halfSize) ?
  2158. pos : g + Geometry::NearestPointOnSquare(d, u, v, halfSize);
  2159. }
  2160. Index: 0ad/source/simulation2/helpers/Rasterize.cpp
  2161. ===================================================================
  2162. --- 0ad/source/simulation2/helpers/Rasterize.cpp (revision 24769)
  2163. +++ 0ad/source/simulation2/helpers/Rasterize.cpp (working copy)
  2164. @@ -48,10 +48,10 @@
  2165. CFixedVector2D shapeHalfSize(CFixedVector2D(shape.hw, shape.hh));
  2166. CFixedVector2D halfSize(shape.hw + rasterClearance, shape.hh + rasterClearance);
  2167. CFixedVector2D halfBound = Geometry::GetHalfBoundingBox(shape.u, shape.v, halfSize);
  2168. - i16 i0 = ((shape.x - halfBound.X) / cellSize).ToInt_RoundToNegInfinity();
  2169. - i16 j0 = ((shape.z - halfBound.Y) / cellSize).ToInt_RoundToNegInfinity();
  2170. - i16 i1 = ((shape.x + halfBound.X) / cellSize).ToInt_RoundToInfinity();
  2171. - i16 j1 = ((shape.z + halfBound.Y) / cellSize).ToInt_RoundToInfinity();
  2172. + i16 i0 = ((shape.x - halfBound.getX()) / cellSize).ToInt_RoundToNegInfinity();
  2173. + i16 j0 = ((shape.z - halfBound.getY()) / cellSize).ToInt_RoundToNegInfinity();
  2174. + i16 i1 = ((shape.x + halfBound.getX()) / cellSize).ToInt_RoundToInfinity();
  2175. + i16 j1 = ((shape.z + halfBound.getY()) / cellSize).ToInt_RoundToInfinity();
  2176.  
  2177. if (j1 <= j0)
  2178. return; // empty bounds - this shouldn't happen
  2179. Index: 0ad/source/simulation2/helpers/Render.cpp
  2180. ===================================================================
  2181. --- 0ad/source/simulation2/helpers/Render.cpp (revision 24769)
  2182. +++ 0ad/source/simulation2/helpers/Render.cpp (working copy)
  2183. @@ -603,8 +603,8 @@
  2184. void SimRender::ConstructTexturedLineBox(SOverlayTexturedLine& overlay, const CVector2D& origin,
  2185. const CFixedVector3D& rotation, const float sizeX, const float sizeZ)
  2186. {
  2187. - float s = sinf(-rotation.Y.ToFloat());
  2188. - float c = cosf(-rotation.Y.ToFloat());
  2189. + float s = sinf(-rotation.getY().ToFloat());
  2190. + float c = cosf(-rotation.getY().ToFloat());
  2191.  
  2192. CVector2D unitX(c, s);
  2193. CVector2D unitZ(-s, c);
  2194. Index: 0ad/source/simulation2/helpers/Spatial.h
  2195. ===================================================================
  2196. --- 0ad/source/simulation2/helpers/Spatial.h (revision 24769)
  2197. +++ 0ad/source/simulation2/helpers/Spatial.h (working copy)
  2198. @@ -156,12 +156,12 @@
  2199. */
  2200. void Add(uint32_t item, CFixedVector2D toMin, CFixedVector2D toMax)
  2201. {
  2202. - ENSURE(toMin.X <= toMax.X && toMin.Y <= toMax.Y);
  2203. + ENSURE(toMin.getX() <= toMax.getX() && toMin.getY() <= toMax.getY());
  2204.  
  2205. - u32 i0 = GetI0(toMin.X);
  2206. - u32 j0 = GetJ0(toMin.Y);
  2207. - u32 i1 = GetI1(toMax.X);
  2208. - u32 j1 = GetJ1(toMax.Y);
  2209. + u32 i0 = GetI0(toMin.getX());
  2210. + u32 j0 = GetJ0(toMin.getY());
  2211. + u32 i1 = GetI1(toMax.getX());
  2212. + u32 j1 = GetJ1(toMax.getY());
  2213. for (u32 j = j0; j <= j1; ++j)
  2214. {
  2215. for (u32 i = i0; i <= i1; ++i)
  2216. @@ -178,12 +178,12 @@
  2217. */
  2218. void Remove(uint32_t item, CFixedVector2D fromMin, CFixedVector2D fromMax)
  2219. {
  2220. - ENSURE(fromMin.X <= fromMax.X && fromMin.Y <= fromMax.Y);
  2221. + ENSURE(fromMin.getX() <= fromMax.getX() && fromMin.getY() <= fromMax.getY());
  2222.  
  2223. - u32 i0 = GetI0(fromMin.X);
  2224. - u32 j0 = GetJ0(fromMin.Y);
  2225. - u32 i1 = GetI1(fromMax.X);
  2226. - u32 j1 = GetJ1(fromMax.Y);
  2227. + u32 i0 = GetI0(fromMin.getX());
  2228. + u32 j0 = GetJ0(fromMin.getY());
  2229. + u32 i1 = GetI1(fromMax.getX());
  2230. + u32 j1 = GetJ1(fromMax.getY());
  2231. for (u32 j = j0; j <= j1; ++j)
  2232. {
  2233. for (u32 i = i0; i <= i1; ++i)
  2234. @@ -247,12 +247,12 @@
  2235. void GetInRange(std::vector<uint32_t>& out, CFixedVector2D posMin, CFixedVector2D posMax) const
  2236. {
  2237. out.clear();
  2238. - ENSURE(posMin.X <= posMax.X && posMin.Y <= posMax.Y);
  2239. + ENSURE(posMin.getX() <= posMax.getX() && posMin.getY() <= posMax.getY());
  2240.  
  2241. - u32 i0 = GetI0(posMin.X);
  2242. - u32 j0 = GetJ0(posMin.Y);
  2243. - u32 i1 = GetI1(posMax.X);
  2244. - u32 j1 = GetJ1(posMax.Y);
  2245. + u32 i0 = GetI0(posMin.getX());
  2246. + u32 j0 = GetJ0(posMin.getY());
  2247. + u32 i1 = GetI1(posMax.getX());
  2248. + u32 j1 = GetJ1(posMax.getY());
  2249. for (u32 j = j0; j <= j1; ++j)
  2250. {
  2251. for (u32 i = i0; i <= i1; ++i)
  2252. @@ -304,12 +304,12 @@
  2253.  
  2254. uint32_t GetIndex0(CFixedVector2D pos) const
  2255. {
  2256. - return GetI0(pos.X) + GetJ0(pos.Y)*m_DivisionsW;
  2257. + return GetI0(pos.getX()) + GetJ0(pos.getY())*m_DivisionsW;
  2258. }
  2259.  
  2260. uint32_t GetIndex1(CFixedVector2D pos) const
  2261. {
  2262. - return GetI1(pos.X) + GetJ1(pos.Y)*m_DivisionsW;
  2263. + return GetI1(pos.getX()) + GetJ1(pos.getY())*m_DivisionsW;
  2264. }
  2265. };
  2266.  
  2267. @@ -379,7 +379,7 @@
  2268.  
  2269. inline size_t SubdivisionIdx(CFixedVector2D position) const
  2270. {
  2271. - return Index(position.X) + Index(position.Y)*m_ArrayWidth;
  2272. + return Index(position.getX()) + Index(position.getY())*m_ArrayWidth;
  2273. }
  2274.  
  2275. /**
  2276. @@ -516,10 +516,10 @@
  2277. */
  2278. void GetInRange(std::vector<entity_id_t>& out, CFixedVector2D posMin, CFixedVector2D posMax) const
  2279. {
  2280. - size_t minX = Index(posMin.X);
  2281. - size_t minY = Index(posMin.Y);
  2282. - size_t maxX = Index(posMax.X) + 1;
  2283. - size_t maxY = Index(posMax.Y) + 1;
  2284. + size_t minX = Index(posMin.getX());
  2285. + size_t minY = Index(posMin.getY());
  2286. + size_t maxX = Index(posMax.getX()) + 1;
  2287. + size_t maxY = Index(posMax.getY()) + 1;
  2288.  
  2289. // Now expand the subdivisions by one so we make sure we've got all elements potentially in range.
  2290. // Also make sure min >= 0 and max <= width
  2291. Index: 0ad/source/simulation2/helpers/VertexPathfinder.cpp
  2292. ===================================================================
  2293. --- 0ad/source/simulation2/helpers/VertexPathfinder.cpp (revision 24769)
  2294. +++ 0ad/source/simulation2/helpers/VertexPathfinder.cpp (working copy)
  2295. @@ -139,7 +139,7 @@
  2296.  
  2297. inline static bool CheckVisibilityLeft(const CFixedVector2D& a, const CFixedVector2D& b, const std::vector<EdgeAA>& edges)
  2298. {
  2299. - if (a.X >= b.X)
  2300. + if (a.getX() >= b.getX())
  2301. return true;
  2302.  
  2303. CFixedVector2D abn = (b - a).Perpendicular();
  2304. @@ -146,15 +146,15 @@
  2305.  
  2306. for (size_t i = 0; i < edges.size(); ++i)
  2307. {
  2308. - if (b.X < edges[i].p0.X)
  2309. + if (b.getX() < edges[i].p0.getX())
  2310. continue;
  2311.  
  2312. - CFixedVector2D p0 (edges[i].p0.X, edges[i].c1);
  2313. + CFixedVector2D p0 (edges[i].p0.getX(), edges[i].c1);
  2314. fixed s = (p0 - a).Dot(abn);
  2315. if (s > fixed::Zero())
  2316. continue;
  2317.  
  2318. - CFixedVector2D p1 (edges[i].p0.X, edges[i].p0.Y);
  2319. + CFixedVector2D p1 (edges[i].p0.getX(), edges[i].p0.getY());
  2320. fixed t = (p1 - a).Dot(abn);
  2321. if (t < fixed::Zero())
  2322. continue;
  2323. @@ -167,7 +167,7 @@
  2324.  
  2325. inline static bool CheckVisibilityRight(const CFixedVector2D& a, const CFixedVector2D& b, const std::vector<EdgeAA>& edges)
  2326. {
  2327. - if (a.X <= b.X)
  2328. + if (a.getX() <= b.getX())
  2329. return true;
  2330.  
  2331. CFixedVector2D abn = (b - a).Perpendicular();
  2332. @@ -174,15 +174,15 @@
  2333.  
  2334. for (size_t i = 0; i < edges.size(); ++i)
  2335. {
  2336. - if (b.X > edges[i].p0.X)
  2337. + if (b.getX() > edges[i].p0.getX())
  2338. continue;
  2339.  
  2340. - CFixedVector2D p0 (edges[i].p0.X, edges[i].c1);
  2341. + CFixedVector2D p0 (edges[i].p0.getX(), edges[i].c1);
  2342. fixed s = (p0 - a).Dot(abn);
  2343. if (s > fixed::Zero())
  2344. continue;
  2345.  
  2346. - CFixedVector2D p1 (edges[i].p0.X, edges[i].p0.Y);
  2347. + CFixedVector2D p1 (edges[i].p0.getX(), edges[i].p0.getY());
  2348. fixed t = (p1 - a).Dot(abn);
  2349. if (t < fixed::Zero())
  2350. continue;
  2351. @@ -195,7 +195,7 @@
  2352.  
  2353. inline static bool CheckVisibilityBottom(const CFixedVector2D& a, const CFixedVector2D& b, const std::vector<EdgeAA>& edges)
  2354. {
  2355. - if (a.Y >= b.Y)
  2356. + if (a.getY() >= b.getY())
  2357. return true;
  2358.  
  2359. CFixedVector2D abn = (b - a).Perpendicular();
  2360. @@ -202,15 +202,15 @@
  2361.  
  2362. for (size_t i = 0; i < edges.size(); ++i)
  2363. {
  2364. - if (b.Y < edges[i].p0.Y)
  2365. + if (b.getY() < edges[i].p0.getY())
  2366. continue;
  2367.  
  2368. - CFixedVector2D p0 (edges[i].p0.X, edges[i].p0.Y);
  2369. + CFixedVector2D p0 (edges[i].p0.getX(), edges[i].p0.getY());
  2370. fixed s = (p0 - a).Dot(abn);
  2371. if (s > fixed::Zero())
  2372. continue;
  2373.  
  2374. - CFixedVector2D p1 (edges[i].c1, edges[i].p0.Y);
  2375. + CFixedVector2D p1 (edges[i].c1, edges[i].p0.getY());
  2376. fixed t = (p1 - a).Dot(abn);
  2377. if (t < fixed::Zero())
  2378. continue;
  2379. @@ -223,7 +223,7 @@
  2380.  
  2381. inline static bool CheckVisibilityTop(const CFixedVector2D& a, const CFixedVector2D& b, const std::vector<EdgeAA>& edges)
  2382. {
  2383. - if (a.Y <= b.Y)
  2384. + if (a.getY() <= b.getY())
  2385. return true;
  2386.  
  2387. CFixedVector2D abn = (b - a).Perpendicular();
  2388. @@ -230,15 +230,15 @@
  2389.  
  2390. for (size_t i = 0; i < edges.size(); ++i)
  2391. {
  2392. - if (b.Y > edges[i].p0.Y)
  2393. + if (b.getY() > edges[i].p0.getY())
  2394. continue;
  2395.  
  2396. - CFixedVector2D p0 (edges[i].p0.X, edges[i].p0.Y);
  2397. + CFixedVector2D p0 (edges[i].p0.getX(), edges[i].p0.getY());
  2398. fixed s = (p0 - a).Dot(abn);
  2399. if (s > fixed::Zero())
  2400. continue;
  2401.  
  2402. - CFixedVector2D p1 (edges[i].c1, edges[i].p0.Y);
  2403. + CFixedVector2D p1 (edges[i].c1, edges[i].p0.getY());
  2404. fixed t = (p1 - a).Dot(abn);
  2405. if (t < fixed::Zero())
  2406. continue;
  2407. @@ -449,46 +449,46 @@
  2408.  
  2409. for (const Square& square : squares)
  2410. {
  2411. - if (a.X <= square.p0.X)
  2412. - edgesLeft.emplace_back(EdgeAA{ square.p0, square.p1.Y });
  2413. - if (a.X >= square.p1.X)
  2414. - edgesRight.emplace_back(EdgeAA{ square.p1, square.p0.Y });
  2415. - if (a.Y <= square.p0.Y)
  2416. - edgesBottom.emplace_back(EdgeAA{ square.p0, square.p1.X });
  2417. - if (a.Y >= square.p1.Y)
  2418. - edgesTop.emplace_back(EdgeAA{ square.p1, square.p0.X });
  2419. + if (a.getX() <= square.p0.getX())
  2420. + edgesLeft.emplace_back(EdgeAA{ square.p0, square.p1.getY() });
  2421. + if (a.getX() >= square.p1.getX())
  2422. + edgesRight.emplace_back(EdgeAA{ square.p1, square.p0.getY() });
  2423. + if (a.getY() <= square.p0.getY())
  2424. + edgesBottom.emplace_back(EdgeAA{ square.p0, square.p1.getX() });
  2425. + if (a.getY() >= square.p1.getY())
  2426. + edgesTop.emplace_back(EdgeAA{ square.p1, square.p0.getX() });
  2427. }
  2428.  
  2429. for (const Edge& edge : edges)
  2430. {
  2431. - if (edge.p0.X == edge.p1.X)
  2432. + if (edge.p0.getX() == edge.p1.getX())
  2433. {
  2434. - if (edge.p1.Y < edge.p0.Y)
  2435. + if (edge.p1.getY() < edge.p0.getY())
  2436. {
  2437. - if (!(a.X <= edge.p0.X))
  2438. + if (!(a.getX() <= edge.p0.getX()))
  2439. continue;
  2440. - edgesLeft.emplace_back(EdgeAA{ edge.p1, edge.p0.Y });
  2441. + edgesLeft.emplace_back(EdgeAA{ edge.p1, edge.p0.getY() });
  2442. }
  2443. else
  2444. {
  2445. - if (!(a.X >= edge.p0.X))
  2446. + if (!(a.getX() >= edge.p0.getX()))
  2447. continue;
  2448. - edgesRight.emplace_back(EdgeAA{ edge.p1, edge.p0.Y });
  2449. + edgesRight.emplace_back(EdgeAA{ edge.p1, edge.p0.getY() });
  2450. }
  2451. }
  2452. - else if (edge.p0.Y == edge.p1.Y)
  2453. + else if (edge.p0.getY() == edge.p1.getY())
  2454. {
  2455. - if (edge.p0.X < edge.p1.X)
  2456. + if (edge.p0.getX() < edge.p1.getX())
  2457. {
  2458. - if (!(a.Y <= edge.p0.Y))
  2459. + if (!(a.getY() <= edge.p0.getY()))
  2460. continue;
  2461. - edgesBottom.emplace_back(EdgeAA{ edge.p0, edge.p1.X });
  2462. + edgesBottom.emplace_back(EdgeAA{ edge.p0, edge.p1.getX() });
  2463. }
  2464. else
  2465. {
  2466. - if (!(a.Y >= edge.p0.Y))
  2467. + if (!(a.getY() >= edge.p0.getY()))
  2468. continue;
  2469. - edgesTop.emplace_back(EdgeAA{ edge.p0, edge.p1.X });
  2470. + edgesTop.emplace_back(EdgeAA{ edge.p0, edge.p1.getX() });
  2471. }
  2472. }
  2473. else
  2474. @@ -537,10 +537,10 @@
  2475. {
  2476. fixed toGoalLength = toGoal.Length();
  2477. fixed inv = fixed::FromInt(1) / toGoalLength;
  2478. - rangeXMin += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).X;
  2479. - rangeXMax += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).X;
  2480. - rangeZMin += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).Y;
  2481. - rangeZMax += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).Y;
  2482. + rangeXMin += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).getX();
  2483. + rangeXMax += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).getX();
  2484. + rangeZMin += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).getY();
  2485. + rangeZMax += (toGoal.Multiply(std::min(toGoalLength / 2, request.range * 3 / 5)).Multiply(inv)).getY();
  2486. }
  2487.  
  2488. // Add domain edges
  2489. @@ -596,7 +596,7 @@
  2490. CFixedVector2D hd1(squares[i].hw + pathfindClearance + EDGE_EXPAND_DELTA, -(squares[i].hh + pathfindClearance + EDGE_EXPAND_DELTA));
  2491.  
  2492. // Check whether this is an axis-aligned square
  2493. - bool aa = (u.X == fixed::FromInt(1) && u.Y == fixed::Zero() && v.X == fixed::Zero() && v.Y == fixed::FromInt(1));
  2494. + bool aa = (u.getX() == fixed::FromInt(1) && u.getY() == fixed::Zero() && v.getX() == fixed::Zero() && v.getY() == fixed::FromInt(1));
  2495.  
  2496. Vertex vert;
  2497. vert.status = Vertex::UNEXPLORED;
  2498. @@ -603,44 +603,44 @@
  2499. vert.quadInward = QUADRANT_NONE;
  2500. vert.quadOutward = QUADRANT_ALL;
  2501.  
  2502. - vert.p.X = center.X - hd0.Dot(u);
  2503. - vert.p.Y = center.Y + hd0.Dot(v);
  2504. + vert.p.Xref() = center.getX() - hd0.Dot(u);
  2505. + vert.p.Yref() = center.getY() + hd0.Dot(v);
  2506. if (aa)
  2507. {
  2508. vert.quadInward = QUADRANT_BR;
  2509. vert.quadOutward = (~vert.quadInward) & 0xF;
  2510. }
  2511. - if (vert.p.X >= rangeXMin && vert.p.Y >= rangeZMin && vert.p.X <= rangeXMax && vert.p.Y <= rangeZMax)
  2512. + if (vert.p.getX() >= rangeXMin && vert.p.getY() >= rangeZMin && vert.p.getX() <= rangeXMax && vert.p.getY() <= rangeZMax)
  2513. m_Vertexes.push_back(vert);
  2514.  
  2515. - vert.p.X = center.X - hd1.Dot(u);
  2516. - vert.p.Y = center.Y + hd1.Dot(v);
  2517. + vert.p.Xref() = center.getX() - hd1.Dot(u);
  2518. + vert.p.Yref() = center.getY() + hd1.Dot(v);
  2519. if (aa)
  2520. {
  2521. vert.quadInward = QUADRANT_TR;
  2522. vert.quadOutward = (~vert.quadInward) & 0xF;
  2523. }
  2524. - if (vert.p.X >= rangeXMin && vert.p.Y >= rangeZMin && vert.p.X <= rangeXMax && vert.p.Y <= rangeZMax)
  2525. + if (vert.p.getX() >= rangeXMin && vert.p.getY() >= rangeZMin && vert.p.getX() <= rangeXMax && vert.p.getY() <= rangeZMax)
  2526. m_Vertexes.push_back(vert);
  2527.  
  2528. - vert.p.X = center.X + hd0.Dot(u);
  2529. - vert.p.Y = center.Y - hd0.Dot(v);
  2530. + vert.p.Xref() = center.getX() + hd0.Dot(u);
  2531. + vert.p.Yref() = center.getY() - hd0.Dot(v);
  2532. if (aa)
  2533. {
  2534. vert.quadInward = QUADRANT_TL;
  2535. vert.quadOutward = (~vert.quadInward) & 0xF;
  2536. }
  2537. - if (vert.p.X >= rangeXMin && vert.p.Y >= rangeZMin && vert.p.X <= rangeXMax && vert.p.Y <= rangeZMax)
  2538. + if (vert.p.getX() >= rangeXMin && vert.p.getY() >= rangeZMin && vert.p.getX() <= rangeXMax && vert.p.getY() <= rangeZMax)
  2539. m_Vertexes.push_back(vert);
  2540.  
  2541. - vert.p.X = center.X + hd1.Dot(u);
  2542. - vert.p.Y = center.Y - hd1.Dot(v);
  2543. + vert.p.Xref() = center.getX() + hd1.Dot(u);
  2544. + vert.p.Yref() = center.getY() - hd1.Dot(v);
  2545. if (aa)
  2546. {
  2547. vert.quadInward = QUADRANT_BL;
  2548. vert.quadOutward = (~vert.quadInward) & 0xF;
  2549. }
  2550. - if (vert.p.X >= rangeXMin && vert.p.Y >= rangeZMin && vert.p.X <= rangeXMax && vert.p.Y <= rangeZMax)
  2551. + if (vert.p.getX() >= rangeXMin && vert.p.getY() >= rangeZMin && vert.p.getX() <= rangeXMax && vert.p.getY() <= rangeZMax)
  2552. m_Vertexes.push_back(vert);
  2553.  
  2554. // Add the edges:
  2555. @@ -648,10 +648,10 @@
  2556. CFixedVector2D h0(squares[i].hw + pathfindClearance, squares[i].hh + pathfindClearance);
  2557. CFixedVector2D h1(squares[i].hw + pathfindClearance, -(squares[i].hh + pathfindClearance));
  2558.  
  2559. - CFixedVector2D ev0(center.X - h0.Dot(u), center.Y + h0.Dot(v));
  2560. - CFixedVector2D ev1(center.X - h1.Dot(u), center.Y + h1.Dot(v));
  2561. - CFixedVector2D ev2(center.X + h0.Dot(u), center.Y - h0.Dot(v));
  2562. - CFixedVector2D ev3(center.X + h1.Dot(u), center.Y - h1.Dot(v));
  2563. + CFixedVector2D ev0(center.getX() - h0.Dot(u), center.getY() + h0.Dot(v));
  2564. + CFixedVector2D ev1(center.getX() - h1.Dot(u), center.getY() + h1.Dot(v));
  2565. + CFixedVector2D ev2(center.getX() + h0.Dot(u), center.getY() - h0.Dot(v));
  2566. + CFixedVector2D ev3(center.getX() + h1.Dot(u), center.getY() - h1.Dot(v));
  2567. if (aa)
  2568. m_EdgeSquares.emplace_back(Square{ ev1, ev3 });
  2569. else
  2570. @@ -676,19 +676,19 @@
  2571. for (size_t i = 2; i < m_EdgeSquares.size(); ++i)
  2572. {
  2573. // If the start point is inside the square, ignore it
  2574. - if (start.p.X >= m_EdgeSquares[i].p0.X &&
  2575. - start.p.Y >= m_EdgeSquares[i].p0.Y &&
  2576. - start.p.X <= m_EdgeSquares[i].p1.X &&
  2577. - start.p.Y <= m_EdgeSquares[i].p1.Y)
  2578. + if (start.p.getX() >= m_EdgeSquares[i].p0.getX() &&
  2579. + start.p.getY() >= m_EdgeSquares[i].p0.getY() &&
  2580. + start.p.getX() <= m_EdgeSquares[i].p1.getX() &&
  2581. + start.p.getY() <= m_EdgeSquares[i].p1.getY())
  2582. continue;
  2583.  
  2584. // Remove every non-start/goal vertex that is inside an edgeSquare;
  2585. // since remove() would be inefficient, just mark it as closed instead.
  2586. for (size_t j = 2; j < m_Vertexes.size(); ++j)
  2587. - if (m_Vertexes[j].p.X >= m_EdgeSquares[i].p0.X &&
  2588. - m_Vertexes[j].p.Y >= m_EdgeSquares[i].p0.Y &&
  2589. - m_Vertexes[j].p.X <= m_EdgeSquares[i].p1.X &&
  2590. - m_Vertexes[j].p.Y <= m_EdgeSquares[i].p1.Y)
  2591. + if (m_Vertexes[j].p.getX() >= m_EdgeSquares[i].p0.getX() &&
  2592. + m_Vertexes[j].p.getY() >= m_EdgeSquares[i].p0.getY() &&
  2593. + m_Vertexes[j].p.getX() <= m_EdgeSquares[i].p1.getX() &&
  2594. + m_Vertexes[j].p.getY() <= m_EdgeSquares[i].p1.getY())
  2595. m_Vertexes[j].status = Vertex::CLOSED;
  2596. }
  2597.  
  2598. @@ -756,8 +756,8 @@
  2599. // To prevent integer overflows later on, we need to ensure all vertexes are
  2600. // 'close' to the source. The goal might be far away (not a good idea but
  2601. // sometimes it happens), so clamp it to the current search range
  2602. - npos.X = Clamp(npos.X, rangeXMin + EDGE_EXPAND_DELTA, rangeXMax - EDGE_EXPAND_DELTA);
  2603. - npos.Y = Clamp(npos.Y, rangeZMin + EDGE_EXPAND_DELTA, rangeZMax - EDGE_EXPAND_DELTA);
  2604. + npos.Xref() = Clamp(npos.getX(), rangeXMin + EDGE_EXPAND_DELTA, rangeXMax - EDGE_EXPAND_DELTA);
  2605. + npos.Yref() = Clamp(npos.getY(), rangeZMin + EDGE_EXPAND_DELTA, rangeZMax - EDGE_EXPAND_DELTA);
  2606. }
  2607. else
  2608. npos = m_Vertexes[n].p;
  2609. @@ -764,10 +764,10 @@
  2610.  
  2611. // Work out which quadrant(s) we're approaching the new vertex from
  2612. u8 quad = 0;
  2613. - if (m_Vertexes[curr.id].p.X <= npos.X && m_Vertexes[curr.id].p.Y <= npos.Y) quad |= QUADRANT_BL;
  2614. - if (m_Vertexes[curr.id].p.X >= npos.X && m_Vertexes[curr.id].p.Y >= npos.Y) quad |= QUADRANT_TR;
  2615. - if (m_Vertexes[curr.id].p.X <= npos.X && m_Vertexes[curr.id].p.Y >= npos.Y) quad |= QUADRANT_TL;
  2616. - if (m_Vertexes[curr.id].p.X >= npos.X && m_Vertexes[curr.id].p.Y <= npos.Y) quad |= QUADRANT_BR;
  2617. + if (m_Vertexes[curr.id].p.getX() <= npos.getX() && m_Vertexes[curr.id].p.getY() <= npos.getY()) quad |= QUADRANT_BL;
  2618. + if (m_Vertexes[curr.id].p.getX() >= npos.getX() && m_Vertexes[curr.id].p.getY() >= npos.getY()) quad |= QUADRANT_TR;
  2619. + if (m_Vertexes[curr.id].p.getX() <= npos.getX() && m_Vertexes[curr.id].p.getY() >= npos.getY()) quad |= QUADRANT_TL;
  2620. + if (m_Vertexes[curr.id].p.getX() >= npos.getX() && m_Vertexes[curr.id].p.getY() <= npos.getY()) quad |= QUADRANT_BR;
  2621.  
  2622. // Check that the new vertex is in the right quadrant for the old vertex
  2623. if (!(m_Vertexes[curr.id].quadOutward & quad) && curr.id != START_VERTEX_ID)
  2624. @@ -838,7 +838,7 @@
  2625. // Reconstruct the path (in reverse)
  2626. WaypointPath path;
  2627. for (u16 id = idBest; id != START_VERTEX_ID; id = m_Vertexes[id].pred)
  2628. - path.m_Waypoints.emplace_back(Waypoint{ m_Vertexes[id].p.X, m_Vertexes[id].p.Y });
  2629. + path.m_Waypoints.emplace_back(Waypoint{ m_Vertexes[id].p.getX(), m_Vertexes[id].p.getY() });
  2630.  
  2631.  
  2632. m_Edges.clear();
  2633. @@ -880,7 +880,7 @@
  2634. case PathGoal::SQUARE:
  2635. case PathGoal::INVERTED_SQUARE:
  2636. {
  2637. - float a = atan2f(goal.v.X.ToFloat(), goal.v.Y.ToFloat());
  2638. + float a = atan2f(goal.v.getX().ToFloat(), goal.v.getY().ToFloat());
  2639. SimRender::ConstructSquareOnGround(simContext, goal.x.ToFloat(), goal.z.ToFloat(), goal.hw.ToFloat()*2, goal.hh.ToFloat()*2, a, m_DebugOverlayShortPathLines.back(), true);
  2640. break;
  2641. }
  2642. @@ -892,7 +892,7 @@
  2643. if (!m_DebugOverlay)
  2644. return;
  2645.  
  2646. -#define PUSH_POINT(p) STMT(xz.push_back(p.X.ToFloat()); xz.push_back(p.Y.ToFloat()))
  2647. +#define PUSH_POINT(p) STMT(xz.push_back(p.getX().ToFloat()); xz.push_back(p.getY().ToFloat()))
  2648. // Render the vertexes as little Pac-Man shapes to indicate quadrant direction
  2649. for (size_t i = 0; i < vertexes.size(); ++i)
  2650. {
  2651. @@ -899,8 +899,8 @@
  2652. m_DebugOverlayShortPathLines.emplace_back();
  2653. m_DebugOverlayShortPathLines.back().m_Color = CColor(1, 1, 0, 1);
  2654.  
  2655. - float x = vertexes[i].p.X.ToFloat();
  2656. - float z = vertexes[i].p.Y.ToFloat();
  2657. + float x = vertexes[i].p.getX().ToFloat();
  2658. + float z = vertexes[i].p.getY().ToFloat();
  2659.  
  2660. float a0 = 0, a1 = 0;
  2661. // Get arc start/end angles depending on quadrant (if any)
  2662. @@ -948,16 +948,16 @@
  2663. m_DebugOverlayShortPathLines.back().m_Color = CColor(0, 1, 1, 1);
  2664. std::vector<float> xz;
  2665. Square s = edgeSquares[i];
  2666. - xz.push_back(s.p0.X.ToFloat());
  2667. - xz.push_back(s.p0.Y.ToFloat());
  2668. - xz.push_back(s.p0.X.ToFloat());
  2669. - xz.push_back(s.p1.Y.ToFloat());
  2670. - xz.push_back(s.p1.X.ToFloat());
  2671. - xz.push_back(s.p1.Y.ToFloat());
  2672. - xz.push_back(s.p1.X.ToFloat());
  2673. - xz.push_back(s.p0.Y.ToFloat());
  2674. - xz.push_back(s.p0.X.ToFloat());
  2675. - xz.push_back(s.p0.Y.ToFloat());
  2676. + xz.push_back(s.p0.getX().ToFloat());
  2677. + xz.push_back(s.p0.getY().ToFloat());
  2678. + xz.push_back(s.p0.getX().ToFloat());
  2679. + xz.push_back(s.p1.getY().ToFloat());
  2680. + xz.push_back(s.p1.getX().ToFloat());
  2681. + xz.push_back(s.p1.getY().ToFloat());
  2682. + xz.push_back(s.p1.getX().ToFloat());
  2683. + xz.push_back(s.p0.getY().ToFloat());
  2684. + xz.push_back(s.p0.getX().ToFloat());
  2685. + xz.push_back(s.p0.getY().ToFloat());
  2686. SimRender::ConstructLineOnGround(simContext, xz, m_DebugOverlayShortPathLines.back(), true);
  2687. }
  2688. }
  2689. Index: 0ad/source/simulation2/scripting/EngineScriptConversions.cpp
  2690. ===================================================================
  2691. --- 0ad/source/simulation2/scripting/EngineScriptConversions.cpp (revision 24769)
  2692. +++ 0ad/source/simulation2/scripting/EngineScriptConversions.cpp (working copy)
  2693. @@ -145,13 +145,16 @@
  2694. JS::RootedValue p(rq.cx);
  2695.  
  2696. if (!JS_GetProperty(rq.cx, obj, "x", &p)) return false; // TODO: report type errors
  2697. - if (!FromJSVal(rq, p, out.X)) return false;
  2698. + //auto x = out.getX();
  2699. + if (!FromJSVal(rq, p, out.Xref())) return false;
  2700.  
  2701. if (!JS_GetProperty(rq.cx, obj, "y", &p)) return false;
  2702. - if (!FromJSVal(rq, p, out.Y)) return false;
  2703. + //auto y = out.getY();
  2704. + if (!FromJSVal(rq, p, out.Yref())) return false;
  2705.  
  2706. if (!JS_GetProperty(rq.cx, obj, "z", &p)) return false;
  2707. - if (!FromJSVal(rq, p, out.Z)) return false;
  2708. + //auto z = out.getZ();
  2709. + if (!FromJSVal(rq, p, out.Zref())) return false;
  2710.  
  2711. return true;
  2712. }
  2713. @@ -164,9 +167,9 @@
  2714. FAIL_VOID("Failed to get Vector3D constructor");
  2715.  
  2716. JS::RootedValueArray<3> args(rq.cx);
  2717. - args[0].setNumber(val.X.ToDouble());
  2718. - args[1].setNumber(val.Y.ToDouble());
  2719. - args[2].setNumber(val.Z.ToDouble());
  2720. + args[0].setNumber(val.getX().ToDouble());
  2721. + args[1].setNumber(val.getY().ToDouble());
  2722. + args[2].setNumber(val.getZ().ToDouble());
  2723.  
  2724. JS::RootedObject objVec(rq.cx);
  2725. if (!JS::Construct(rq.cx, valueVector3D, args, &objVec))
  2726. @@ -184,10 +187,10 @@
  2727. JS::RootedValue p(rq.cx);
  2728.  
  2729. if (!JS_GetProperty(rq.cx, obj, "x", &p)) return false; // TODO: report type errors
  2730. - if (!FromJSVal(rq, p, out.X)) return false;
  2731. + if (!FromJSVal(rq, p, out.Xref())) return false;
  2732.  
  2733. if (!JS_GetProperty(rq.cx, obj, "y", &p)) return false;
  2734. - if (!FromJSVal(rq, p, out.Y)) return false;
  2735. + if (!FromJSVal(rq, p, out.Yref())) return false;
  2736.  
  2737. return true;
  2738. }
  2739. @@ -200,8 +203,8 @@
  2740. FAIL_VOID("Failed to get Vector2D constructor");
  2741.  
  2742. JS::RootedValueArray<2> args(rq.cx);
  2743. - args[0].setNumber(val.X.ToDouble());
  2744. - args[1].setNumber(val.Y.ToDouble());
  2745. + args[0].setNumber(val.getX().ToDouble());
  2746. + args[1].setNumber(val.getY().ToDouble());
  2747.  
  2748. JS::RootedObject objVec(rq.cx);
  2749. if (!JS::Construct(rq.cx, valueVector2D, args, &objVec))
  2750. Index: 0ad/source/simulation2/scripting/JSInterface_Simulation.cpp
  2751. ===================================================================
  2752. --- 0ad/source/simulation2/scripting/JSInterface_Simulation.cpp (revision 24769)
  2753. +++ 0ad/source/simulation2/scripting/JSInterface_Simulation.cpp (working copy)
  2754. @@ -147,16 +147,16 @@
  2755. continue;
  2756.  
  2757. CFixedVector2D halfSize = cmpObstruction->GetStaticSize() / 2;
  2758. - if (halfSize.X.IsZero() || halfSize.Y.IsZero() || std::max(halfSize.X, halfSize.Y) <= fixed::FromInt(2))
  2759. + if (halfSize.getX().IsZero() || halfSize.getY().IsZero() || std::max(halfSize.getX(), halfSize.getY()) <= fixed::FromInt(2))
  2760. continue;
  2761.  
  2762. std::array<CFixedVector2D, 4> corners = {
  2763. - CFixedVector2D(-halfSize.X, -halfSize.Y),
  2764. - CFixedVector2D(-halfSize.X, halfSize.Y),
  2765. + CFixedVector2D(-halfSize.getX(), -halfSize.getY()),
  2766. + CFixedVector2D(-halfSize.getX(), halfSize.getY()),
  2767. halfSize,
  2768. - CFixedVector2D(halfSize.X, -halfSize.Y)
  2769. + CFixedVector2D(halfSize.getX(), -halfSize.getY())
  2770. };
  2771. - fixed angle = cmpPosition->GetRotation().Y;
  2772. + fixed angle = cmpPosition->GetRotation().getY();
  2773. for (CFixedVector2D& corner : corners)
  2774. corner = corner.Rotate(angle) + cmpPosition->GetPosition2D();
  2775.  
  2776. Index: 0ad/source/simulation2/serialization/SerializedPathfinder.h
  2777. ===================================================================
  2778. --- 0ad/source/simulation2/serialization/SerializedPathfinder.h (revision 24769)
  2779. +++ 0ad/source/simulation2/serialization/SerializedPathfinder.h (working copy)
  2780. @@ -45,10 +45,10 @@
  2781. Serializer(serialize, "type", value.type, PathGoal::INVERTED_SQUARE);
  2782. serialize.NumberFixed_Unbounded("goal x", value.x);
  2783. serialize.NumberFixed_Unbounded("goal z", value.z);
  2784. - serialize.NumberFixed_Unbounded("goal u x", value.u.X);
  2785. - serialize.NumberFixed_Unbounded("goal u z", value.u.Y);
  2786. - serialize.NumberFixed_Unbounded("goal v x", value.v.X);
  2787. - serialize.NumberFixed_Unbounded("goal v z", value.v.Y);
  2788. + serialize.NumberFixed_Unbounded("goal u x", value.u.Xref());
  2789. + serialize.NumberFixed_Unbounded("goal u z", value.u.Yref());
  2790. + serialize.NumberFixed_Unbounded("goal v x", value.v.Xref());
  2791. + serialize.NumberFixed_Unbounded("goal v z", value.v.Yref());
  2792. serialize.NumberFixed_Unbounded("goal hw", value.hw);
  2793. serialize.NumberFixed_Unbounded("goal hh", value.hh);
  2794. serialize.NumberFixed_Unbounded("maxdist", value.maxdist);
  2795. Index: 0ad/source/tools/atlas/GameInterface/ActorViewer.cpp
  2796. ===================================================================
  2797. --- 0ad/source/tools/atlas/GameInterface/ActorViewer.cpp (revision 24769)
  2798. +++ 0ad/source/tools/atlas/GameInterface/ActorViewer.cpp (working copy)
  2799. @@ -544,13 +544,13 @@
  2800. if (cmpPosition)
  2801. {
  2802. // Move the model by speed*simFrameLength forwards
  2803. - float z = cmpPosition->GetPosition().Z.ToFloat();
  2804. + float z = cmpPosition->GetPosition().getZ().ToFloat();
  2805. z -= m.CurrentSpeed*simFrameLength;
  2806. // Wrap at the edges, so it doesn't run off into the horizon
  2807. ssize_t c = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
  2808. if (z < c - TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f)
  2809. z = c + TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f;
  2810. - cmpPosition->JumpTo(cmpPosition->GetPosition().X, entity_pos_t::FromFloat(z));
  2811. + cmpPosition->JumpTo(cmpPosition->GetPosition().getX(), entity_pos_t::FromFloat(z));
  2812. }
  2813. }
  2814. }
  2815. Index: 0ad/source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
  2816. ===================================================================
  2817. --- 0ad/source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp (revision 24769)
  2818. +++ 0ad/source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp (working copy)
  2819. @@ -66,13 +66,13 @@
  2820. sCinemaSplineNode ConstructCinemaNode(const SplineData& data)
  2821. {
  2822. sCinemaSplineNode node;
  2823. - node.px = data.Position.X.ToFloat();
  2824. - node.py = data.Position.Y.ToFloat();
  2825. - node.pz = data.Position.Z.ToFloat();
  2826. + node.px = data.Position.getX().ToFloat();
  2827. + node.py = data.Position.getY().ToFloat();
  2828. + node.pz = data.Position.getZ().ToFloat();
  2829.  
  2830. - node.rx = data.Rotation.X.ToFloat();
  2831. - node.ry = data.Rotation.Y.ToFloat();
  2832. - node.rz = data.Rotation.Z.ToFloat();
  2833. + node.rx = data.Rotation.getX().ToFloat();
  2834. + node.ry = data.Rotation.getY().ToFloat();
  2835. + node.rz = data.Rotation.getZ().ToFloat();
  2836. node.t = data.Distance.ToFloat();
  2837.  
  2838. return node;
  2839. @@ -406,9 +406,9 @@
  2840. // Get shift of the tool by the cursor movement
  2841. CFixedVector3D pos = spline.GetAllNodes()[index].Position;
  2842. CVector3D position(
  2843. - pos.X.ToFloat(),
  2844. - pos.Y.ToFloat(),
  2845. - pos.Z.ToFloat()
  2846. + pos.getX().ToFloat(),
  2847. + pos.getY().ToFloat(),
  2848. + pos.getZ().ToFloat()
  2849. );
  2850. CVector3D axisDirection(axis & AXIS_X, axis & AXIS_Y, axis & AXIS_Z);
  2851. CVector2D from, to;
  2852. @@ -458,9 +458,9 @@
  2853. {
  2854. const SplineData& data = spline.GetAllNodes()[i];
  2855. CVector3D position(
  2856. - data.Position.X.ToFloat(),
  2857. - data.Position.Y.ToFloat(),
  2858. - data.Position.Z.ToFloat()
  2859. + data.Position.getX().ToFloat(),
  2860. + data.Position.getY().ToFloat(),
  2861. + data.Position.getZ().ToFloat()
  2862. );
  2863. CVector2D screen_pos;
  2864. g_Game->GetView()->GetCamera()->GetScreenCoordinates(position, screen_pos.X, screen_pos.Y);
  2865. @@ -521,7 +521,7 @@
  2866.  
  2867. const TNSpline& spline = msg->node->targetNode ? path.GetTargetSpline() : path;
  2868. CFixedVector3D pos = spline.GetAllNodes()[index].Position;
  2869. - CVector3D position(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat());
  2870. + CVector3D position(pos.getX().ToFloat(), pos.getY().ToFloat(), pos.getZ().ToFloat());
  2871. CVector3D camera = g_Game->GetView()->GetCamera()->GetOrientation().GetTranslation();
  2872. float scale = (position - camera).Length() / 10.0;
  2873.  
  2874. Index: 0ad/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
  2875. ===================================================================
  2876. --- 0ad/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp (revision 24769)
  2877. +++ 0ad/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp (working copy)
  2878. @@ -365,10 +365,10 @@
  2879. {
  2880. bool Within(const CFixedVector3D& pos, const int centerX, const int centerZ, const int radius)
  2881. {
  2882. - int dx = abs(pos.X.ToInt_RoundToZero() - centerX);
  2883. + int dx = abs(pos.getX().ToInt_RoundToZero() - centerX);
  2884. if (dx > radius)
  2885. return false;
  2886. - int dz = abs(pos.Z.ToInt_RoundToZero() - centerZ);
  2887. + int dz = abs(pos.getZ().ToInt_RoundToZero() - centerZ);
  2888. if (dz > radius)
  2889. return false;
  2890. if (dx + dz <= radius)
  2891. @@ -447,9 +447,9 @@
  2892. CmpPtr<ICmpPosition> cmpPosition(sim, deleted.entityId);
  2893. if (cmpPosition)
  2894. {
  2895. - cmpPosition->JumpTo(deleted.pos.X, deleted.pos.Z);
  2896. - cmpPosition->SetXZRotation(deleted.rot.X, deleted.rot.Z);
  2897. - cmpPosition->SetYRotation(deleted.rot.Y);
  2898. + cmpPosition->JumpTo(deleted.pos.getX(), deleted.pos.getZ());
  2899. + cmpPosition->SetXZRotation(deleted.rot.getX(), deleted.rot.getZ());
  2900. + cmpPosition->SetYRotation(deleted.rot.getY());
  2901. }
  2902.  
  2903. CmpPtr<ICmpOwnership> cmpOwnership(sim, deleted.entityId);
  2904. @@ -471,7 +471,7 @@
  2905. const CFixedVector3D position = obj.second;
  2906. CmpPtr<ICmpPosition> cmpPosition(*g_Game->GetSimulation2(), id);
  2907. ENSURE(cmpPosition);
  2908. - cmpPosition->JumpTo(position.X, position.Z);
  2909. + cmpPosition->JumpTo(position.getX(), position.getZ());
  2910. }
  2911. }
  2912.  
  2913. Index: 0ad/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp
  2914. ===================================================================
  2915. --- 0ad/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp (revision 24769)
  2916. +++ 0ad/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp (working copy)
  2917. @@ -279,13 +279,13 @@
  2918. CFixedVector3D rot = cmpPosition->GetRotation();
  2919. {
  2920. XMLWriter_Element positionTag(exampleFile, "Position");
  2921. - positionTag.Attribute("x", pos.X);
  2922. - positionTag.Attribute("z", pos.Z);
  2923. + positionTag.Attribute("x", pos.getX());
  2924. + positionTag.Attribute("z", pos.getZ());
  2925. // TODO: height offset etc
  2926. }
  2927. {
  2928. XMLWriter_Element orientationTag(exampleFile, "Orientation");
  2929. - orientationTag.Attribute("y", rot.Y);
  2930. + orientationTag.Attribute("y", rot.getY());
  2931. // TODO: X, Z maybe
  2932. }
  2933. }
  2934. @@ -436,7 +436,7 @@
  2935.  
  2936. //now rotate
  2937. CFixedVector3D rotation = cmpPositionOld->GetRotation();
  2938. - cmpPositionNew->SetYRotation(rotation.Y);
  2939. + cmpPositionNew->SetYRotation(rotation.getY());
  2940. }
  2941.  
  2942. //get owner
  2943. @@ -498,7 +498,7 @@
  2944. CFixedVector3D posFixed = cmpPreviewPosition->GetPosition();
  2945. posFinal = posFixed + dir;
  2946. }
  2947. - cmpPreviewPosition->JumpTo(posFinal.X, posFinal.Z);
  2948. + cmpPreviewPosition->JumpTo(posFinal.getX(), posFinal.getZ());
  2949. }
  2950.  
  2951. CheckObstructionAndUpdateVisual(id);
  2952. @@ -665,7 +665,7 @@
  2953. else
  2954. {
  2955. CFixedVector3D fixed = cmpPosition->GetPosition();
  2956. - CVector3D centre = CVector3D(fixed.X.ToFloat(), fixed.Y.ToFloat(), fixed.Z.ToFloat());
  2957. + CVector3D centre = CVector3D(fixed.getX().ToFloat(), fixed.getY().ToFloat(), fixed.getZ().ToFloat());
  2958.  
  2959. float cx, cy;
  2960. g_Game->GetView()->GetCamera()->GetScreenCoordinates(centre, cx, cy);
  2961. @@ -736,7 +736,7 @@
  2962. {
  2963. pivotFloating = cmpPositionPivot->CanFloat();
  2964. CFixedVector3D pivotFixed = cmpPositionPivot->GetPosition();
  2965. - pivotPos = CVector3D(pivotFixed.X.ToFloat(), pivotFixed.Y.ToFloat(), pivotFixed.Z.ToFloat());
  2966. + pivotPos = CVector3D(pivotFixed.getX().ToFloat(), pivotFixed.getY().ToFloat(), pivotFixed.getZ().ToFloat());
  2967. }
  2968.  
  2969. // Calculate directional vector of movement for pivot object,
  2970. @@ -756,7 +756,7 @@
  2971. {
  2972. // Calculate this object's position
  2973. CFixedVector3D posFixed = cmpPosition->GetPosition();
  2974. - CVector3D pos = CVector3D(posFixed.X.ToFloat(), posFixed.Y.ToFloat(), posFixed.Z.ToFloat());
  2975. + CVector3D pos = CVector3D(posFixed.getX().ToFloat(), posFixed.getY().ToFloat(), posFixed.getZ().ToFloat());
  2976. m_PosNew[id] = pos + dir;
  2977. m_PosOld[id] = pos;
  2978. }
  2979. @@ -825,7 +825,7 @@
  2980. CVector3D pos = cmpPosition->GetPosition();
  2981.  
  2982. m_PosOld[id] = cmpPosition->GetPosition();
  2983. - m_AngleOld[id] = cmpPosition->GetRotation().Y.ToFloat();
  2984. + m_AngleOld[id] = cmpPosition->GetRotation().getY().ToFloat();
  2985.  
  2986. if (first)
  2987. {
  2988. @@ -950,7 +950,7 @@
  2989. if (!cmpPosition)
  2990. return;
  2991.  
  2992. - m_AngleOld[id] = cmpPosition->GetRotation().Y.ToFloat();
  2993. + m_AngleOld[id] = cmpPosition->GetRotation().getY().ToFloat();
  2994.  
  2995. CMatrix3D transform = cmpPosition->GetInterpolatedTransform(0.f);
  2996. CVector3D pos = transform.GetTranslation();
  2997. @@ -1068,9 +1068,9 @@
  2998. CmpPtr<ICmpPosition> cmpPosition(sim, oldObjects[i].entityID);
  2999. if (cmpPosition)
  3000. {
  3001. - cmpPosition->JumpTo(oldObjects[i].pos.X, oldObjects[i].pos.Z);
  3002. - cmpPosition->SetXZRotation(oldObjects[i].rot.X, oldObjects[i].rot.Z);
  3003. - cmpPosition->SetYRotation(oldObjects[i].rot.Y);
  3004. + cmpPosition->JumpTo(oldObjects[i].pos.getX(), oldObjects[i].pos.getZ());
  3005. + cmpPosition->SetXZRotation(oldObjects[i].rot.getX(), oldObjects[i].rot.getZ());
  3006. + cmpPosition->SetYRotation(oldObjects[i].rot.getY());
  3007. }
  3008.  
  3009. CmpPtr<ICmpOwnership> cmpOwnership(sim, oldObjects[i].entityID);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement