Small adjustments to entitycache

This commit is contained in:
BenCat07 2023-02-28 23:15:11 +01:00
parent 0531439d3c
commit 038da8c96f

View File

@ -87,18 +87,23 @@ void Update()
for (auto &[key, val] : array)
{
val.Update();
if (val.InternalEntity() && !val.InternalEntity()->IsDormant())
if (val.InternalEntity())
{
valid_ents.emplace_back(&val);
if (val.m_Type() == ENTITY_PLAYER)
// Non-dormant entities that need bone updates
if (!val.InternalEntity()->IsDormant())
{
GetPlayerInfo(val.m_IDX, val.player_info);
if (val.m_bAlivePlayer()) [[likely]]
{
val.hitboxes.UpdateBones();
player_cache.emplace_back(&val);
}
valid_ents.emplace_back(&val);
if (val.m_Type() == ENTITY_PLAYER || val.m_Type() == ENTITY_BUILDING || val.m_Type() == ENTITY_NPC)
if (val.m_bAlivePlayer()) [[likely]]
{
val.hitboxes.UpdateBones();
if (val.m_Type() == ENTITY_PLAYER)
player_cache.emplace_back(&val);
}
}
if (val.m_Type() == ENTITY_PLAYER)
GetPlayerInfo(val.m_IDX, val.player_info);
}
}
previous_max = max;
@ -122,9 +127,11 @@ void Update()
if (ent.m_Type() == ENTITY_PLAYER || ent.m_Type() == ENTITY_BUILDING || ent.m_Type() == ENTITY_NPC)
{
if (ent.m_bAlivePlayer()) [[likely]]
{
ent.hitboxes.UpdateBones();
if (ent.m_Type() == ENTITY_PLAYER)
player_cache.emplace_back(&ent);
if (ent.m_Type() == ENTITY_PLAYER)
player_cache.emplace_back(&ent);
}
}
}