1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

LoaderIMG now returns reference

This commit is contained in:
Timmy Sjöstedt 2013-07-01 05:32:43 +02:00
parent 5257ddcc8c
commit 2b8c961b1f
2 changed files with 5 additions and 7 deletions

View File

@ -35,17 +35,15 @@ bool LoaderIMG::load(const std::string& filename)
}
/// Get the information of a asset in the examining archive
LoaderIMGFile LoaderIMG::getAssetInfo(const std::string& assetname)
LoaderIMGFile &LoaderIMG::getAssetInfo(const std::string& assetname)
{
LoaderIMGFile file;
for(size_t i = 0; i < m_assets.size(); ++i)
{
if(strcmp(m_assets[i].name, assetname.c_str()) == 0)
{
file = m_assets[i];
return m_assets[i];
}
}
return file;
}
char* LoaderIMG::loadToMemory(const std::string& assetname)
@ -111,7 +109,7 @@ bool LoaderIMG::saveAsset(const std::string& assetname, const std::string& filen
}
/// Get the information of an asset by its index
LoaderIMGFile LoaderIMG::getAssetInfoByIndex(size_t index)
LoaderIMGFile &LoaderIMG::getAssetInfoByIndex(size_t index)
{
return m_assets[index];
}

View File

@ -45,10 +45,10 @@ public:
bool saveAsset(const std::string& assetname, const std::string& filename);
/// Get the information of an asset in the examining archive
LoaderIMGFile getAssetInfo(const std::string& assetname);
LoaderIMGFile &getAssetInfo(const std::string& assetname);
/// Get the information of an asset by its index
LoaderIMGFile getAssetInfoByIndex(size_t index);
LoaderIMGFile &getAssetInfoByIndex(size_t index);
/// Returns the number of asset files in the archive
uint32_t getAssetCount();