From 9e3e039c3f414c7275c75ef1909457b984d50e66 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 20 May 2025 16:29:51 -0700 Subject: [PATCH] Remove `dynamic_cast` (#139) --- .../legoomni/src/paths/legopathboundary.cpp | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index e4c1282b..28dafe62 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -356,14 +356,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) return 0; } - // TODO: This only seems to match if the type is not the same as the type of the - // key value of the set. Figure out which type the set (or parameter) actually uses. - // Also see call to .find in LegoPathController::FUN_10046050 - if (auto* locomotionPresenter = dynamic_cast(p_presenter)) { - m_presenters.insert(locomotionPresenter); - return 1; - } - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid locomotion"); + m_presenters.insert(p_presenter); return 0; } @@ -372,17 +365,8 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter) { if (p_presenter != NULL) { - // TODO: This only seems to match if the type is not the same as the type of the - // key value of the set. Figure out which type the set (or parameter) actually uses. - // Also see call to .find in LegoPathController::FUN_10046050 - auto* locomotionPresenter = dynamic_cast(p_presenter); - if (!locomotionPresenter) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid locomotion"); - return 0; - } - auto it = m_presenters.find(locomotionPresenter); - if (it != m_presenters.end()) { - m_presenters.erase(it); + if (m_presenters.find(p_presenter) != m_presenters.end()) { + m_presenters.erase(p_presenter); return 1; } }