0x004720EB Returns std::nullopt if not loaded
| 177 | // 0x004720EB |
| 178 | // Returns std::nullopt if not loaded |
| 179 | std::optional<LoadedObjectHandle> findObjectHandle(const ObjectHeader& header) |
| 180 | { |
| 181 | if ((header.flags & 0xFF) != 0xFF) |
| 182 | { |
| 183 | auto objectType = header.getType(); |
| 184 | const auto& typedObjectList = getRepositoryItem(objectType); |
| 185 | auto maxObjectsForType = getMaxObjects(objectType); |
| 186 | for (LoadedObjectId i = 0; i < maxObjectsForType; i++) |
| 187 | { |
| 188 | auto obj = typedObjectList.objects[i]; |
| 189 | if (obj != nullptr && obj != reinterpret_cast<Object*>(-1)) |
| 190 | { |
| 191 | const auto& objHeader = typedObjectList.objectEntryExtendeds[i]; |
| 192 | |
| 193 | if (header == objHeader) // PERHAPS WRONG WAY ROUND |
| 194 | { |
| 195 | return { LoadedObjectHandle{ objectType, i } }; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | return std::nullopt; |
| 201 | } |
| 202 | |
| 203 | // 0x0047206C |
| 204 | // Returns std::nullopt if not loaded |
no test coverage detected