MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / partialLoad

Function partialLoad

src/OpenLoco/src/Objects/ObjectManager.cpp:655–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653 }
654
655 static bool partialLoad(const ObjectHeader& header, std::span<std::byte> objectData)
656 {
657 auto type = header.getType();
658 size_t index = 0;
659 for (; index < getMaxObjects(type); ++index)
660 {
661 if (getRepositoryItem(type).objects[index] == reinterpret_cast<Object*>(-1))
662 {
663 break;
664 }
665 }
666 // No slot found. Not possible except if unload all had not been called
667 if (index >= getMaxObjects(type))
668 {
669 return false;
670 }
671
672 auto* obj = reinterpret_cast<Object*>(objectData.data());
673 getRepositoryItem(type).objects[index] = obj;
674 getRepositoryItem(type).objectEntryExtendeds[index] = ObjectEntry2(header, static_cast<uint32_t>(objectData.size()));
675 return true;
676 }
677
678 static void permutateObjectFilename(std::string& filename)
679 {

Callers 1

tryInstallObjectFunction · 0.85

Calls 5

getMaxObjectsFunction · 0.85
ObjectEntry2Class · 0.85
getTypeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected