From 596ebde9d3224b67d184338d2bf730e20740a7eb Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Thu, 12 Jun 2025 08:52:56 +0200 Subject: [PATCH] Add BETA10 assertions in LegoPathController (#1555) * Add BETA10 assertions in LegoPathController * formatting --------- Co-authored-by: jonschz --- .../legoomni/src/paths/legopathcontroller.cpp | 17 +++++++++++++++++ LEGO1/lego/sources/geom/legoweedge.h | 1 + 2 files changed, 18 insertions(+) diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 93cf0216..abf16351 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -559,27 +559,32 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numN); edge.m_pointA = &m_nodes[s]; if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numN); edge.m_pointB = &m_nodes[s]; if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) { if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numL); edge.m_faceA = &m_boundaries[s]; if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_ccwA = &m_edges[s]; if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_cwA = &m_edges[s]; } @@ -587,16 +592,19 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numL); edge.m_faceB = &m_boundaries[s]; if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_ccwB = &m_edges[s]; if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_cwB = &m_edges[s]; } @@ -617,6 +625,9 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) { for (MxS32 i = 0; i < m_numL; i++) { +#ifdef BETA10 + Mx4DPointFloat unused; +#endif LegoPathBoundary& boundary = m_boundaries[i]; MxU8 numE; MxU16 s; @@ -626,6 +637,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(numE > 2); + boundary.m_edgeNormals = new Mx4DPointFloat[numE]; LegoOrientedEdge** edges = new LegoOrientedEdge*[numE]; @@ -636,6 +649,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(s < m_numE); + edges[j] = &m_edges[s]; } @@ -693,6 +708,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(s < m_numT); + boundary.m_pathTrigger[j].m_pathStruct = &m_structs[s]; if (p_storage->Read(&boundary.m_pathTrigger[j].m_data, sizeof(boundary.m_pathTrigger[j].m_data)) != diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index 4516f938..7e0e9bae 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -25,6 +25,7 @@ public: // FUNCTION: BETA10 0x100373f0 LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; } + // FUNCTION: BETA10 0x100bd410 void SetEdges(LegoOrientedEdge** p_edges, LegoU8 p_numEdges) { m_edges = p_edges;