mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-17 21:13:09 +00:00
Use normalized path in LuaUi::TextureData
This commit is contained in:
parent
538e5d5502
commit
2c142faaa9
3 changed files with 5 additions and 6 deletions
|
|
@ -217,7 +217,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…
Reference in a new issue