mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
Use StringUtils::format
This commit is contained in:
parent
e7474490a1
commit
a7bb87d8a1
@ -1,6 +1,7 @@
|
|||||||
#include "resources.hpp"
|
#include "resources.hpp"
|
||||||
|
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
namespace LuaUi
|
namespace LuaUi
|
||||||
{
|
{
|
||||||
@ -9,9 +10,7 @@ namespace LuaUi
|
|||||||
std::string normalizedPath = vfs()->normalizeFilename(data.mPath);
|
std::string normalizedPath = vfs()->normalizeFilename(data.mPath);
|
||||||
if (!vfs()->exists(normalizedPath))
|
if (!vfs()->exists(normalizedPath))
|
||||||
{
|
{
|
||||||
std::string error("Texture with path \"");
|
auto error = Misc::StringUtils::format("Texture with path \"%s\" doesn't exist", data.mPath);
|
||||||
error += data.mPath;
|
|
||||||
error += "\" doesn't exist";
|
|
||||||
throw std::logic_error(error);
|
throw std::logic_error(error);
|
||||||
}
|
}
|
||||||
data.mPath = normalizedPath;
|
data.mPath = normalizedPath;
|
||||||
|
@ -27,14 +27,16 @@ namespace LuaUi
|
|||||||
public:
|
public:
|
||||||
TextureResource(TextureData data)
|
TextureResource(TextureData data)
|
||||||
: mData(data)
|
: mData(data)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const TextureData& data() { return mData; }
|
const TextureData& data() { return mData; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextureData mData;
|
TextureData mData;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ResourceManager(const VFS::Manager* vfs)
|
ResourceManager(const VFS::Manager* vfs)
|
||||||
: mVfs(vfs)
|
: mVfs(vfs)
|
||||||
@ -42,10 +44,9 @@ namespace LuaUi
|
|||||||
|
|
||||||
std::shared_ptr<TextureResource> registerTexture(TextureData data);
|
std::shared_ptr<TextureResource> registerTexture(TextureData data);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
const VFS::Manager* vfs() const { return mVfs; }
|
const VFS::Manager* vfs() const { return mVfs; }
|
||||||
|
|
||||||
private:
|
|
||||||
const VFS::Manager* mVfs;
|
const VFS::Manager* mVfs;
|
||||||
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
||||||
std::unordered_map<std::string, TextureResources> mTextures;
|
std::unordered_map<std::string, TextureResources> mTextures;
|
||||||
|
Loading…
Reference in New Issue
Block a user