Use normalized paths to construct big icon paths

This commit is contained in:
Evil Eye
2026-04-04 17:43:57 +02:00
parent 9e45f68a6c
commit 2dca72bdb0
5 changed files with 15 additions and 15 deletions
+2 -6
View File
@@ -354,12 +354,8 @@ namespace MWGui
// use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(
spell->mEffects.mList.front().mData.mEffectID);
std::string icon = effect->mIcon;
std::replace(icon.begin(), icon.end(), '/', '\\');
size_t slashPos = icon.rfind('\\');
icon.insert(slashPos + 1, "b_");
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctIconPath(
VFS::Path::toNormalized(icon), *MWBase::Environment::get().getResourceSystem()->getVFS());
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctBigIconPath(
VFS::Path::toNormalized(effect->mIcon), *MWBase::Environment::get().getResourceSystem()->getVFS());
mSpellImage->setSpellIcon(iconPath);
}
else
+2 -5
View File
@@ -323,11 +323,8 @@ namespace MWGui
const ESM::MagicEffect* effect
= esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mData.mEffectID);
std::string path = effect->mIcon;
std::replace(path.begin(), path.end(), '/', '\\');
path.insert(path.rfind('\\') + 1, "b_");
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctIconPath(
VFS::Path::toNormalized(path), *MWBase::Environment::get().getResourceSystem()->getVFS());
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctBigIconPath(
VFS::Path::toNormalized(effect->mIcon), *MWBase::Environment::get().getResourceSystem()->getVFS());
float scale = 1.f;
MyGUI::ITexture* texture
+2 -4
View File
@@ -959,10 +959,8 @@ namespace MWGui
const auto& store = MWBase::Environment::get().getESMStore();
const ESM::MagicEffect* effect = store->get<ESM::MagicEffect>().find(effectId);
std::string icon = effect->mIcon;
icon.insert(icon.rfind('\\') + 1, "b_");
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctIconPath(
VFS::Path::toNormalized(icon), *MWBase::Environment::get().getResourceSystem()->getVFS());
const VFS::Path::Normalized iconPath = Misc::ResourceHelpers::correctBigIconPath(
VFS::Path::toNormalized(effect->mIcon), *MWBase::Environment::get().getResourceSystem()->getVFS());
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "MagicEffectToolTip");
+8
View File
@@ -145,6 +145,14 @@ VFS::Path::Normalized Misc::ResourceHelpers::correctIconPath(VFS::Path::Normaliz
return correctResourcePath({ { icons } }, resPath, vfs, dds);
}
VFS::Path::Normalized Misc::ResourceHelpers::correctBigIconPath(
VFS::Path::NormalizedView resPath, const VFS::Manager& vfs)
{
std::string name("b_");
name += resPath.filename().value();
return correctIconPath(VFS::Path::join(resPath.parent(), name), vfs);
}
VFS::Path::Normalized Misc::ResourceHelpers::correctBookartPath(
VFS::Path::NormalizedView resPath, const VFS::Manager& vfs)
{
+1
View File
@@ -29,6 +29,7 @@ namespace Misc
VFS::Path::NormalizedView resPath, const VFS::Manager& vfs, VFS::Path::ExtensionView ext = {});
VFS::Path::Normalized correctTexturePath(VFS::Path::NormalizedView resPath, const VFS::Manager& vfs);
VFS::Path::Normalized correctIconPath(VFS::Path::NormalizedView resPath, const VFS::Manager& vfs);
VFS::Path::Normalized correctBigIconPath(VFS::Path::NormalizedView resPath, const VFS::Manager& vfs);
VFS::Path::Normalized correctBookartPath(VFS::Path::NormalizedView resPath, const VFS::Manager& vfs);
VFS::Path::Normalized correctBookartPath(
VFS::Path::NormalizedView resPath, int width, int height, const VFS::Manager& vfs);