mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-31 12:41:31 +00:00
Use normalized path in PreloadItem
This commit is contained in:
parent
1d98b5c66b
commit
7a5c478e34
1 changed files with 10 additions and 13 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <components/esm3/loadcell.hpp>
|
#include <components/esm3/loadcell.hpp>
|
||||||
#include <components/loadinglistener/reporter.hpp>
|
#include <components/loadinglistener/reporter.hpp>
|
||||||
#include <components/misc/constants.hpp>
|
#include <components/misc/constants.hpp>
|
||||||
|
#include <components/misc/pathhelpers.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/misc/strings/algorithm.hpp>
|
#include <components/misc/strings/algorithm.hpp>
|
||||||
#include <components/misc/strings/lower.hpp>
|
#include <components/misc/strings/lower.hpp>
|
||||||
|
@ -105,8 +106,8 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mesh;
|
VFS::Path::Normalized mesh;
|
||||||
std::string kfname;
|
VFS::Path::Normalized kfname;
|
||||||
for (std::string_view path : mMeshes)
|
for (std::string_view path : mMeshes)
|
||||||
{
|
{
|
||||||
if (mAbort)
|
if (mAbort)
|
||||||
|
@ -121,19 +122,15 @@ namespace MWWorld
|
||||||
if (!vfs.exists(mesh))
|
if (!vfs.exists(mesh))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
size_t slashpos = mesh.find_last_of("/\\");
|
if (Misc::getFileName(mesh).starts_with('x') && Misc::getFileExtension(mesh) == "nif")
|
||||||
if (slashpos != std::string::npos && slashpos != mesh.size() - 1)
|
|
||||||
{
|
{
|
||||||
if (Misc::StringUtils::toLower(mesh[slashpos + 1]) == 'x'
|
kfname = mesh;
|
||||||
&& Misc::StringUtils::ciEndsWith(mesh, ".nif"))
|
kfname.changeExtension("kf");
|
||||||
{
|
if (vfs.exists(kfname))
|
||||||
kfname = mesh;
|
mPreloadedObjects.insert(mKeyframeManager->get(kfname));
|
||||||
kfname.replace(kfname.size() - 4, 4, ".kf");
|
|
||||||
if (vfs.exists(kfname))
|
|
||||||
mPreloadedObjects.insert(mKeyframeManager->get(kfname));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mPreloadedObjects.insert(mSceneManager->getTemplate(VFS::Path::toNormalized(mesh)));
|
|
||||||
|
mPreloadedObjects.insert(mSceneManager->getTemplate(mesh));
|
||||||
if (mPreloadInstances)
|
if (mPreloadInstances)
|
||||||
mPreloadedObjects.insert(mBulletShapeManager->cacheInstance(mesh));
|
mPreloadedObjects.insert(mBulletShapeManager->cacheInstance(mesh));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue