aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-02 10:39:51 +0000
committerDenis Kasak2009-07-02 10:39:51 +0000
commit35a677fb08402b5a9fd07366d60651bcc2f598ce (patch)
tree9d3d089804defa9d353dc47a654e23d06f284f62
parentfed2281125f862f6f0356d8d40642a90ce772394 (diff)
downloadscummvm-rg350-35a677fb08402b5a9fd07366d60651bcc2f598ce.tar.gz
scummvm-rg350-35a677fb08402b5a9fd07366d60651bcc2f598ce.tar.bz2
scummvm-rg350-35a677fb08402b5a9fd07366d60651bcc2f598ce.zip
Added BArchive::clearCache() method for clearing the data cache of opened files.
svn-id: r42019
-rw-r--r--engines/draci/barchive.cpp12
-rw-r--r--engines/draci/barchive.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/engines/draci/barchive.cpp b/engines/draci/barchive.cpp
index 4b9a1d9807..c6d6354716 100644
--- a/engines/draci/barchive.cpp
+++ b/engines/draci/barchive.cpp
@@ -377,6 +377,18 @@ BAFile *BArchive::loadFileDFW(unsigned int i) const {
return _files + i;
}
+
+/**
+ * Clears the cache of the open files inside the archive without closing it.
+ * If the files are subsequently accessed, they are read from the disk.
+ */
+void BArchive::clearCache() {
+
+ // Delete all cached data
+ for (unsigned int i = 0; i < _fileCount; ++i) {
+ _files[i].closeFile();
+ }
+}
BAFile *BArchive::operator[](unsigned int i) const {
diff --git a/engines/draci/barchive.h b/engines/draci/barchive.h
index e52e41e737..28c34fbcbb 100644
--- a/engines/draci/barchive.h
+++ b/engines/draci/barchive.h
@@ -70,6 +70,8 @@ public:
*/
bool isOpen() const { return _opened; }
+ void clearCache();
+
BAFile *operator[](unsigned int i) const;
private: