From 72eb49b70d5fd0a0631d474310245d4ff97d4b67 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 26 Jan 2024 09:58:13 -0500 Subject: [PATCH] Improve match --- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 93c3f649..ec97d03c 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -183,24 +183,29 @@ MxCore* LegoWorld::FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId) MxPresenter* presenter; while (presenterCursor0xb8.Next(presenter)) { - if (presenter->GetAction()->GetAtomId() == p_atom && presenter->GetAction()->GetObjectId() == p_entityId) + MxDSAction* action = presenter->GetAction(); + + if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) return presenter; } MxPresenterListCursor presenterCursor0x80(&m_list0x80); while (presenterCursor0x80.Next(presenter)) { - if (presenter->GetAction() && presenter->GetAction()->GetAtomId() == p_atom && - presenter->GetAction()->GetObjectId() == p_entityId) + MxDSAction* action = presenter->GetAction(); + + if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) return presenter; } for (MxPresenterSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { MxCore* core = *it; + if (core->IsA("MxPresenter")) { - presenter = (MxPresenter*) *it; + MxPresenter* presenter = (MxPresenter*) *it; + if (presenter->GetAction()->GetAtomId() == p_atom && presenter->GetAction()->GetObjectId() == p_entityId) - return presenter; + return *it; } }