MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / LoadMPQ

Function LoadMPQ

Source/init.cpp:97–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96#else
97std::optional<MpqArchive> LoadMPQ(const std::vector<std::string> &paths, string_view mpqName)
98{
99 std::optional<MpqArchive> archive;
100 std::string mpqAbsPath;
101 std::int32_t error = 0;
102 for (const auto &path : paths) {
103 mpqAbsPath = path + mpqName.data();
104 if ((archive = MpqArchive::Open(mpqAbsPath.c_str(), error))) {
105 LogVerbose(" Found: {} in {}", mpqName, path);
106 return archive;
107 }
108 if (error != 0) {
109 LogError("Error {}: {}", MpqArchive::ErrorMessage(error), mpqAbsPath);
110 }
111 }
112 if (error == 0) {
113 LogVerbose("Missing: {}", mpqName);
114 }
115
116 return std::nullopt;
117}
118#endif
119
120std::vector<std::string> GetMPQSearchPaths()

Callers 3

LoadCoreArchivesFunction · 0.85
LoadLanguageArchiveFunction · 0.85
LoadGameArchivesFunction · 0.85

Calls 3

LogVerboseFunction · 0.85
LogErrorFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected