diff options
Diffstat (limited to 'engines/draci/barchive.h')
-rw-r--r-- | engines/draci/barchive.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/engines/draci/barchive.h b/engines/draci/barchive.h index 0971375c7b..a53fb79ee1 100644 --- a/engines/draci/barchive.h +++ b/engines/draci/barchive.h @@ -51,14 +51,25 @@ struct BAFile { class BArchive { public: - BArchive() : _files(NULL), _fileCount(0) {} - BArchive(Common::String &path) : _files(NULL), _fileCount(0) { openArchive(path); } + BArchive() : _files(NULL), _fileCount(0), _opened(false) {} + + BArchive(Common::String &path) : + _files(NULL), _fileCount(0), _opened(false) { + openArchive(path); + } + ~BArchive() { closeArchive(); } void openArchive(const Common::String &path); void closeArchive(void); uint16 size() const { return _fileCount; } + /** + * Checks whether there is an archive opened. Should be called before reading + * from the archive to check whether openArchive() succeeded. + */ + bool isOpen() const { return _opened; } + BAFile *operator[](unsigned int i) const; private: @@ -74,6 +85,7 @@ private: BAFile *_files; //!< Internal array of files uint16 _fileCount; //!< Number of files in archive bool _isDFW; //!< True if the archive is in DFW format, false otherwise + bool _opened; //!< True if the archive is opened, false otherwise void openDFW(const Common::String &path); BAFile *loadFileDFW(unsigned int i) const; |