diff options
author | md5 | 2011-05-05 20:14:21 +0300 |
---|---|---|
committer | md5 | 2011-05-05 20:14:21 +0300 |
commit | 0ef807146e5934f206f23650f5a2c51ef143be2e (patch) | |
tree | 0771ff735d2756cc29e5a31d1143fdffe2590773 /engines/sword25/kernel | |
parent | 2af3759a7810fe96d0b8a0c5124c091b085fa6f0 (diff) | |
download | scummvm-rg350-0ef807146e5934f206f23650f5a2c51ef143be2e.tar.gz scummvm-rg350-0ef807146e5934f206f23650f5a2c51ef143be2e.tar.bz2 scummvm-rg350-0ef807146e5934f206f23650f5a2c51ef143be2e.zip |
SWORD25: Remove thumbnails from the cache when saving a new game
Diffstat (limited to 'engines/sword25/kernel')
-rw-r--r-- | engines/sword25/kernel/persistenceservice.cpp | 3 | ||||
-rw-r--r-- | engines/sword25/kernel/resmanager.cpp | 15 | ||||
-rw-r--r-- | engines/sword25/kernel/resmanager.h | 5 |
3 files changed, 23 insertions, 0 deletions
diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index 500703befb..6bb2b1b102 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -336,6 +336,9 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF // Savegameinformationen für diesen Slot aktualisieren. _impl->readSlotSavegameInformation(slotID); + // Empty the cache, to remove old thumbnails + Kernel::getInstance()->getResourceManager()->emptyThumbnailCache(); + // Erfolg signalisieren. return true; } diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index 8b446e69d1..b77d79e8ea 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -147,6 +147,21 @@ void ResourceManager::emptyCache() { } } +void ResourceManager::emptyThumbnailCache() { + // Scan through the resource list + Common::List<Resource *>::iterator iter = _resources.begin(); + while (iter != _resources.end()) { + if ((*iter)->getFileName().hasPrefix("/saves")) { + // Unlock the thumbnail + while ((*iter)->getLockCount() > 0) + (*iter)->release(); + // Delete the thumbnail + iter = deleteResource(*iter); + } else + ++iter; + } +} + /** * Returns a requested resource. If any error occurs, returns NULL * @param FileName Filename of resource diff --git a/engines/sword25/kernel/resmanager.h b/engines/sword25/kernel/resmanager.h index 5b2bfd395f..f8006bd62d 100644 --- a/engines/sword25/kernel/resmanager.h +++ b/engines/sword25/kernel/resmanager.h @@ -82,6 +82,11 @@ public: void emptyCache(); /** + * Removes all the savegame thumbnails from the cache + **/ + void emptyThumbnailCache(); + + /** * Writes the names of all currently locked resources to the log file */ void dumpLockedResources(); |