| 1578 | } |
| 1579 | |
| 1580 | void 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 | |
| 1605 | void EntitySystemHelpersBase::UpdateQueryCache() |
| 1606 | { |
nothing calls this directly
no test coverage detected