MCPcopy Create free account
hub / github.com/Norbyte/bg3se / MapSingleComponentQuery

Method MapSingleComponentQuery

BG3Extender/GameDefinitions/EntitySystem.cpp:1580–1603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1578}
1579
1580void EntitySystemHelpersBase::MapSingleComponentQuery(QueryIndex queryIndex, ComponentTypeIndex component)
1581{
1582 auto extComponent = GetComponentType(component);
1583 if (!extComponent) return;
1584
1585 auto& desc = components_[(unsigned)*extComponent];
1586 if (desc.SingleComponentQuery != ecs::UndefinedQuery) {
1587 auto const& currentQuery = GetEntityWorld()->Queries.Queries[(unsigned)desc.SingleComponentQuery];
1588 auto const& newQuery = GetEntityWorld()->Queries.Queries[(unsigned)queryIndex];
1589
1590 // Only allow replacing the query if it is different from the previous and has less optionals/adds
1591 if (!(
1592 newQuery.GetOptionalOneFrames().size() < currentQuery.GetOptionalOneFrames().size()
1593 || newQuery.GetOptionals().size() < currentQuery.GetOptionals().size()
1594 || newQuery.GetIncludeAny().size() < currentQuery.GetIncludeAny().size()
1595 || newQuery.GetImmediates().size() < currentQuery.GetImmediates().size()
1596 ))
1597 {
1598 return;
1599 }
1600 }
1601
1602 desc.SingleComponentQuery = queryIndex;
1603}
1604
1605void EntitySystemHelpersBase::UpdateQueryCache()
1606{

Callers

nothing calls this directly

Calls 7

GetComponentTypeFunction · 0.85
GetEntityWorldFunction · 0.85
GetOptionalOneFramesMethod · 0.80
GetIncludeAnyMethod · 0.80
GetImmediatesMethod · 0.80
sizeMethod · 0.45
GetOptionalsMethod · 0.45

Tested by

no test coverage detected