1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-29 12:20:41 +00:00

Call getUserPointer only for not nullptr collision object

nullptr can't have user pointer anyway so it saves a lookup in the
unordered_map.
This commit is contained in:
elsid 2024-04-26 15:31:29 +02:00
parent 5f926bd129
commit acf1e51a28
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -275,10 +275,13 @@ namespace
if (mAdvanceSimulation)
{
MWWorld::Ptr standingOn;
auto* ptrHolder
= static_cast<MWPhysics::PtrHolder*>(scheduler->getUserPointer(frameData.mStandingOn));
if (ptrHolder)
standingOn = ptrHolder->getPtr();
if (frameData.mStandingOn != nullptr)
{
auto* const ptrHolder
= static_cast<MWPhysics::PtrHolder*>(scheduler->getUserPointer(frameData.mStandingOn));
if (ptrHolder != nullptr)
standingOn = ptrHolder->getPtr();
}
actor->setStandingOnPtr(standingOn);
// the "on ground" state of an actor might have been updated by a traceDown, don't overwrite the
// change