diff options
author | Paul Gilbert | 2013-12-15 17:51:47 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-12-15 17:51:47 -0500 |
commit | 663d08b192027a534f077168b72e79fe63a799fd (patch) | |
tree | 6012ea9e7ee3131d699beda54272863c9f8fdb0b /engines | |
parent | 28ecf5ba53c81389dfd3ef8f7f4ee25d00ced39e (diff) | |
download | scummvm-rg350-663d08b192027a534f077168b72e79fe63a799fd.tar.gz scummvm-rg350-663d08b192027a534f077168b72e79fe63a799fd.tar.bz2 scummvm-rg350-663d08b192027a534f077168b72e79fe63a799fd.zip |
VOYEUR: Fix for when multiple bolt files are open
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/files.cpp | 10 | ||||
-rw-r--r-- | engines/voyeur/files.h | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index a9473d4b70..28f4763877 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -163,9 +163,10 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) { #undef NEXT_BYTE void BoltFilesState::nextBlock() { - if (_curFilePosition != _bufferEnd) - _curFd->seek(_bufferEnd); + if (&_curLibPtr->_file != _curFd || _curFilePosition != _bufferEnd) + _curLibPtr->_file.seek(_bufferEnd); + _curFd = &_curLibPtr->_file; _bufferBegin = _bufferEnd; int bytesRead = _curFd->read(_bufStart, _bufSize); @@ -219,7 +220,6 @@ byte *FilesManager::fload(const Common::String &filename, int *size) { /*------------------------------------------------------------------------*/ BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _state(state) { - _state._curFd = &_file; if (!_file.open(filename)) error("Could not open %s", filename.c_str()); _state._curFilePosition = 0; @@ -233,13 +233,15 @@ BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _stat int totalGroups = header[11] ? header[11] : 0x100; for (int i = 0; i < totalGroups; ++i) - _groups.push_back(BoltGroup(_state._curFd)); + _groups.push_back(BoltGroup(&_file)); } BoltFile::~BoltFile() { _file.close(); if (_state._curFd == &_file) _state._curFd = NULL; + if (_state._curLibPtr == this) + _state._curLibPtr = NULL; } BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 28c77bb5f1..e82d6a83bc 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -100,7 +100,6 @@ public: class BoltFile { private: Common::Array<BoltGroup> _groups; - Common::File _file; protected: BoltFilesState &_state; @@ -116,6 +115,8 @@ private: void initGro() {} // TODO void termGro() {} // TODO public: + Common::File _file; +public: BoltFile(const Common::String &filename, BoltFilesState &state); virtual ~BoltFile(); |