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