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

Function installObject

src/OpenLoco/src/Objects/ObjectManager.cpp:734–761  ·  view source on GitHub ↗

0x0047285C

Source from the content-addressed store, hash-verified

732
733 // 0x0047285C
734 static bool installObject(const ObjectHeader& objectHeader)
735 {
736 // Prepare progress bar
737 char caption[512];
738 auto* str = StringManager::formatString(caption, sizeof(caption), StringIds::installing_new_data);
739 // Convert object name to string so it is properly terminated
740 std::string objectname(objectHeader.getName());
741 strcat(str, objectname.c_str());
742 Ui::ProgressBar::begin(caption);
743 Ui::ProgressBar::setProgress(50);
744 Input::processMessagesMini();
745
746 // Get new file path
747 std::string filename = objectname;
748 sanatiseObjectFilename(filename);
749 const auto objPath = findCustomObjectPath(filename);
750
751 // Create new file and output object file
752 Ui::ProgressBar::setProgress(180);
753 FileStream fs(objPath, StreamMode::write);
754 SawyerStreamWriter stream(fs);
755 writePackedObjects(stream, { objectHeader });
756
757 Ui::ProgressBar::setProgress(240);
758 Ui::ProgressBar::setProgress(255);
759 Ui::ProgressBar::end();
760 return true;
761 }
762
763 // 0x00472687 based on
764 bool tryInstallObject(const ObjectHeader& objectHeader, std::span<const std::byte> data)

Callers 1

tryInstallObjectFunction · 0.85

Calls 9

formatStringFunction · 0.85
beginFunction · 0.85
processMessagesMiniFunction · 0.85
sanatiseObjectFilenameFunction · 0.85
findCustomObjectPathFunction · 0.85
writePackedObjectsFunction · 0.85
endFunction · 0.85
getNameMethod · 0.80
setProgressFunction · 0.50

Tested by

no test coverage detected