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

Method Load

src/openrct2/AssetPack.cpp:155–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153 };
154
155 void AssetPack::Load()
156 {
157 auto path = Path.u8string();
158 auto archive = Zip::Open(path, ZipAccess::read);
159 if (!archive->Exists(ManifestFileName))
160 {
161 throw std::runtime_error("Manifest does not exist.");
162 }
163
164 AssetPackLoadContext loadContext(path, archive.get());
165
166 auto manifestJson = archive->GetFileData(ManifestFileName);
167 auto jManifest = Json::FromVector(manifestJson);
168 auto& jObjects = jManifest["objects"];
169
170 _entries.clear();
171 for (auto& jObject : jObjects)
172 {
173 Entry entry;
174 entry.ObjectId = jObject["id"].get<std::string>();
175
176 if (jObject.contains("samples"))
177 {
178 entry.TableIndex = _sampleTable.GetCount();
179 _sampleTable.ReadFromJson(&loadContext, jObject);
180 entry.TableLength = _sampleTable.GetCount() - entry.TableIndex;
181 }
182 _entries.push_back(entry);
183 }
184 }
185} // namespace OpenRCT2

Callers 4

ReloadMethod · 0.45
LoadPreviewMethod · 0.45
onScrollMouseOverMethod · 0.45
LoadParkFromFileMethod · 0.45

Calls 10

FromVectorFunction · 0.85
ExistsMethod · 0.80
ReadFromJsonMethod · 0.80
getMethod · 0.65
clearMethod · 0.65
containsMethod · 0.65
OpenFunction · 0.50
GetFileDataMethod · 0.45
GetCountMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected