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

Function computeObjectChecksum

src/OpenLoco/src/Objects/ObjectManager.cpp:388–404  ·  view source on GitHub ↗

0x0047270B

Source from the content-addressed store, hash-verified

386
387 // 0x0047270B
388 static bool computeObjectChecksum(const ObjectHeader& object, std::span<const std::byte> data)
389 {
390 // Compute the checksum of header and data
391
392 // Annoyingly the header you need to only compute the first byte of the flags
393 const auto headerFlag = std::span(reinterpret_cast<const std::byte*>(&object), 1);
394 auto checksum = computeChecksum(headerFlag, objectChecksumMagic);
395
396 // And then the name
397 const auto headerName = std::span(reinterpret_cast<const std::byte*>(&object.name), sizeof(ObjectHeader::name));
398 checksum = computeChecksum(headerName, checksum);
399
400 // Finally compute the data's checksum
401 checksum = computeChecksum(data, checksum);
402
403 return checksum == object.checksum;
404 }
405
406 // 0x00471B95
407 void freeTemporaryObject()

Callers 2

findAndPreLoadObjectFunction · 0.85
tryInstallObjectFunction · 0.85

Calls 1

computeChecksumFunction · 0.85

Tested by

no test coverage detected