1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +00:00

Don't force DDS file usage (fixes #1392)

Fallback to a DDS file if the requested texture path doesn't point to an existing file, not vice versa
This commit is contained in:
Capostrophic 2018-04-12 18:18:17 +03:00 committed by Capostrophic
parent 9b8c56761b
commit 90f3ff2da4

View file

@ -63,28 +63,16 @@ std::string Misc::ResourceHelpers::correctResourcePath(const std::string &topLev
std::string origExt = correctedPath;
// since we know all (GOTY edition or less) textures end
// in .dds, we change the extension
bool changedToDds = changeExtensionToDds(correctedPath);
if (vfs->exists(correctedPath))
if (vfs->exists(origExt)
|| (changeExtensionToDds(correctedPath) && vfs->exists(correctedPath)))
return correctedPath;
// if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods)
// verify, and revert if false (this call succeeds quickly, but fails slowly)
if (changedToDds && vfs->exists(origExt))
return origExt;
// fall back to a resource in the top level directory if it exists
std::string fallback = topLevelDirectory + "\\" + getBasename(correctedPath);
if (vfs->exists(fallback))
std::string fallback = topLevelDirectory + "\\" + getBasename(origExt);
if (vfs->exists(fallback)
|| (changeExtensionToDds(fallback) && vfs->exists(fallback)))
return fallback;
if (changedToDds)
{
fallback = topLevelDirectory + "\\" + getBasename(origExt);
if (vfs->exists(fallback))
return fallback;
}
return correctedPath;
}