1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +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

@ -21,7 +21,21 @@ CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 st
}
CFileInputStream::CFileInputStream(const CFileInfo & file, si64 start, si64 size)
: CFileInputStream{file.getName(), start, size} {}
: dataStart{start},
dataSize{size},
fileStream{file.getName(), std::ios::in | std::ios::binary}
{
if (fileStream.fail())
throw std::runtime_error("File " + file.getName() + " isn't available.");
if (dataSize == 0)
{
fileStream.seekg(0, std::ios::end);
dataSize = tell();
}
fileStream.seekg(dataStart, std::ios::beg);
}
si64 CFileInputStream::read(ui8 * data, si64 size)
{