本文整理汇总了C++中PackageManager::loadPackage方法的典型用法代码示例。如果您正苦于以下问题:C++ PackageManager::loadPackage方法的具体用法?C++ PackageManager::loadPackage怎么用?C++ PackageManager::loadPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageManager
的用法示例。
在下文中一共展示了PackageManager::loadPackage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
bool Sword25Engine::loadPackages() {
PackageManager *packageManagerPtr = Kernel::getInstance()->getPackage();
assert(packageManagerPtr);
// Load the main package
if (!packageManagerPtr->loadPackage("data.b25c", "/"))
return false;
// Get the contents of the main program directory and sort them alphabetically
Common::FSNode dir(ConfMan.get("path"));
Common::FSList files;
if (!dir.isDirectory() || !dir.getChildren(files, Common::FSNode::kListAll)) {
warning("Game data path does not exist or is not a directory");
return false;
}
Common::sort(files.begin(), files.end());
// Identify all patch packages
// The filename of patch packages must have the form patch??.b25c, with the question marks
// are placeholders for numbers.
// Since the filenames have been sorted, patches are mounted with low numbers first, through
// to ones with high numbers. This is important, because newly mount packages overwrite
// existing files in the virtual file system, if they include files with the same name.
for (Common::FSList::const_iterator it = files.begin(); it != files.end(); ++it) {
if (it->getName().matchString("patch???.b25c", true))
if (!packageManagerPtr->loadPackage(it->getName(), "/"))
return false;
}
// Identify and mount all language packages
// The filename of the packages have the form lang_*.b25c (eg. lang_de.b25c)
for (Common::FSList::const_iterator it = files.begin(); it != files.end(); ++it) {
if (it->getName().matchString("lang_*.b25c", true))
if (!packageManagerPtr->loadPackage(it->getName(), "/"))
return false;
}
return true;
}