diff --git a/source/lib/code_annotation.h b/source/lib/code_annotation.h index 24b312fa31..5e55570375 100644 --- a/source/lib/code_annotation.h +++ b/source/lib/code_annotation.h @@ -27,8 +27,9 @@ #ifndef INCLUDED_CODE_ANNOTATION #define INCLUDED_CODE_ANNOTATION -#include "lib/sysdep/compiler.h" +#include "lib/code_generation.h" #include "lib/sysdep/arch.h" // ARCH_AMD64 +#include "lib/sysdep/compiler.h" #include diff --git a/source/maths/BoundingBoxAligned.cpp b/source/maths/BoundingBoxAligned.cpp index 32bd8cec60..2c1e6c0371 100644 --- a/source/maths/BoundingBoxAligned.cpp +++ b/source/maths/BoundingBoxAligned.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,12 +23,15 @@ #include "BoundingBoxAligned.h" +#include "lib/debug.h" #include "maths/BoundingBoxOriented.h" #include "maths/Brush.h" #include "maths/Frustum.h" #include "maths/Matrix3D.h" +#include "maths/Plane.h" #include +#include const CBoundingBoxAligned CBoundingBoxAligned::EMPTY = CBoundingBoxAligned(); // initializes to an empty bound diff --git a/source/maths/BoundingBoxAligned.h b/source/maths/BoundingBoxAligned.h index be01f6311d..861bd74475 100644 --- a/source/maths/BoundingBoxAligned.h +++ b/source/maths/BoundingBoxAligned.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,11 +23,12 @@ #define INCLUDED_BOUND #include "maths/Vector3D.h" -#include "graphics/ShaderProgramPtr.h" +#include + +class CBoundingBoxOriented; class CFrustum; class CMatrix3D; -class CBoundingBoxOriented; // Basic axis aligned bounding box (AABB) class class CBoundingBoxAligned diff --git a/source/maths/BoundingBoxOriented.cpp b/source/maths/BoundingBoxOriented.cpp index 4332362ef1..75e7c5e74f 100644 --- a/source/maths/BoundingBoxOriented.cpp +++ b/source/maths/BoundingBoxOriented.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,7 +20,8 @@ #include "BoundingBoxOriented.h" #include "maths/BoundingBoxAligned.h" -#include +#include +#include const CBoundingBoxOriented CBoundingBoxOriented::EMPTY = CBoundingBoxOriented(); diff --git a/source/maths/BoundingSphere.cpp b/source/maths/BoundingSphere.cpp index c6bff5674f..a48fc70dd0 100644 --- a/source/maths/BoundingSphere.cpp +++ b/source/maths/BoundingSphere.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,6 +20,9 @@ #include "maths/BoundingBoxAligned.h" #include "maths/BoundingSphere.h" +#include +#include + CBoundingSphere CBoundingSphere::FromSweptBox(const CBoundingBoxAligned& bbox) { float maxX = std::max(fabsf(bbox[0].X), fabsf(bbox[1].X)); diff --git a/source/maths/Brush.cpp b/source/maths/Brush.cpp index 667e48191a..f233b987e8 100644 --- a/source/maths/Brush.cpp +++ b/source/maths/Brush.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,8 +19,10 @@ #include "Brush.h" +#include "lib/debug.h" #include "maths/BoundingBoxAligned.h" #include "maths/Frustum.h" +#include "maths/Plane.h" CBrush::CBrush() = default; diff --git a/source/maths/Brush.h b/source/maths/Brush.h index cbc9afe103..90e439d53b 100644 --- a/source/maths/Brush.h +++ b/source/maths/Brush.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -24,6 +24,7 @@ #include "maths/Vector3D.h" +#include #include class CBoundingBoxAligned; diff --git a/source/maths/Fixed.cpp b/source/maths/Fixed.cpp index e9e3c8cec8..eafbc77170 100644 --- a/source/maths/Fixed.cpp +++ b/source/maths/Fixed.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,6 +22,7 @@ #include "ps/CStr.h" #include +#include template<> CFixed_15_16 CFixed_15_16::FromString(const CStr8& s) diff --git a/source/maths/Fixed.h b/source/maths/Fixed.h index 9364920285..81de7f6c24 100644 --- a/source/maths/Fixed.h +++ b/source/maths/Fixed.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -18,9 +18,17 @@ #ifndef INCLUDED_FIXED #define INCLUDED_FIXED +#include "lib/debug.h" +#include "lib/sysdep/compiler.h" #include "lib/types.h" #include "maths/Sqrt.h" -#include "ps/CStrForward.h" + +#include +#include +#include + +class CStr8; +class CStrW; #ifndef NDEBUG #define USE_FIXED_OVERFLOW_CHECKS @@ -312,7 +320,7 @@ public: return CFixed(t); } - constexpr CFixed Absolute() const { return CFixed(abs(value)); } + constexpr CFixed Absolute() const { return CFixed(std::abs(value)); } /** * Multiply by a CFixed. Likely to overflow if both numbers are large, diff --git a/source/maths/FixedVector2D.h b/source/maths/FixedVector2D.h index 100c42597e..5906c8a61f 100644 --- a/source/maths/FixedVector2D.h +++ b/source/maths/FixedVector2D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ #ifndef INCLUDED_FIXED_VECTOR2D #define INCLUDED_FIXED_VECTOR2D +#include "lib/types.h" #include "maths/Fixed.h" #include "maths/Sqrt.h" diff --git a/source/maths/FixedVector3D.h b/source/maths/FixedVector3D.h index ad47c60b38..e4fbc9ed6a 100644 --- a/source/maths/FixedVector3D.h +++ b/source/maths/FixedVector3D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ #ifndef INCLUDED_FIXED_VECTOR3D #define INCLUDED_FIXED_VECTOR3D +#include "lib/types.h" #include "maths/Fixed.h" #include "maths/Sqrt.h" diff --git a/source/maths/Frustum.cpp b/source/maths/Frustum.cpp index b104b821d3..62f60d9d30 100644 --- a/source/maths/Frustum.cpp +++ b/source/maths/Frustum.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,8 +25,8 @@ portal rendering, where a portal may have 3 or more edges. #include "Frustum.h" +#include "lib/debug.h" #include "maths/BoundingBoxAligned.h" -#include "maths/MathUtil.h" #include "maths/Matrix3D.h" CFrustum::CFrustum() diff --git a/source/maths/Frustum.h b/source/maths/Frustum.h index 66152c3bff..4f2ce6c78d 100644 --- a/source/maths/Frustum.h +++ b/source/maths/Frustum.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -28,8 +28,11 @@ portal rendering, where a portal may have 3 or more edges. #ifndef INCLUDED_FRUSTUM #define INCLUDED_FRUSTUM +#include "maths/Vector3D.h" #include "maths/Plane.h" +#include + class CBoundingBoxAligned; class CMatrix3D; diff --git a/source/maths/MD5.h b/source/maths/MD5.h index f1c0039faa..fc84607e5e 100644 --- a/source/maths/MD5.h +++ b/source/maths/MD5.h @@ -18,6 +18,9 @@ #ifndef INCLUDED_MD5 #define INCLUDED_MD5 +#include "lib/code_annotation.h" +#include "lib/types.h" + #include /** diff --git a/source/maths/Matrix3D.cpp b/source/maths/Matrix3D.cpp index 4d26f05ff8..5a17b96078 100644 --- a/source/maths/Matrix3D.cpp +++ b/source/maths/Matrix3D.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -23,8 +23,10 @@ #include "precompiled.h" #include "Matrix3D.h" -#include "Quaternion.h" -#include "Vector4D.h" + +#include "maths/Quaternion.h" + +#include //Sets the identity matrix void CMatrix3D::SetIdentity () diff --git a/source/maths/Matrix3D.h b/source/maths/Matrix3D.h index 8e8523c141..e2db5947d7 100644 --- a/source/maths/Matrix3D.h +++ b/source/maths/Matrix3D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -27,6 +27,8 @@ #include "maths/Vector4D.h" #include "ps/containers/Span.h" +#include + class CQuaternion; // CMatrix3D: a 4x4 matrix class for common operations in 3D diff --git a/source/maths/NUSpline.cpp b/source/maths/NUSpline.cpp index a30f8ed222..4b7d04a535 100644 --- a/source/maths/NUSpline.cpp +++ b/source/maths/NUSpline.cpp @@ -17,10 +17,15 @@ #include "precompiled.h" -#include - #include "NUSpline.h" -#include "Matrix3D.h" + +#include "lib/debug.h" +#include "maths/FixedVector3D.h" +#include "maths/Matrix3D.h" +#include "maths/Vector3D.h" + +#include + //Note: column major order! Each set of 4 constitutes a column. CMatrix3D HermiteSpline(2.f, -3.f, 0.f, 1.f, diff --git a/source/maths/NUSpline.h b/source/maths/NUSpline.h index 4e324c2b58..7fe7149f66 100644 --- a/source/maths/NUSpline.h +++ b/source/maths/NUSpline.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -26,8 +26,9 @@ #define MAX_SPLINE_NODES 128 -#include "FixedVector3D.h" -#include "Vector3D.h" +#include "maths/Fixed.h" +#include "maths/FixedVector3D.h" +#include "maths/Vector3D.h" #include diff --git a/source/maths/Plane.cpp b/source/maths/Plane.cpp index 04f0fe9a9b..267c1b9d52 100644 --- a/source/maths/Plane.cpp +++ b/source/maths/Plane.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,7 +25,9 @@ #include "precompiled.h" #include "Plane.h" -#include "MathUtil.h" + +#include "maths/MathUtil.h" +#include "maths/Vector3D.h" const float CPlane::m_EPS = 0.001f; diff --git a/source/maths/Quaternion.cpp b/source/maths/Quaternion.cpp index 1aac49b6fa..4d0a040523 100644 --- a/source/maths/Quaternion.cpp +++ b/source/maths/Quaternion.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,8 +19,11 @@ #include "Quaternion.h" -#include "MathUtil.h" -#include "Matrix3D.h" +#include "maths/MathUtil.h" +#include "maths/Matrix3D.h" +#include "maths/Vector3D.h" + +#include const float EPSILON=0.0001f; diff --git a/source/maths/Rect.cpp b/source/maths/Rect.cpp index ca23057255..b430e7a041 100644 --- a/source/maths/Rect.cpp +++ b/source/maths/Rect.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,6 +22,8 @@ #include "maths/Size2D.h" #include "maths/Vector2D.h" +#include + CRect::CRect() : left(0.f), top(0.f), right(0.f), bottom(0.f) { diff --git a/source/maths/Sqrt.h b/source/maths/Sqrt.h index 8db047123c..6685e08626 100644 --- a/source/maths/Sqrt.h +++ b/source/maths/Sqrt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -18,6 +18,8 @@ #ifndef INCLUDED_MATH_SQRT #define INCLUDED_MATH_SQRT +#include "lib/types.h" + /** * 64-bit integer square root. * Returns r such that r^2 <= n < (r+1)^2, for the complete u64 range. diff --git a/source/maths/Vector2D.h b/source/maths/Vector2D.h index 1e9db33f65..dd118b4a19 100644 --- a/source/maths/Vector2D.h +++ b/source/maths/Vector2D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,7 +20,8 @@ #include "ps/containers/Span.h" -#include +#include +#include class CSize2D; diff --git a/source/maths/Vector3D.h b/source/maths/Vector3D.h index d5a75df090..0b8440cda0 100644 --- a/source/maths/Vector3D.h +++ b/source/maths/Vector3D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,6 +25,8 @@ #include "ps/containers/Span.h" +#include + class CFixedVector3D; class CVector3D diff --git a/source/maths/Vector4D.h b/source/maths/Vector4D.h index 3a5686e74a..ec8189b041 100644 --- a/source/maths/Vector4D.h +++ b/source/maths/Vector4D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,7 +25,7 @@ #include "ps/containers/Span.h" -#include +#include class CVector4D { diff --git a/source/maths/tests/test_Bound.h b/source/maths/tests/test_Bound.h index ac562a3aa9..14c4c02d05 100644 --- a/source/maths/tests/test_Bound.h +++ b/source/maths/tests/test_Bound.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,10 +17,12 @@ #include "lib/self_test.h" -#include "lib/posix/posix.h" #include "maths/BoundingBoxAligned.h" #include "maths/BoundingBoxOriented.h" #include "maths/Matrix3D.h" +#include "maths/Vector3D.h" + +#include #define TS_ASSERT_VEC_DELTA(v, x, y, z, delta) \ TS_ASSERT_DELTA(v.X, x, delta); \ diff --git a/source/maths/tests/test_BoundingSphere.h b/source/maths/tests/test_BoundingSphere.h index 58bc0c5274..3663215798 100644 --- a/source/maths/tests/test_BoundingSphere.h +++ b/source/maths/tests/test_BoundingSphere.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,8 +19,10 @@ #include "maths/BoundingBoxAligned.h" #include "maths/BoundingSphere.h" +#include "maths/Vector3D.h" #include +#include class TestBoundingSphere : public CxxTest::TestSuite { diff --git a/source/maths/tests/test_Brush.h b/source/maths/tests/test_Brush.h index 4b13f371b0..7a0b8c0231 100644 --- a/source/maths/tests/test_Brush.h +++ b/source/maths/tests/test_Brush.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,9 +17,18 @@ #include "lib/self_test.h" -#include "maths/Brush.h" #include "maths/BoundingBoxAligned.h" -#include "maths/Frustum.h" +#include "maths/Brush.h" +#include "maths/Plane.h" +#include "maths/Vector3D.h" +#include "maths/Vector4D.h" + +#include +#include +#include +#include +#include +#include class TestBrush : public CxxTest::TestSuite { diff --git a/source/maths/tests/test_Fixed.h b/source/maths/tests/test_Fixed.h index 32895ef2fe..d48e0bed47 100644 --- a/source/maths/tests/test_Fixed.h +++ b/source/maths/tests/test_Fixed.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,8 +22,14 @@ # pragma warning(push, 1) # pragma warning(disable: 4724) #endif + +#include "lib/types.h" #include "maths/Fixed.h" -#include "maths/MathUtil.h" +#include "ps/CStr.h" + +#include +#include +#include class TestFixed : public CxxTest::TestSuite { diff --git a/source/maths/tests/test_FixedVector2D.h b/source/maths/tests/test_FixedVector2D.h index d1e0b3c721..f90b38f992 100644 --- a/source/maths/tests/test_FixedVector2D.h +++ b/source/maths/tests/test_FixedVector2D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,8 +17,12 @@ #include "lib/self_test.h" +#include "lib/types.h" +#include "maths/Fixed.h" #include "maths/FixedVector2D.h" +#include + #define TS_ASSERT_VEC_EQUALS(v, x, y) \ TS_ASSERT_EQUALS(v.X.ToDouble(), x); \ TS_ASSERT_EQUALS(v.Y.ToDouble(), y); diff --git a/source/maths/tests/test_FixedVector3D.h b/source/maths/tests/test_FixedVector3D.h index e4cb0b259b..d2515f0d09 100644 --- a/source/maths/tests/test_FixedVector3D.h +++ b/source/maths/tests/test_FixedVector3D.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,8 +17,12 @@ #include "lib/self_test.h" +#include "lib/types.h" +#include "maths/Fixed.h" #include "maths/FixedVector3D.h" +#include + #define TS_ASSERT_VEC_EQUALS(v, x, y, z) \ TS_ASSERT_EQUALS(v.X.ToDouble(), x); \ TS_ASSERT_EQUALS(v.Y.ToDouble(), y); \ diff --git a/source/maths/tests/test_MD5.h b/source/maths/tests/test_MD5.h index 7bce6ed0ad..ae36c3f0ed 100644 --- a/source/maths/tests/test_MD5.h +++ b/source/maths/tests/test_MD5.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,9 +17,13 @@ #include "lib/self_test.h" +#include "lib/types.h" #include "maths/MD5.h" #include "ps/Util.h" +#include +#include + class TestMD5 : public CxxTest::TestSuite { public: diff --git a/source/maths/tests/test_Matrix3d.h b/source/maths/tests/test_Matrix3d.h index 5a4c68d1ac..b4b8020bbe 100644 --- a/source/maths/tests/test_Matrix3d.h +++ b/source/maths/tests/test_Matrix3d.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,11 +17,12 @@ #include "lib/self_test.h" +#include "lib/lib.h" #include "maths/Matrix3D.h" #include "maths/Quaternion.h" +#include "maths/Vector3D.h" #include -#include #include class TestMatrix : public CxxTest::TestSuite diff --git a/source/maths/tests/test_Sqrt.h b/source/maths/tests/test_Sqrt.h index 702244b9cd..542cc38e5f 100644 --- a/source/maths/tests/test_Sqrt.h +++ b/source/maths/tests/test_Sqrt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -17,11 +17,14 @@ #include "lib/self_test.h" +#include "lib/types.h" #include "maths/Sqrt.h" #include #include #include +#include +#include class TestSqrt : public CxxTest::TestSuite {