mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 11:23:27 -04:00
Use normalized path in LuaUi::TextureData
This commit is contained in:
parent
a79e121df6
commit
bc219b6a1e
@ -231,7 +231,7 @@ namespace MWLua
|
||||
LuaUi::TextureData data;
|
||||
sol::object path = LuaUtil::getFieldOrNil(options, "path");
|
||||
if (path.is<std::string>())
|
||||
data.mPath = path.as<std::string>();
|
||||
data.mPath = VFS::Path::Normalized(path.as<std::string>());
|
||||
if (data.mPath.empty())
|
||||
throw std::logic_error("Invalid texture path");
|
||||
sol::object offset = LuaUtil::getFieldOrNil(options, "offset");
|
||||
|
@ -6,8 +6,6 @@ namespace LuaUi
|
||||
{
|
||||
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
||||
{
|
||||
VFS::Path::normalizeFilenameInPlace(data.mPath);
|
||||
|
||||
TextureResources& list = mTextures[data.mPath];
|
||||
list.push_back(std::make_shared<TextureResource>(data));
|
||||
return list.back();
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define OPENMW_LUAUI_RESOURCES
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <osg/Vec2f>
|
||||
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
namespace VFS
|
||||
{
|
||||
class Manager;
|
||||
@ -17,7 +18,7 @@ namespace LuaUi
|
||||
{
|
||||
struct TextureData
|
||||
{
|
||||
std::string mPath;
|
||||
VFS::Path::Normalized mPath;
|
||||
osg::Vec2f mOffset;
|
||||
osg::Vec2f mSize;
|
||||
};
|
||||
@ -33,7 +34,7 @@ namespace LuaUi
|
||||
|
||||
private:
|
||||
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
||||
std::unordered_map<std::string, TextureResources> mTextures;
|
||||
std::unordered_map<VFS::Path::Normalized, TextureResources, VFS::Path::Hash> mTextures;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user