Skip to content

Commit

Permalink
More CWorldTicker cleanup, removed some redundant tick list add ops.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbnolok committed Feb 3, 2025
1 parent 0aca7c0 commit 0128420
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 198 deletions.
15 changes: 6 additions & 9 deletions src/game/CObjBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3145,13 +3145,13 @@ void CObjBase::UpdatePropertyFlag()
if (!(g_Cfg.m_iFeatureAOS & FEATURE_AOS_UPDATE_B) || g_Serv.IsLoading())
return;

m_fStatusUpdate |= SU_UPDATE_TOOLTIP;
m_fStatusUpdate |= SU_UPDATE_TOOLTIP;

// Items equipped, inside containers or with timer expired doesn't receive ticks and need to be added to a list of items to be processed separately
if (!IsTopLevel() || _IsTimerExpired())
if (!IsTopLevel() || _IsTimerExpired())
{
CWorldTickingList::AddObjStatusUpdate(this, false);
}
}
}

dword CObjBase::GetPropertyHash() const
Expand Down Expand Up @@ -3189,12 +3189,7 @@ void CObjBase::_GoAwake()
if (auto pContainer = dynamic_cast<CContainer*>(this))
{
pContainer->_GoAwake(); // This method isn't virtual
}

if (_IsTimerSet())
{
CWorldTickingList::AddObjSingle(_GetTimeoutRaw(), this, true);
}
}
// CWorldTickingList::AddObjStatusUpdate(this, false); // Don't! It's done when needed in UpdatePropertyFlag()
}

Expand All @@ -3207,6 +3202,8 @@ void CObjBase::_GoSleep()
{
CWorldTickingList::DelObjSingle(this);
}

// Most objects won't be into the status update list, but we have to check anyways.
CWorldTickingList::DelObjStatusUpdate(this, false);
}

Expand Down
9 changes: 3 additions & 6 deletions src/game/CTimedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ CTimedObject::~CTimedObject()
void CTimedObject::_GoAwake()
{
ADDTOCALLSTACK("CTimedObject::_GoAwake");
/*
* if the timeout did expire then it got ignored on its tick and removed from the tick's map so we add it again,
* otherwise it's not needed since the timer is already there.
*/
if ((_iTimeout > 0) && (_iTimeout < CWorldGameTime::GetCurrentTime().GetTimeRaw()))

if (_IsTimerSet())
{
_SetTimeout(1); // set to 1 msec to tick it ASAP.
CWorldTickingList::AddObjSingle(_GetTimeoutRaw(), this, true);
}
_fIsSleeping = false;
}
Expand Down
Loading

0 comments on commit 0128420

Please sign in to comment.