MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / CreateObjectFromFile

Function CreateObjectFromFile

src/openrct2/object/ObjectFactory.cpp:257–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255 }
256
257 std::unique_ptr<Object> CreateObjectFromFile(u8string_view path, bool loadImages)
258 {
259 std::unique_ptr<Object> object;
260 auto extension = Path::GetExtension(path);
261 if (String::iequals(extension, ".json"))
262 {
263 auto pathStr = u8string(path);
264 object = CreateObjectFromJsonFile(pathStr, loadImages);
265 }
266 else if (String::iequals(extension, ".parkobj"))
267 {
268 object = CreateObjectFromZipFile(path, loadImages);
269 }
270 else
271 {
272 auto pathStr = u8string(path);
273 object = CreateObjectFromLegacyFile(pathStr.c_str(), loadImages);
274 }
275
276 return object;
277 }
278
279 std::unique_ptr<Object> CreateObjectFromLegacyFile(const utf8* path, bool loadImages)
280 {

Callers 3

exportObjectFunction · 0.85
CreateMethod · 0.85
LoadObjectMethod · 0.85

Calls 5

GetExtensionFunction · 0.85
iequalsFunction · 0.85
CreateObjectFromJsonFileFunction · 0.85
CreateObjectFromZipFileFunction · 0.85

Tested by

no test coverage detected