| 401 | } |
| 402 | |
| 403 | std::optional<ObjectEntryIndex> FindSpareSlot(ObjectType objectType) |
| 404 | { |
| 405 | auto& list = GetObjectList(objectType); |
| 406 | auto it = std::find(list.begin(), list.end(), nullptr); |
| 407 | if (it != list.end()) |
| 408 | { |
| 409 | return static_cast<ObjectEntryIndex>(std::distance(list.begin(), it)); |
| 410 | } |
| 411 | |
| 412 | auto maxSize = getObjectEntryGroupCount(objectType); |
| 413 | if (list.size() < static_cast<size_t>(maxSize)) |
| 414 | { |
| 415 | list.emplace_back(); |
| 416 | return static_cast<ObjectEntryIndex>(list.size() - 1); |
| 417 | } |
| 418 | return std::nullopt; |
| 419 | } |
| 420 | |
| 421 | size_t GetLoadedObjectIndex(const Object* object) |
| 422 | { |
nothing calls this directly
no test coverage detected