From c37cd04585e37911acf972ef88b81c554ef72082 Mon Sep 17 00:00:00 2001 From: LC Date: Tue, 26 Jan 2021 21:29:28 -0500 Subject: [PATCH] c_m3d: Make use of forward declarations (#104) Some inline helper function of the included files in the header make use of functions defined within it. This can cause a circular dependency cycle if said helper functions are ever defined within the classes. To break this potential cycle, we can use forward declarations. This also has the benefit of reducing preprocessing overhead a little bit. --- include/SComponent/c_cc_d/c_cc_d.h | 5 +++-- include/SComponent/c_m3d.h | 22 ++++++++++++---------- libs/SSystem/SComponent/c_m3d.cpp | 10 ++++++++++ libs/SSystem/SComponent/c_m3d_g_lin.cpp | 3 ++- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/include/SComponent/c_cc_d/c_cc_d.h b/include/SComponent/c_cc_d/c_cc_d.h index 98668656d15..3783bc0c372 100644 --- a/include/SComponent/c_cc_d/c_cc_d.h +++ b/include/SComponent/c_cc_d/c_cc_d.h @@ -1,8 +1,9 @@ #ifndef C_CC_D_H_ #define C_CC_D_H_ -#include "SComponent/c_m3d.h" -#include "global.h" +#include "SComponent/c_m3d_g_aab.h" +#include "SComponent/c_m3d_g_cps.h" +#include "SComponent/c_m3d_g_cyl.h" class cCcD_ShapeAttr { public: diff --git a/include/SComponent/c_m3d.h b/include/SComponent/c_m3d.h index e467d442f38..8eacd15bfcb 100644 --- a/include/SComponent/c_m3d.h +++ b/include/SComponent/c_m3d.h @@ -1,18 +1,20 @@ #ifndef C_M3D_H_ #define C_M3D_H_ -#include "SComponent/c_m3d_g_aab.h" -#include "SComponent/c_m3d_g_cps.h" -#include "SComponent/c_m3d_g_cyl.h" -#include "SComponent/c_m3d_g_lin.h" -#include "SComponent/c_m3d_g_pla.h" -#include "SComponent/c_m3d_g_sph.h" -#include "SComponent/c_m3d_g_tri.h" -#include "SComponent/c_sxyz.h" -#include "SComponent/c_xyz.h" -#include "global.h" +#include "dolphin/types.h" + +class cM3dGAab; +class cM3dGCps; +class cM3dGCyl; +class cM3dGLin; +class cM3dGPla; +class cM3dGSph; +class cM3dGTri; +class csXyz; +class cXyz; struct cM3d_Range; +struct Vec; void cM3d_InDivPos1(const Vec*, const Vec*, f32, Vec*); void cM3d_InDivPos2(const Vec*, const Vec*, f32, Vec*); diff --git a/libs/SSystem/SComponent/c_m3d.cpp b/libs/SSystem/SComponent/c_m3d.cpp index 71323eb868b..2515d2ae05c 100644 --- a/libs/SSystem/SComponent/c_m3d.cpp +++ b/libs/SSystem/SComponent/c_m3d.cpp @@ -1,6 +1,16 @@ /* c_m3d.cpp autogenerated by split.py v0.3 at 2021-01-01 14:58:46.459661 */ #include "SComponent/c_m3d.h" +#include "SComponent/c_m3d_g_aab.h" +#include "SComponent/c_m3d_g_cps.h" +#include "SComponent/c_m3d_g_cyl.h" +#include "SComponent/c_m3d_g_lin.h" +#include "SComponent/c_m3d_g_pla.h" +#include "SComponent/c_m3d_g_sph.h" +#include "SComponent/c_m3d_g_tri.h" +#include "SComponent/c_sxyz.h" +#include "SComponent/c_xyz.h" +#include "global.h" extern f32 lbl_80455118; // SComponent::@2256, 0.0 extern f32 lbl_80455138; // SComponent::@2273, 1.0 diff --git a/libs/SSystem/SComponent/c_m3d_g_lin.cpp b/libs/SSystem/SComponent/c_m3d_g_lin.cpp index 04a52f45c3e..f4312a4a55d 100644 --- a/libs/SSystem/SComponent/c_m3d_g_lin.cpp +++ b/libs/SSystem/SComponent/c_m3d_g_lin.cpp @@ -1,6 +1,7 @@ /* c_m3d_g_lin.cpp autogenerated by split.py v0.3 at 2021-01-01 14:48:45.519641 */ -#include "SComponent/c_m3d.h" +#include "SComponent/c_m3d_g_lin.h" +#include "mtx_vec.h" // __ct__8cM3dGLinFRC4cXyzRC4cXyz cM3dGLin::cM3dGLin(const cXyz& pStart, const cXyz& pEnd) : mStart(pStart), mEnd(pEnd) {}