1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Merge fixes

This commit is contained in:
AlexVinS
2016-02-04 12:28:12 +03:00
parent 6e205a58b4
commit 483276b128
10 changed files with 32 additions and 18 deletions

View File

@ -14,12 +14,12 @@
*
*/
CZipStream::CZipStream(const boost::filesystem::path & archive, unz64_file_pos filepos)
CZipStream::CZipStream(std::shared_ptr<CIOApi> api, const boost::filesystem::path & archive, unz64_file_pos filepos)
{
zlib_filefunc64_def zlibApi;
zlibApi = api->getApiStructure();
file = unzOpen2_64(archive.c_str(), &zlibApi);
unzGoToFilePos64(file, &filepos);
unzOpenCurrentFile(file);
@ -53,7 +53,7 @@ ui32 CZipStream::calculateCRC32()
///CZipLoader
CZipLoader::CZipLoader(const std::string & mountPoint, const boost::filesystem::path & archive, std::shared_ptr<CIOApi> api):
ioApi(api),
zlibApi(ioApi->getApiStructure()),
zlibApi(ioApi->getApiStructure()),
archiveName(archive),
mountPoint(mountPoint),
files(listFiles(mountPoint, archive))
@ -66,7 +66,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
std::unordered_map<ResourceID, unz64_file_pos> ret;
unzFile file = unzOpen2_64(archive.c_str(), &zlibApi);
if(file == nullptr)
logGlobal->errorStream() << archive << " failed to open";
@ -95,7 +95,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
std::unique_ptr<CInputStream> CZipLoader::load(const ResourceID & resourceName) const
{
return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
}
bool CZipLoader::existsResource(const ResourceID & resourceName) const