1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-18 16:32:32 +02:00

Ensure that LoaderIMG always has the correct archive filename.

This commit is contained in:
Daniel Evans 2016-05-02 01:42:27 +01:00
parent d2f254731a
commit f2fb822a83

View File

@ -11,14 +11,14 @@ LoaderIMG::LoaderIMG()
bool LoaderIMG::load(const std::string& filename)
{
std::string dirName = filename;
auto extpos = dirName.find(".img");
if( extpos != std::string::npos )
auto baseName = filename;
auto extpos = filename.find(".img");
if (extpos != std::string::npos)
{
dirName.erase(extpos);
baseName.erase(extpos);
}
dirName.append(".dir");
auto dirName = baseName + ".dir";
auto imgName = baseName + ".img";
FILE* fp = fopen(dirName.c_str(), "rb");
if(fp)
@ -37,7 +37,7 @@ bool LoaderIMG::load(const std::string& filename)
}
fclose(fp);
m_archive = filename;
m_archive = imgName;
return true;
}
else
@ -80,7 +80,6 @@ char* LoaderIMG::loadToMemory(const std::string& assetname)
}
std::string dirName = m_archive;
dirName.append(".img");
FILE* fp = fopen(dirName.c_str(), "rb");
if(fp)