MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / loadArchives

Method loadArchives

src/engine/BaseEngine.cpp:131–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void BaseEngine::loadArchives()
132{
133 // Load explicit modfile with highest priority
134 if (!m_Args.modfile.empty())
135 {
136 LogInfo() << "Reading Mod-File from Commandline: " << m_Args.modfile;
137 m_FileIndex.loadVDF(m_Args.modfile);
138 }
139
140 // Load mod archives
141 std::list<std::string> modArchives = Utils::getFilesInDirectory(m_Args.gameBaseDirectory + "/Data", "mod", false);
142 modArchives.sort([](const std::string &lhs, const std::string &rhs)
143 { return VDFS::FileIndex::getLastModTime(lhs) > VDFS::FileIndex::getLastModTime(rhs); });
144 LogInfo() << "Loading MOD-Archives: " << modArchives;
145 if (!modArchives.empty())
146 for (std::string& s : modArchives)
147 m_FileIndex.loadVDF(s);
148
149 // Load zip archives
150 std::list<std::string> zipArchives = Utils::getFilesInDirectory(m_Args.gameBaseDirectory + "/Data", "zip", false);
151 zipArchives.sort([](const std::string &lhs, const std::string &rhs)
152 { return VDFS::FileIndex::getLastModTime(lhs) > VDFS::FileIndex::getLastModTime(rhs); });
153 LogInfo() << "Loading ZIP-Archives: " << zipArchives;
154 if (!zipArchives.empty())
155 for (std::string& s : zipArchives)
156 m_FileIndex.loadVDF(s);
157
158 // Load vdf archives
159 std::list<std::string> vdfArchives = Utils::getFilesInDirectory(m_Args.gameBaseDirectory + "/Data", "vdf");
160 vdfArchives.sort([](const std::string &lhs, const std::string &rhs)
161 { return VDFS::FileIndex::getLastModTime(lhs) > VDFS::FileIndex::getLastModTime(rhs); });
162 LogInfo() << "Loading VDF-Archives: " << vdfArchives;
163 for (std::string& s : vdfArchives)
164 m_FileIndex.loadVDF(s);
165
166 m_FileIndex.finalizeLoad();
167}
168
169void BaseEngine::onWorldCreated(Handle::WorldHandle world)
170{

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
finalizeLoadMethod · 0.45

Tested by

no test coverage detected