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

Method load

src/OpenLoco/src/Objects/CompetitorObject.cpp:76–105  ·  view source on GitHub ↗

0x00434CA0

Source from the content-addressed store, hash-verified

74
75 // 0x00434CA0
76 void CompetitorObject::load(const LoadedObjectHandle& handle, std::span<const std::byte> data, ObjectManager::DependentObjects*)
77 {
78 auto remainingData = data.subspan(sizeof(CompetitorObject));
79
80 // Load object name string
81 auto loadString = [&remainingData, &handle](StringId& dst, uint8_t num) {
82 auto strRes = ObjectManager::loadStringTable(remainingData, handle, num);
83 dst = strRes.str;
84 remainingData = remainingData.subspan(strRes.tableLength);
85 };
86
87 loadString(name, 0);
88 loadString(availableNamePrefixes, 1);
89
90 // Load images
91 auto imageRes = ObjectManager::loadImageTable(remainingData);
92 const auto baseImageId = imageRes.imageOffset;
93 std::fill(std::begin(images), std::end(images), baseImageId);
94 for (auto i = 0U, emotionImageOffset = 0U; i < std::size(images); ++i)
95 {
96 if (emotions & (1 << i))
97 {
98 images[i] += emotionImageOffset;
99 emotionImageOffset += 2;
100 }
101 }
102
103 // Ensure we've loaded the entire object
104 assert(remainingData.size() == imageRes.tableLength);
105 }
106
107 // 0x00434D08
108 void CompetitorObject::unload()

Callers

nothing calls this directly

Calls 5

loadStringTableFunction · 0.85
loadImageTableFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected