| 1178 | } |
| 1179 | |
| 1180 | void* EntitySystemHelpersBase::GetRawSingleton(ExtComponentType type) |
| 1181 | { |
| 1182 | auto& meta = GetComponentMeta(type); |
| 1183 | if (meta.SingleComponentQuery == ecs::UndefinedQuery) { |
| 1184 | WARN("No query defined for singleton %s?", GetComponentName(meta.ComponentIndex)->c_str()); |
| 1185 | return nullptr; |
| 1186 | } |
| 1187 | |
| 1188 | auto world = GetEntityWorld(); |
| 1189 | auto const& query = world->Queries.Queries[(unsigned)meta.SingleComponentQuery]; |
| 1190 | if (query.EntityStorages.empty()) { |
| 1191 | return nullptr; |
| 1192 | } |
| 1193 | |
| 1194 | auto const& storage = query.EntityStorages.values()[0]; |
| 1195 | if (storage.Storage->InstanceToPageMap.empty()) { |
| 1196 | return nullptr; |
| 1197 | } |
| 1198 | |
| 1199 | auto page = storage.Storage->InstanceToPageMap.values()[0]; |
| 1200 | return storage.Storage->GetComponent(page, storage.GetComponentIndex(0), meta.Size, meta.IsProxy); |
| 1201 | } |
| 1202 | |
| 1203 | EntityHandle EntitySystemHelpersBase::GetSingletonEntity(ExtComponentType type) |
| 1204 | { |
nothing calls this directly
no test coverage detected