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:
parent
5f926bd129
commit
acf1e51a28
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user