CCollidable*: Make use of static inline variables where applicable

Allows relocating initialization with the rest of the variables.
This commit is contained in:
Lioncash 2020-08-01 05:31:23 -04:00
parent 55da593e59
commit 88e6a04f13
10 changed files with 5 additions and 11 deletions

View File

@ -7,7 +7,6 @@
namespace urde {
constexpr CCollisionPrimitive::Type sType(CCollidableAABox::SetStaticTableIndex, "CCollidableAABox");
u32 CCollidableAABox::sTableIndex = -1;
CCollidableAABox::CCollidableAABox() = default;

View File

@ -12,7 +12,7 @@ bool AABox_AABox_Bool(const CInternalCollisionStructure&);
} // namespace Collide
class CCollidableAABox : public CCollisionPrimitive {
static u32 sTableIndex;
static inline u32 sTableIndex = UINT32_MAX;
zeus::CAABox x10_aabox;

View File

@ -3,7 +3,6 @@
namespace urde {
constexpr CCollisionPrimitive::Type sType(CCollidableCollisionSurface::SetStaticTableIndex,
"CCollidableCollisionSurface");
u32 CCollidableCollisionSurface::sTableIndex = -1;
const CCollisionPrimitive::Type& CCollidableCollisionSurface::GetType() { return sType; }

View File

@ -5,7 +5,7 @@
namespace urde {
class CCollidableCollisionSurface {
static u32 sTableIndex;
static inline u32 sTableIndex = UINT32_MAX;
public:
static const CCollisionPrimitive::Type& GetType();

View File

@ -9,8 +9,6 @@
namespace urde {
u32 CCollidableOBBTree::sTableIndex = 0;
CCollidableOBBTree::CCollidableOBBTree(const COBBTree* tree, const urde::CMaterialList& material)
: CCollisionPrimitive(material), x10_tree(tree) {}

View File

@ -35,7 +35,7 @@ class CCollidableOBBTree : public CCollisionPrimitive {
u32 x14_tries = 0;
u32 x18_misses = 0;
u32 x1c_hits = 0;
static u32 sTableIndex;
static inline u32 sTableIndex = 0;
bool LineIntersectsLeaf(const COBBTree::CLeafData& leaf, CRayCastInfo& info) const;
bool LineIntersectsOBBTree(const COBBTree::CNode& n0, const COBBTree::CNode& n1, CRayCastInfo& info) const;
bool LineIntersectsOBBTree(const COBBTree::CNode& node, CRayCastInfo& info) const;

View File

@ -9,7 +9,6 @@
namespace urde {
constexpr CCollisionPrimitive::Type sType(CCollidableOBBTreeGroup::SetStaticTableIndex, "CCollidableOBBTreeGroup");
u32 CCollidableOBBTreeGroup::sTableIndex = -1;
CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(CInputStream& in) {
const u32 treeCount = in.readUint32Big();

View File

@ -24,7 +24,7 @@ public:
};
class CCollidableOBBTreeGroup : public CCollisionPrimitive {
static u32 sTableIndex;
static inline u32 sTableIndex = UINT32_MAX;
const CCollidableOBBTreeGroupContainer* x10_container;
public:

View File

@ -7,7 +7,6 @@
namespace urde {
constexpr CCollisionPrimitive::Type sType(CCollidableSphere::SetStaticTableIndex, "CCollidableSphere");
u32 CCollidableSphere::sTableIndex = -1;
namespace Collide {

View File

@ -14,7 +14,7 @@ bool Sphere_Sphere_Bool(const CInternalCollisionStructure&);
} // namespace Collide
class CCollidableSphere : public CCollisionPrimitive {
static u32 sTableIndex;
static inline u32 sTableIndex = UINT32_MAX;
zeus::CSphere x10_sphere;