Remove dynamic_cast (#139)

This commit is contained in:
Christian Semmler 2025-05-20 16:29:51 -07:00 committed by GitHub
parent 9d06cd9e53
commit 9e3e039c3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<LegoLocomotionAnimPresenter*>(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<LegoLocomotionAnimPresenter*>(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;
}
}